| 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 ad9607accff4eecd9e1c52ca347c46f62c5da3fd..ce548e6fb81533cb98e640b01ebc93480a4c7559 100644
|
| --- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
|
| +++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
|
| @@ -822,28 +822,10 @@ void MediaControls::computeWhichControlsFit() {
|
| m_durationDisplay.get(),
|
| };
|
|
|
| - int usedWidth = 0;
|
| -
|
| // TODO(mlamouri): we need a more dynamic way to find out the width of an
|
| // element.
|
| const int sliderMargin = 36; // Sliders have 18px margin on each side.
|
|
|
| - // Assume that all controls require 48px, unless we can get the computed
|
| - // style for the play button. Since the play button or overflow is always
|
| - // shown, one of the two buttons 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 = 48;
|
| - if (m_playButton->layoutObject() && m_playButton->layoutObject()->style()) {
|
| - const ComputedStyle* style = m_playButton->layoutObject()->style();
|
| - minimumWidth = ceil(style->width().pixels() / style->effectiveZoom());
|
| - } else if (m_overflowMenu->layoutObject() &&
|
| - m_overflowMenu->layoutObject()->style()) {
|
| - const ComputedStyle* style = m_overflowMenu->layoutObject()->style();
|
| - minimumWidth = ceil(style->width().pixels() / style->effectiveZoom());
|
| - }
|
| -
|
| if (!m_panelWidth) {
|
| // No layout yet -- hide everything, then make them show up later.
|
| // This prevents the wrong controls from being shown briefly
|
| @@ -856,12 +838,27 @@ void MediaControls::computeWhichControlsFit() {
|
| return;
|
| }
|
|
|
| + // Assume that all controls require 48px, unless we can get the computed
|
| + // style for a button. The minimumWidth is recorded and re-use for future
|
| + // MediaControls instances and future calls to this method given that at the
|
| + // moment the controls button width is per plataform.
|
| + // TODO(mlamouri): improve the mechanism without bandaid.
|
| + static int minimumWidth = 48;
|
| + if (m_playButton->layoutObject() && m_playButton->layoutObject()->style()) {
|
| + const ComputedStyle* style = m_playButton->layoutObject()->style();
|
| + minimumWidth = ceil(style->width().pixels() / style->effectiveZoom());
|
| + } else if (m_overflowMenu->layoutObject() &&
|
| + m_overflowMenu->layoutObject()->style()) {
|
| + const ComputedStyle* style = m_overflowMenu->layoutObject()->style();
|
| + minimumWidth = ceil(style->width().pixels() / style->effectiveZoom());
|
| + }
|
| +
|
| // Insert an overflow menu. However, if we see that the overflow menu
|
| // doesn't end up containing at least two elements, we will not display it
|
| // but instead make place for the first element that was dropped.
|
| m_overflowMenu->setDoesFit(true);
|
| m_overflowMenu->setIsWanted(true);
|
| - usedWidth = minimumWidth;
|
| + int usedWidth = minimumWidth;
|
|
|
| std::list<MediaControlElement*> overflowElements;
|
| MediaControlElement* firstDisplacedElement = nullptr;
|
|
|