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

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

Issue 1018593004: Implement <video controls> dodging for text track layout (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: braces 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
« no previous file with comments | « Source/core/html/track/TextTrackContainer.cpp ('k') | Source/core/layout/LayoutVTTCue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutMedia.cpp
diff --git a/Source/core/layout/LayoutMedia.cpp b/Source/core/layout/LayoutMedia.cpp
index 905cee26c646822ed0b51f24b53b81e70532a937..54401ef2878c5524302bb834580d64c2d41b3047 100644
--- a/Source/core/layout/LayoutMedia.cpp
+++ b/Source/core/layout/LayoutMedia.cpp
@@ -57,8 +57,22 @@ void LayoutMedia::layout()
LayoutState state(*this, locationOffset());
- for (LayoutObject* child = m_children.firstChild(); child; child = child->nextSibling()) {
- ASSERT(child->node()->isMediaControls() || child->node()->isTextTrackContainer());
+ // Iterate the children in reverse order so that the media controls are laid
+ // out before the text track container. This is to ensure that the text
+ // track rendering has an up-to-date position of the media controls for
+ // overlap checking, see LayoutVTTCue.
+#if ENABLE(ASSERT)
+ bool seenTextTrackContainer = false;
+#endif
+ for (LayoutObject* child = m_children.lastChild(); child; child = child->previousSibling()) {
+#if ENABLE(ASSERT)
+ if (child->node()->isMediaControls())
+ ASSERT(!seenTextTrackContainer);
+ else if (child->node()->isTextTrackContainer())
+ seenTextTrackContainer = true;
+ else
+ ASSERT_NOT_REACHED();
+#endif
if (newSize == oldSize && !child->needsLayout())
continue;
« no previous file with comments | « Source/core/html/track/TextTrackContainer.cpp ('k') | Source/core/layout/LayoutVTTCue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698