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

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

Issue 949203002: Separate the text track container from the media controls (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: same size as media controls Created 5 years, 10 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 67702a12b9747973a211a4802eb9f49ab2b8ecab..65e2c3b2c68b7386f76239bec08aa6fd4990c15d 100644
--- a/Source/core/layout/LayoutMedia.cpp
+++ b/Source/core/layout/LayoutMedia.cpp
@@ -53,32 +53,47 @@ void LayoutMedia::layout()
LayoutImage::layout();
- LayoutBox* controlsRenderer = toLayoutBox(m_children.firstChild());
- if (!controlsRenderer)
- return;
-
- bool controlsNeedLayout = controlsRenderer->needsLayout();
LayoutSize newSize = contentBoxRect().size();
- if (newSize == oldSize && !controlsNeedLayout)
- return;
LayoutState state(*this, locationOffset());
- controlsRenderer->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
- controlsRenderer->style()->setHeight(Length(newSize.height(), Fixed));
- controlsRenderer->style()->setWidth(Length(newSize.width(), Fixed));
- controlsRenderer->forceLayout();
+ for (LayoutObject* child = m_children.firstChild(); child; child = child->nextSibling()) {
philipj_slow 2015/02/26 09:51:52 Rune, does this make any sense? I couldn't find an
fs 2015/02/26 12:30:51 I believe RenderBlockFlow uses a while-loop (see R
rune 2015/02/26 13:17:15 I'm not too familiar with layout, but this looks l
philipj_slow 2015/02/27 07:13:52 Yeah, I'll leave this alone if it's not too terrib
+ ASSERT(child->node()->isMediaControls() || child->node()->isTextTrackContainer());
+
+ if (newSize == oldSize && !child->needsLayout())
+ continue;
+
+ LayoutBox* layoutBox = toLayoutBox(child);
+ layoutBox->setLocation(LayoutPoint(borderLeft(), borderTop()) + LayoutSize(paddingLeft(), paddingTop()));
philipj_slow 2015/02/26 09:51:52 Not sure if this could be done with width/height:
+ layoutBox->style()->setHeight(Length(newSize.height(), Fixed));
+ layoutBox->style()->setWidth(Length(newSize.width(), Fixed));
+ layoutBox->forceLayout();
+ }
+
clearNeedsLayout();
}
bool LayoutMedia::isChildAllowed(LayoutObject* child, const LayoutStyle&) const
{
- // The only allowed child is the media controls. The user agent stylesheet
- // (mediaControls.css) has ::-webkit-media-controls { display: flex; }. If
- // author style sets display: inline we would get an inline renderer as a
- // child of replaced content, which is not supposed to be possible. This
- // check can be removed if ::-webkit-media-controls is made internal.
- return child->isFlexibleBox();
+ // Two types of child layout objects are allowed: media controls
+ // and the text track container.
+
+ // The user agent stylesheet (mediaControls.css) has
+ // ::-webkit-media-controls { display: flex; }. If author style
+ // sets display: inline we would get an inline renderer as a child
+ // of replaced content, which is not supposed to be possible. This
+ // check can be removed if ::-webkit-media-controls is made
+ // internal.
+ if (child->node()->isMediaControls())
fs 2015/02/26 12:30:51 Maybe assert child->node() here (in this method) a
philipj_slow 2015/02/27 07:13:52 Done.
+ return child->isFlexibleBox();
+
+ // The text track container should only be added for video elements.
+ if (child->node()->isTextTrackContainer()) {
+ ASSERT(isVideo());
+ return true;
+ }
+
+ return false;
}
void LayoutMedia::paintReplaced(const PaintInfo&, const LayoutPoint&)

Powered by Google App Engine
This is Rietveld 408576698