Chromium Code Reviews| 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 568905c509b7110df20314018f78ecb3bfa8a5af..bd01684b9e7b3a25cc55737b637c746260cddc4e 100644 |
| --- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
| +++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp |
| @@ -701,9 +701,15 @@ void MediaControls::computeWhichControlsFit() |
| int usedWidth = 0; |
| bool droppedCastButton = false; |
| - // Assume that all controls require 48px. Ideally, we could get this from |
| - // the computed style, but that requires the controls to be shown. |
| - const int minimumWidth = 48; |
| + |
| + // Assume that all controls require 48px, unless we can get the computed |
| + // style for the play button. Since the play button is always shown, it |
| + // should be available the first time we're called after layout. This will |
| + // also be the first time we have m_panelWidth!=0, so it won't matter if |
| + // we get this wrong before that. |
| + int minimumWidth = (m_playButton->layoutObject() && m_playButton->layoutObject()->style()) |
| + ? m_playButton->layoutObject()->style()->width().pixels() |
| + : 48; |
|
mlamouri (slow - plz ping)
2016/05/09 12:41:39
`minimumWidth` is being used by all elements in `e
|
| // Special-case the play button; it always fits. |
| if (m_playButton->isWanted()) { |