Commit 14324a40 authored by fs@opera.com's avatar fs@opera.com

Drop LayoutVTTCue::adjustForTopAndBottomMarginBorderAndPadding

This method only serves to break the cue layout computed by
SnapToLinesLayouter. If we want to factor in margin+border for cues (and
padding for the cue container), then factor that into the cue layout
algorithm instead.

BUG=301580

Review URL: https://codereview.chromium.org/1314613002

git-svn-id: svn://svn.chromium.org/blink/trunk@201119 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent cc49a696
...@@ -273,30 +273,6 @@ void LayoutVTTCue::repositionCueSnapToLinesNotSet() ...@@ -273,30 +273,6 @@ void LayoutVTTCue::repositionCueSnapToLinesNotSet()
// boxes will unfortunately overlap.) // boxes will unfortunately overlap.)
} }
void LayoutVTTCue::adjustForTopAndBottomMarginBorderAndPadding()
{
// Accommodate extra top and bottom padding, border or margin.
// Note: this is supported only for internal UA styling, not through the cue selector.
if (!hasInlineDirectionBordersPaddingOrMargin())
return;
IntRect containerRect = containingBlock()->absoluteBoundingBoxRect();
IntRect cueRect = absoluteBoundingBoxRect();
int topOverflow = cueRect.y() - containerRect.y();
int bottomOverflow = containerRect.y() + containerRect.height() - cueRect.y() - cueRect.height();
int adjustment = 0;
if (topOverflow < 0)
adjustment = -topOverflow;
else if (bottomOverflow < 0)
adjustment = bottomOverflow;
if (!adjustment)
return;
setY(location().y() + adjustment);
}
void LayoutVTTCue::layout() void LayoutVTTCue::layout()
{ {
LayoutBlockFlow::layout(); LayoutBlockFlow::layout();
...@@ -319,13 +295,10 @@ void LayoutVTTCue::layout() ...@@ -319,13 +295,10 @@ void LayoutVTTCue::layout()
} }
// http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13. // http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13.
if (!std::isnan(m_snapToLinesPosition)) { if (!std::isnan(m_snapToLinesPosition))
SnapToLinesLayouter(*this, controlsRect).layout(); SnapToLinesLayouter(*this, controlsRect).layout();
else
adjustForTopAndBottomMarginBorderAndPadding();
} else {
repositionCueSnapToLinesNotSet(); repositionCueSnapToLinesNotSet();
}
} }
} // namespace blink } // namespace blink
...@@ -44,7 +44,6 @@ public: ...@@ -44,7 +44,6 @@ public:
private: private:
void layout() override; void layout() override;
void adjustForTopAndBottomMarginBorderAndPadding();
void repositionCueSnapToLinesNotSet(); void repositionCueSnapToLinesNotSet();
float m_snapToLinesPosition; float m_snapToLinesPosition;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment