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

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: ready for review 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/LayoutMedia.cpp
diff --git a/Source/core/layout/LayoutMedia.cpp b/Source/core/layout/LayoutMedia.cpp
index 8b960ab7c012b658458db01c46fe972445023594..338323088ffa13d6a77fd3fca908d3b7cf6ec623 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;
philipj_slow 2015/03/20 05:58:19 What do you think, way overkill? If you prefer I c
fs 2015/03/20 09:58:54 I don't mind that much, but it does give the impre
philipj_slow 2015/03/20 16:46:33 Yeah, it's ugly alright. I've tinkered a bit on a
+#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;

Powered by Google App Engine
This is Rietveld 408576698