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

Unified Diff: Source/core/html/shadow/MediaControlElementTypes.cpp

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor decrufting. Created 5 years, 5 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/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)

Powered by Google App Engine
This is Rietveld 408576698