예제 #1
0
void RenderVTTCue::layout()
{
    StackStats::LayoutCheckPoint layoutCheckPoint;
    RenderBlockFlow::layout();

#if ENABLE(WEBVTT_REGIONS)
    // If WebVTT Regions are used, the regular WebVTT layout algorithm is no
    // longer necessary, since cues having the region parameter set do not have
    // any positioning parameters. Also, in this case, the regions themselves
    // have positioning information.
    if (!m_cue->regionId().isEmpty())
        return;
#endif

    LayoutStateMaintainer statePusher(view(), *this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode());
    
    if (m_cue->cueType()== TextTrackCue::WebVTT) {
        if (toVTTCue(m_cue)->snapToLines())
            repositionCueSnapToLinesSet();
        else
            repositionCueSnapToLinesNotSet();
    } else
        repositionGenericCue();

    statePusher.pop();
}
예제 #2
0
void RenderTextTrackCue::repositionGenericCue()
{
    ASSERT(firstChild());
    InlineFlowBox* firstLineBox = toRenderInline(firstChild())->firstLineBox();
    if (static_cast<TextTrackCueGeneric*>(m_cue)->useDefaultPosition() && firstLineBox) {
        LayoutUnit parentWidth = containingBlock()->logicalWidth();
        LayoutUnit width = firstLineBox->width();
        LayoutUnit right = (parentWidth / 2) - (width / 2);
        setX(right);
    }
    repositionCueSnapToLinesNotSet();
}
예제 #3
0
void LayoutVTTCue::layout() {
  LayoutBlockFlow::layout();

  DCHECK(firstChild());

  LayoutState state(*this, locationOffset());

  // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13.
  if (!std::isnan(m_snapToLinesPosition))
    SnapToLinesLayouter(*this, computeControlsRect()).layout();
  else
    repositionCueSnapToLinesNotSet();
}
예제 #4
0
void RenderTextTrackCue::layout()
{
    StackStats::LayoutCheckPoint layoutCheckPoint;
    RenderBlock::layout();

    LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());
    
    if (m_cue->cueType()== TextTrackCue::WebVTT) {
        if (m_cue->snapToLines())
            repositionCueSnapToLinesSet();
        else
            repositionCueSnapToLinesNotSet();
    } else
        repositionGenericCue();

    statePusher.pop();
}
예제 #5
0
void RenderVTTCue::layout()
{
    LayoutRectRecorder recorder(*this);
    RenderBlockFlow::layout();

    // If WebVTT Regions are used, the regular WebVTT layout algorithm is no
    // longer necessary, since cues having the region parameter set do not have
    // any positioning parameters. Also, in this case, the regions themselves
    // have positioning information.
    if (!m_cue->regionId().isEmpty())
        return;

    LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransform() || hasReflection() || style()->isFlippedBlocksWritingMode());

    if (m_cue->snapToLines())
        repositionCueSnapToLinesSet();
    else
        repositionCueSnapToLinesNotSet();

    statePusher.pop();
}
예제 #6
0
void LayoutVTTCue::layout()
{
    LayoutBlockFlow::layout();

    // If WebVTT Regions are used, the regular WebVTT layout algorithm is no
    // longer necessary, since cues having the region parameter set do not have
    // any positioning parameters. Also, in this case, the regions themselves
    // have positioning information.
    if (!m_cue->regionId().isEmpty())
        return;

    ASSERT(firstChild());

    LayoutState state(*this, locationOffset());

    // Determine the area covered by the media controls, if any. If the controls
    // are present, they are the next sibling of the text track container, which
    // is our parent. (LayoutMedia ensures that the media controls are laid out
    // before text tracks, so that the layout is up-to-date here.)
    ASSERT(parent()->node()->isTextTrackContainer());
    IntRect controlsRect;
    if (LayoutObject* parentSibling = parent()->nextSibling()) {
        // Only a part of the media controls is used for overlap avoidance.
        MediaControls* controls = toMediaControls(parentSibling->node());
        if (LayoutObject* controlsLayout = controls->layoutObjectForTextTrackLayout())
            controlsRect = controlsLayout->absoluteBoundingBoxRect();
    }

    // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13.
    if (m_cue->snapToLines()) {
        SnapToLinesLayouter(*this, controlsRect, m_cue->calculateComputedLinePosition()).layout();

        adjustForTopAndBottomMarginBorderAndPadding();
    } else {
        repositionCueSnapToLinesNotSet();
    }
}