Source/WebCore: Source/WebCore: Mac: Media Controls always hide time display elements
[WebKit-https.git] / Source / WebCore / html / shadow / MediaControlElements.cpp
index 7387ea0..2110d04 100644 (file)
@@ -67,6 +67,9 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
+static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoId();
+static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseudoId();
+
 #if ENABLE(VIDEO_TRACK)
 static const char* textTracksOffAttrValue = "-1"; // This must match HTMLMediaElement::textTracksOffIndex()
 #endif
@@ -318,6 +321,30 @@ const AtomicString& MediaControlTimelineContainerElement::shadowPseudoId() const
     return id;
 }
 
+void MediaControlTimelineContainerElement::setTimeDisplaysHidden(bool hidden)
+{
+    for (unsigned i = 0; i < childNodeCount(); ++i) {
+        Node* child = childNode(i);
+        if (!child || !child->isElementNode())
+            continue;
+        Element* element = static_cast<Element*>(child);
+        if (element->shadowPseudoId() != getMediaControlTimeRemainingDisplayElementShadowPseudoId()
+            && element->shadowPseudoId() != getMediaControlCurrentTimeDisplayElementShadowPseudoId())
+            continue;
+
+        MediaControlTimeDisplayElement* timeDisplay = static_cast<MediaControlTimeDisplayElement*>(element);
+        if (hidden)
+            timeDisplay->hide();
+        else
+            timeDisplay->show();
+    }
+}
+
+RenderObject* MediaControlTimelineContainerElement::createRenderer(RenderArena* arena, RenderStyle*)
+{
+    return new (arena) RenderMediaControlTimelineContainer(this);
+}
+
 // ----------------------------
 
 MediaControlVolumeSliderContainerElement::MediaControlVolumeSliderContainerElement(Document* document)
@@ -1141,12 +1168,17 @@ PassRefPtr<MediaControlTimeRemainingDisplayElement> MediaControlTimeRemainingDis
     return adoptRef(new MediaControlTimeRemainingDisplayElement(document));
 }
 
-const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() const
+static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseudoId()
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-time-remaining-display", AtomicString::ConstructFromLiteral));
     return id;
 }
 
+const AtomicString& MediaControlTimeRemainingDisplayElement::shadowPseudoId() const
+{
+    return getMediaControlTimeRemainingDisplayElementShadowPseudoId();
+}
+
 // ----------------------------
 
 MediaControlCurrentTimeDisplayElement::MediaControlCurrentTimeDisplayElement(Document* document)
@@ -1159,12 +1191,17 @@ PassRefPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurrentTimeDisplay
     return adoptRef(new MediaControlCurrentTimeDisplayElement(document));
 }
 
-const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() const
+static const AtomicString& getMediaControlCurrentTimeDisplayElementShadowPseudoId()
 {
     DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-current-time-display", AtomicString::ConstructFromLiteral));
     return id;
 }
 
+const AtomicString& MediaControlCurrentTimeDisplayElement::shadowPseudoId() const
+{
+    return getMediaControlCurrentTimeDisplayElementShadowPseudoId();
+}
+
 // ----------------------------
 
 #if ENABLE(VIDEO_TRACK)