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(); }
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(); } }