Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(979)

Unified Diff: Source/core/layout/LayoutVTTCue.cpp

Issue 1018593004: Implement <video controls> dodging for text track layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/layout/LayoutVTTCue.cpp
diff --git a/Source/core/layout/LayoutVTTCue.cpp b/Source/core/layout/LayoutVTTCue.cpp
index cd3007f1284658ad94209a1cd09278e134fb67c5..4f4440d98670fd5b02869f82f2ba24c068b3401a 100644
--- a/Source/core/layout/LayoutVTTCue.cpp
+++ b/Source/core/layout/LayoutVTTCue.cpp
@@ -29,6 +29,7 @@
#include "core/html/track/vtt/VTTCue.h"
#include "core/layout/LayoutInline.h"
#include "core/layout/LayoutState.h"
+#include "core/layout/LayoutTextTrackContainer.h"
namespace blink {
@@ -41,8 +42,9 @@ LayoutVTTCue::LayoutVTTCue(VTTCueBox* element)
class SnapToLinesLayouter {
STACK_ALLOCATED();
public:
- SnapToLinesLayouter(LayoutVTTCue& cueBox, float linePosition)
+ SnapToLinesLayouter(LayoutVTTCue& cueBox, IntRect& controlsRect, float linePosition)
: m_cueBox(cueBox)
+ , m_controlsRect(controlsRect)
, m_linePosition(linePosition)
{
}
@@ -64,6 +66,7 @@ private:
LayoutPoint m_specifiedPosition;
LayoutVTTCue& m_cueBox;
+ IntRect m_controlsRect;
float m_linePosition;
};
@@ -116,13 +119,19 @@ bool SnapToLinesLayouter::isOutside() const
bool SnapToLinesLayouter::isOverlapping() const
{
+ IntRect cueBoxRect = m_cueBox.absoluteBoundingBoxRect();
for (LayoutObject* box = m_cueBox.previousSibling(); box; box = box->previousSibling()) {
IntRect boxRect = box->absoluteBoundingBoxRect();
- if (m_cueBox.absoluteBoundingBoxRect().intersects(boxRect))
+ if (cueBoxRect.intersects(boxRect))
return true;
}
+ ASSERT(!m_cueBox.nextSibling());
+
+ if (cueBoxRect.intersects(m_controlsRect))
+ return true;
+
return false;
}
@@ -317,9 +326,12 @@ void LayoutVTTCue::layout()
LayoutState state(*this, locationOffset());
+ ASSERT(parent()->node()->isTextTrackContainer());
+ IntRect controlsRect = static_cast<LayoutTextTrackContainer*>(parent())->controlsRect();
+
// http://dev.w3.org/html5/webvtt/#dfn-apply-webvtt-cue-settings - step 13.
if (m_cue->snapToLines()) {
- SnapToLinesLayouter(*this, m_cue->calculateComputedLinePosition()).layout();
+ SnapToLinesLayouter(*this, controlsRect, m_cue->calculateComputedLinePosition()).layout();
adjustForTopAndBottomMarginBorderAndPadding();
} else {
« Source/core/layout/LayoutMedia.cpp ('K') | « Source/core/layout/LayoutTextTrackContainer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698