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; |