Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
index 5ae1bf111926b3e06c1b2177035ac8772c686334..c5084915b9490eb8992e6a2e24f81cdc611b44b4 100644 |
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
@@ -260,13 +260,6 @@ void MediaControls::reset() |
m_fullScreenButton->setIsWanted(shouldShowFullscreenButton(mediaElement())); |
refreshCastButtonVisibilityWithoutUpdate(); |
- |
- // Set the panel width here, and force a layout, before the controls update. |
- // This would be harmless for the !useNewUi case too, but it causes |
- // compositing/geometry/video-fixed-scrolling.html to fail with two extra |
- // 0 height nodes in the render tree. |
- if (useNewUi) |
- m_panelWidth = m_panel->clientWidth(); |
} |
LayoutObject* MediaControls::layoutObjectForTextTrackLayout() |
@@ -652,9 +645,6 @@ void MediaControls::computeWhichControlsFit() |
if (!RuntimeEnabledFeatures::newMediaPlaybackUiEnabled()) |
return; |
- if (!m_panelWidth) |
- return; |
- |
// Controls that we'll hide / show, in order of decreasing priority. |
MediaControlElement* elements[] = { |
m_playButton.get(), |
@@ -668,6 +658,18 @@ void MediaControls::computeWhichControlsFit() |
m_durationDisplay.get(), |
}; |
+ if (!m_panelWidth) { |
+ // No layout yet -- hide everything, then make them show up later. |
+ // This prevents the wrong controls from being shown briefly |
+ // immediately after the first layout and paint, but before we have |
+ // a chance to revise them. |
+ for (MediaControlElement* element : elements) { |
+ if (element) |
+ element->setDoesFit(false); |
+ } |
+ return; |
+ } |
+ |
int usedWidth = 0; |
bool droppedCastButton = false; |
// Assume that all controls require 48px. Ideally, we could get this |