Index: Source/core/html/shadow/MediaControlElementTypes.cpp |
diff --git a/Source/core/html/shadow/MediaControlElementTypes.cpp b/Source/core/html/shadow/MediaControlElementTypes.cpp |
index 70d738556f731e1bee57b58bf0f4ca9d2a611bc1..662d1be2bdeb33210e7c11b35052fb7185716d8d 100644 |
--- a/Source/core/html/shadow/MediaControlElementTypes.cpp |
+++ b/Source/core/html/shadow/MediaControlElementTypes.cpp |
@@ -71,6 +71,8 @@ MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont |
: m_mediaControls(mediaControls) |
, m_displayType(displayType) |
, m_element(element) |
+ , m_isWanted(true) |
+ , m_doesFit(true) |
{ |
} |
@@ -79,14 +81,40 @@ HTMLMediaElement& MediaControlElement::mediaElement() const |
return mediaControls().mediaElement(); |
} |
-void MediaControlElement::hide() |
+void MediaControlElement::updateShownState() |
{ |
- m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
+ if (m_isWanted && m_doesFit) |
+ m_element->removeInlineStyleProperty(CSSPropertyDisplay); |
+ else |
+ m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
} |
-void MediaControlElement::show() |
+void MediaControlElement::setDoesFit(bool fits) |
{ |
- m_element->removeInlineStyleProperty(CSSPropertyDisplay); |
+ m_doesFit = fits; |
+ updateShownState(); |
+} |
+ |
+void MediaControlElement::setIsWanted(bool wanted) |
+{ |
+ m_isWanted = wanted; |
+ updateShownState(); |
+} |
+ |
+bool MediaControlElement::isWanted() |
+{ |
+ return m_isWanted; |
+} |
+ |
+int MediaControlElement::minimumWidth() |
+{ |
+ // We could check the computed style here, but that depends on whether |
+ // we've been shown. Instead, we just assume 48 except for the |
+ // timeline bar. |
+ if (m_displayType == MediaSlider) |
+ return 55; |
+ |
+ return 48; |
} |
void MediaControlElement::setDisplayType(MediaControlElementType displayType) |