2011-01-26 Dimitri Glazkov <dglazkov@chromium.org>
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jan 2011 22:54:36 +0000 (22:54 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Jan 2011 22:54:36 +0000 (22:54 +0000)
        Unreviewed, rolling out r76719.
        http://trac.webkit.org/changeset/76719
        https://bugs.webkit.org/show_bug.cgi?id=53122

        Broke a bunch of media tests in Chromium/Qt/GTK.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76724 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/css/CSSSelector.cpp
Source/WebCore/css/CSSSelector.h
Source/WebCore/css/mediaControls.css
Source/WebCore/rendering/MediaControlElements.cpp
Source/WebCore/rendering/MediaControlElements.h
Source/WebCore/rendering/RenderMedia.cpp
Source/WebCore/rendering/style/RenderStyleConstants.h

index fbffa8b..f6d64a9 100644 (file)
@@ -1,3 +1,11 @@
+2011-01-26  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Unreviewed, rolling out r76719.
+        http://trac.webkit.org/changeset/76719
+        https://bugs.webkit.org/show_bug.cgi?id=53122
+
+        Broke a bunch of media tests in Chromium/Qt/GTK.
+
 2011-01-26  Tony Chang  <tony@chromium.org>
 
         Reviewed by Ryosuke Niwa.
index 1be7f36..8ff3859 100644 (file)
@@ -140,6 +140,10 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
         return SEARCH_RESULTS_BUTTON;
     case PseudoMediaControlsPanel:
         return MEDIA_CONTROLS_PANEL;
+    case PseudoMediaControlsMuteButton:
+        return MEDIA_CONTROLS_MUTE_BUTTON;
+    case PseudoMediaControlsPlayButton:
+        return MEDIA_CONTROLS_PLAY_BUTTON;
     case PseudoMediaControlsTimelineContainer:
         return MEDIA_CONTROLS_TIMELINE_CONTAINER;
     case PseudoMediaControlsVolumeSliderContainer:
@@ -148,8 +152,26 @@ PseudoId CSSSelector::pseudoId(PseudoType type)
         return MEDIA_CONTROLS_CURRENT_TIME_DISPLAY;
     case PseudoMediaControlsTimeRemainingDisplay:
         return MEDIA_CONTROLS_TIME_REMAINING_DISPLAY;
+    case PseudoMediaControlsTimeline:
+        return MEDIA_CONTROLS_TIMELINE;
+    case PseudoMediaControlsVolumeSlider:
+        return MEDIA_CONTROLS_VOLUME_SLIDER;
+    case PseudoMediaControlsVolumeSliderMuteButton:
+        return MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON;
+    case PseudoMediaControlsSeekBackButton:
+        return MEDIA_CONTROLS_SEEK_BACK_BUTTON;
+    case PseudoMediaControlsSeekForwardButton:
+        return MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
+    case PseudoMediaControlsRewindButton:
+        return MEDIA_CONTROLS_REWIND_BUTTON;
+    case PseudoMediaControlsReturnToRealtimeButton:
+        return MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON;
+    case PseudoMediaControlsToggleClosedCaptions:
+        return MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON;
     case PseudoMediaControlsStatusDisplay:
         return MEDIA_CONTROLS_STATUS_DISPLAY;
+    case PseudoMediaControlsFullscreenButton:
+        return MEDIA_CONTROLS_FULLSCREEN_BUTTON;
     case PseudoScrollbar:
         return SCROLLBAR;
     case PseudoScrollbarButton:
@@ -325,7 +347,18 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
     DEFINE_STATIC_LOCAL(AtomicString, link, ("link"));
     DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang("));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPanel, ("-webkit-media-controls-panel"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsMuteButton, ("-webkit-media-controls-mute-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPlayButton, ("-webkit-media-controls-play-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeline, ("-webkit-media-controls-timeline"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSlider, ("-webkit-media-controls-volume-slider"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSliderMuteButton, ("-webkit-media-controls-volume-slider-mute-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekBackButton, ("-webkit-media-controls-seek-back-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsRewindButton, ("-webkit-media-controls-rewind-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsReturnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsToggleClosedCaptionsButton, ("-webkit-media-controls-toggle-closed-captions-button"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsStatusDisplay, ("-webkit-media-controls-status-display"));
+    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSliderContainer, ("-webkit-media-controls-volume-slider-container"));
     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsCurrentTimeDisplay, ("-webkit-media-controls-current-time-display"));
@@ -431,9 +464,20 @@ static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap(
         nameToPseudoType->set(link.impl(), CSSSelector::PseudoLink);
         nameToPseudoType->set(lang.impl(), CSSSelector::PseudoLang);
         nameToPseudoType->set(mediaControlsPanel.impl(), CSSSelector::PseudoMediaControlsPanel);
+        nameToPseudoType->set(mediaControlsMuteButton.impl(), CSSSelector::PseudoMediaControlsMuteButton);
+        nameToPseudoType->set(mediaControlsPlayButton.impl(), CSSSelector::PseudoMediaControlsPlayButton);
         nameToPseudoType->set(mediaControlsCurrentTimeDisplay.impl(), CSSSelector::PseudoMediaControlsCurrentTimeDisplay);
         nameToPseudoType->set(mediaControlsTimeRemainingDisplay.impl(), CSSSelector::PseudoMediaControlsTimeRemainingDisplay);
+        nameToPseudoType->set(mediaControlsTimeline.impl(), CSSSelector::PseudoMediaControlsTimeline);
+        nameToPseudoType->set(mediaControlsVolumeSlider.impl(), CSSSelector::PseudoMediaControlsVolumeSlider);
+        nameToPseudoType->set(mediaControlsVolumeSliderMuteButton.impl(), CSSSelector::PseudoMediaControlsVolumeSliderMuteButton);
+        nameToPseudoType->set(mediaControlsSeekBackButton.impl(), CSSSelector::PseudoMediaControlsSeekBackButton);
+        nameToPseudoType->set(mediaControlsSeekForwardButton.impl(), CSSSelector::PseudoMediaControlsSeekForwardButton);
+        nameToPseudoType->set(mediaControlsRewindButton.impl(), CSSSelector::PseudoMediaControlsRewindButton);
+        nameToPseudoType->set(mediaControlsReturnToRealtimeButton.impl(), CSSSelector::PseudoMediaControlsReturnToRealtimeButton);
+        nameToPseudoType->set(mediaControlsToggleClosedCaptionsButton.impl(), CSSSelector::PseudoMediaControlsToggleClosedCaptions);
         nameToPseudoType->set(mediaControlsStatusDisplay.impl(), CSSSelector::PseudoMediaControlsStatusDisplay);
+        nameToPseudoType->set(mediaControlsFullscreenButton.impl(), CSSSelector::PseudoMediaControlsFullscreenButton);
         nameToPseudoType->set(mediaControlsTimelineContainer.impl(), CSSSelector::PseudoMediaControlsTimelineContainer);
         nameToPseudoType->set(mediaControlsVolumeSliderContainer.impl(), CSSSelector::PseudoMediaControlsVolumeSliderContainer);
         nameToPseudoType->set(notStr.impl(), CSSSelector::PseudoNot);
@@ -530,9 +574,20 @@ void CSSSelector::extractPseudoType() const
 #endif
     case PseudoInnerSpinButton:
     case PseudoMediaControlsPanel:
+    case PseudoMediaControlsMuteButton:
+    case PseudoMediaControlsPlayButton:
     case PseudoMediaControlsCurrentTimeDisplay:
     case PseudoMediaControlsTimeRemainingDisplay:
+    case PseudoMediaControlsTimeline:
+    case PseudoMediaControlsVolumeSlider:
+    case PseudoMediaControlsVolumeSliderMuteButton:
+    case PseudoMediaControlsSeekBackButton:
+    case PseudoMediaControlsSeekForwardButton:
+    case PseudoMediaControlsRewindButton:
+    case PseudoMediaControlsReturnToRealtimeButton:
+    case PseudoMediaControlsToggleClosedCaptions:
     case PseudoMediaControlsStatusDisplay:
+    case PseudoMediaControlsFullscreenButton:
     case PseudoMediaControlsTimelineContainer:
     case PseudoMediaControlsVolumeSliderContainer:
     case PseudoMeterHorizontalBar:
index cbe3e9b..66c94f3 100644 (file)
@@ -176,11 +176,22 @@ namespace WebCore {
             PseudoSearchResultsDecoration,
             PseudoSearchResultsButton,
             PseudoMediaControlsPanel,
+            PseudoMediaControlsMuteButton,
+            PseudoMediaControlsPlayButton,
             PseudoMediaControlsTimelineContainer,
             PseudoMediaControlsVolumeSliderContainer,
+            PseudoMediaControlsVolumeSliderMuteButton,
             PseudoMediaControlsCurrentTimeDisplay,
             PseudoMediaControlsTimeRemainingDisplay,
+            PseudoMediaControlsToggleClosedCaptions,
+            PseudoMediaControlsTimeline,
+            PseudoMediaControlsVolumeSlider,
+            PseudoMediaControlsSeekBackButton,
+            PseudoMediaControlsSeekForwardButton,
+            PseudoMediaControlsRewindButton,
+            PseudoMediaControlsReturnToRealtimeButton,
             PseudoMediaControlsStatusDisplay,
+            PseudoMediaControlsFullscreenButton,
             PseudoMeterHorizontalBar,
             PseudoMeterVerticalBar,
             PseudoMeterHorizontalOptimum,
index 88144b4..6a0f14b 100644 (file)
@@ -52,9 +52,6 @@ audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-bu
     display: -webkit-box;
     width: 16px;
     height: 16px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-button {
@@ -62,9 +59,6 @@ audio::-webkit-media-controls-play-button, video::-webkit-media-controls-play-bu
     display: -webkit-box;
     width: 16px;
     height: 16px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-timeline-container, video::-webkit-media-controls-timeline-container {
@@ -92,10 +86,6 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
     -webkit-box-flex: 1;
     height: 16px;
     padding: 0px 2px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
-    margin: initial;
 }
 
 audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container {
@@ -104,10 +94,6 @@ audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-cont
 
 audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
     display: none;
-    background-color: initial;
-    border: initial;
-    color: inherit;
-    margin: initial;
 }
 
 audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-seek-back-button {
@@ -115,9 +101,6 @@ audio::-webkit-media-controls-seek-back-button, video::-webkit-media-controls-se
     display: -webkit-box;
     width: 16px;
     height: 16px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls-seek-forward-button {
@@ -125,9 +108,6 @@ audio::-webkit-media-controls-seek-forward-button, video::-webkit-media-controls
     display: -webkit-box;
     width: 16px;
     height: 16px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-fullscreen-button {
@@ -135,23 +115,14 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f
     display: -webkit-box;
     width: 16px;
     height: 16px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button {
     display: none;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button {
     display: none;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-media-controls-toggle-closed-captions-button {
@@ -159,15 +130,9 @@ audio::-webkit-media-controls-toggle-closed-captions-button, video::-webkit-medi
     display: -webkit-box;
     width: 16px;
     height: 16px;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
 
 audio::-webkit-media-controls-volume-slider-mute-button, video::-webkit-media-controls-volume-slider-mute-button {
     -webkit-appearance: media-volume-slider-mute-button;
     display: none;
-    background-color: initial;
-    border: initial;
-    color: inherit;
 }
index f011842..113ca3b 100644 (file)
@@ -32,7 +32,6 @@
 
 #include "MediaControlElements.h"
 
-#include "CSSStyleSelector.h"
 #include "EventNames.h"
 #include "FloatConversion.h"
 #include "Frame.h"
@@ -353,11 +352,51 @@ bool MediaControlStatusDisplayElement::rendererIsNeeded(RenderStyle* style)
 
 // ----------------------------
     
-MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
+MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo)
     : HTMLInputElement(inputTag, mediaElement->document(), 0, false)
     , m_mediaElement(mediaElement)
-    , m_displayType(displayType)
+    , m_pseudoStyleId(pseudo)
 {
+    setInDocument();
+
+    switch (pseudo) {
+    case MEDIA_CONTROLS_MUTE_BUTTON:
+        m_displayType = MediaMuteButton;
+        break;
+    case MEDIA_CONTROLS_PLAY_BUTTON:
+        m_displayType = MediaPlayButton;
+        break;
+    case MEDIA_CONTROLS_SEEK_FORWARD_BUTTON:
+        m_displayType = MediaSeekForwardButton;
+        break;
+    case MEDIA_CONTROLS_SEEK_BACK_BUTTON:
+        m_displayType = MediaSeekBackButton;
+        break;
+    case MEDIA_CONTROLS_FULLSCREEN_BUTTON:
+        m_displayType = MediaFullscreenButton;
+        break;
+    case MEDIA_CONTROLS_TIMELINE:
+        m_displayType = MediaSlider;
+        break;
+    case MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON:
+        m_displayType = MediaReturnToRealtimeButton;
+        break;
+    case MEDIA_CONTROLS_REWIND_BUTTON:
+        m_displayType = MediaRewindButton;
+        break;
+    case MEDIA_CONTROLS_VOLUME_SLIDER:
+        m_displayType = MediaVolumeSlider;
+        break;
+    case MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON:
+        m_displayType = MediaVolumeSliderMuteButton;
+        break;
+    case MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON:
+        m_displayType = MediaShowClosedCaptionsButton;
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+        break;
+    }
 }
 
 void MediaControlInputElement::attachToParent(Element* parent)
@@ -377,7 +416,7 @@ void MediaControlInputElement::update()
 
 PassRefPtr<RenderStyle> MediaControlInputElement::styleForElement()
 {
-    return document()->styleSelector()->styleForElement(this, 0, true);
+    return mediaElement()->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
 }
 
 bool MediaControlInputElement::rendererIsNeeded(RenderStyle* style)
@@ -442,7 +481,7 @@ void MediaControlInputElement::updateStyle()
     if (Node* shadowNode = shadowRoot())
         shadowNode->recalcStyle(Node::Force);
 }
-
+    
 bool MediaControlInputElement::hitTest(const IntPoint& absPoint)
 {
     if (renderer() && renderer()->style()->hasAppearance())
@@ -463,14 +502,14 @@ void MediaControlInputElement::setDisplayType(MediaControlElementType displayTyp
 
 // ----------------------------
 
-inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
-    : MediaControlInputElement(mediaElement, displayType)
+inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, ButtonLocation location)
+    : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON)
 {
 }
 
-PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement)
+PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement, ButtonLocation location)
 {
-    RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, MediaMuteButton));
+    RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, location));
     button->setType("button");
     return button.release();
 }
@@ -484,39 +523,15 @@ void MediaControlMuteButtonElement::defaultEventHandler(Event* event)
     HTMLInputElement::defaultEventHandler(event);
 }
 
-AtomicString MediaControlMuteButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, muteButton, ("-webkit-media-controls-mute-button"));
-    return muteButton;
-}
-
 void MediaControlMuteButtonElement::updateDisplayType()
 {
     setDisplayType(mediaElement()->muted() ? MediaUnMuteButton : MediaMuteButton);
 }
 
-inline MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlMuteButtonElement(mediaElement, MediaVolumeSliderMuteButton)
-{
-}
-
-PassRefPtr<MediaControlVolumeSliderMuteButtonElement> MediaControlVolumeSliderMuteButtonElement::create(HTMLMediaElement* mediaElement)
-{
-    RefPtr<MediaControlVolumeSliderMuteButtonElement> button = adoptRef(new MediaControlVolumeSliderMuteButtonElement(mediaElement));
-    button->setType("button");
-    return button.release();
-}
-
-AtomicString MediaControlVolumeSliderMuteButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, muteButton, ("-webkit-media-controls-volume-slider-mute-button"));
-    return muteButton;
-}
-
 // ----------------------------
 
 inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlInputElement(mediaElement, MediaPlayButton)
+    : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON)
 {
 }
 
@@ -541,22 +556,28 @@ void MediaControlPlayButtonElement::updateDisplayType()
     setDisplayType(mediaElement()->canPlay() ? MediaPlayButton : MediaPauseButton);
 }
 
-AtomicString MediaControlPlayButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, playButton, ("-webkit-media-controls-play-button"));
-    return playButton;
-}
-
 // ----------------------------
 
-inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
-    : MediaControlInputElement(mediaElement, displayType)
+inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, PseudoId pseudoId)
+    : MediaControlInputElement(mediaElement, pseudoId)
     , m_seeking(false)
     , m_capturing(false)
     , m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired)
 {
 }
 
+PassRefPtr<MediaControlSeekButtonElement> MediaControlSeekButtonElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId)
+{
+    RefPtr<MediaControlSeekButtonElement> button = adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId));
+    button->setType("button");
+    return button.release();
+}
+
+inline bool MediaControlSeekButtonElement::isForwardButton() const
+{
+    return pseudoStyleId() == MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
+}
+
 void MediaControlSeekButtonElement::defaultEventHandler(Event* event)
 {
     if (event->type() == eventNames().mousedownEvent) {
@@ -606,48 +627,8 @@ void MediaControlSeekButtonElement::detach()
 
 // ----------------------------
 
-inline MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlSeekButtonElement(mediaElement, MediaSeekForwardButton)
-{
-}
-
-PassRefPtr<MediaControlSeekForwardButtonElement> MediaControlSeekForwardButtonElement::create(HTMLMediaElement* mediaElement)
-{
-    RefPtr<MediaControlSeekForwardButtonElement> button = adoptRef(new MediaControlSeekForwardButtonElement(mediaElement));
-    button->setType("button");
-    return button.release();
-}
-
-AtomicString MediaControlSeekForwardButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, seekForwardButton, ("-webkit-media-controls-seek-forward-button"));
-    return seekForwardButton;
-}
-
-// ----------------------------
-
-inline MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlSeekButtonElement(mediaElement, MediaSeekBackButton)
-{
-}
-
-PassRefPtr<MediaControlSeekBackButtonElement> MediaControlSeekBackButtonElement::create(HTMLMediaElement* mediaElement)
-{
-    RefPtr<MediaControlSeekBackButtonElement> button = adoptRef(new MediaControlSeekBackButtonElement(mediaElement));
-    button->setType("button");
-    return button.release();
-}
-
-AtomicString MediaControlSeekBackButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, seekBackButton, ("-webkit-media-controls-seek-back-button"));
-    return seekBackButton;
-}
-
-// ----------------------------
-
 inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(HTMLMediaElement* element)
-    : MediaControlInputElement(element, MediaRewindButton)
+    : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON)
 {
 }
 
@@ -667,16 +648,10 @@ void MediaControlRewindButtonElement::defaultEventHandler(Event* event)
     HTMLInputElement::defaultEventHandler(event);
 }
 
-AtomicString MediaControlRewindButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, rewindButton, ("-webkit-media-controls-rewind-button"));
-    return rewindButton;
-}
-
 // ----------------------------
 
 inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlInputElement(mediaElement, MediaReturnToRealtimeButton)
+    : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON)
 {
 }
 
@@ -696,16 +671,11 @@ void MediaControlReturnToRealtimeButtonElement::defaultEventHandler(Event* event
     HTMLInputElement::defaultEventHandler(event);
 }
 
-AtomicString MediaControlReturnToRealtimeButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, returnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button"));
-    return returnToRealtimeButton;
-}
 
 // ----------------------------
 
 inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlInputElement(mediaElement, MediaShowClosedCaptionsButton)
+    : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON)
 {
 }
 
@@ -731,16 +701,10 @@ void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType()
     setDisplayType(mediaElement()->closedCaptionsVisible() ? MediaHideClosedCaptionsButton : MediaShowClosedCaptionsButton);
 }
 
-AtomicString MediaControlToggleClosedCaptionsButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, closedCaptionsButton, ("-webkit-media-controls-toggle-closed-captions-button"));
-    return closedCaptionsButton;
-}
-
 // ----------------------------
 
 MediaControlTimelineElement::MediaControlTimelineElement(HTMLMediaElement* mediaElement)
-    : MediaControlInputElement(mediaElement, MediaSlider)
+    : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE)
 {
 }
 
@@ -792,16 +756,10 @@ void MediaControlTimelineElement::update(bool updateDuration)
     MediaControlInputElement::update();
 }
 
-AtomicString MediaControlTimelineElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, timelineSlider, ("-webkit-media-controls-timeline"));
-    return timelineSlider;
-}
-
 // ----------------------------
 
 inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(HTMLMediaElement* mediaElement)
-    : MediaControlInputElement(mediaElement, MediaVolumeSlider)
+    : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER)
 {
 }
 
@@ -842,16 +800,10 @@ void MediaControlVolumeSliderElement::update()
     MediaControlInputElement::update();
 }
 
-AtomicString MediaControlVolumeSliderElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, volumeSlider, ("-webkit-media-controls-volume-slider"));
-    return volumeSlider;
-}
-
 // ----------------------------
 
 inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(HTMLMediaElement* mediaElement)
-    : MediaControlInputElement(mediaElement, MediaFullscreenButton)
+    : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON)
 {
 }
 
@@ -884,12 +836,6 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event)
     HTMLInputElement::defaultEventHandler(event);
 }
 
-AtomicString MediaControlFullscreenButtonElement::shadowPseudoId() const
-{
-    DEFINE_STATIC_LOCAL(AtomicString, fullscreenButton, ("-webkit-media-controls-fullscreen-button"));
-    return fullscreenButton;
-}
-
 // ----------------------------
 
 inline MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(HTMLMediaElement* mediaElement, PseudoId pseudo)
index 806150d..b2d063d 100644 (file)
@@ -174,10 +174,12 @@ public:
     HTMLMediaElement* mediaElement() const { return m_mediaElement; }
 
 protected:
-    MediaControlInputElement(HTMLMediaElement*, MediaControlElementType);
+    MediaControlInputElement(HTMLMediaElement*, PseudoId);
 
     void setDisplayType(MediaControlElementType);
 
+    PseudoId pseudoStyleId() const { return m_pseudoStyleId; }
+
 private:
     virtual void attach();
     virtual bool rendererIsNeeded(RenderStyle*);
@@ -188,7 +190,8 @@ private:
 
     virtual void updateDisplayType() { }
 
-    HTMLMediaElement* m_mediaElement;
+    HTMLMediaElement* m_mediaElement;   
+    PseudoId m_pseudoStyleId;
     MediaControlElementType m_displayType;
 };
 
@@ -196,31 +199,17 @@ private:
 
 class MediaControlMuteButtonElement : public MediaControlInputElement {
 public:
-    static PassRefPtr<MediaControlMuteButtonElement> create(HTMLMediaElement*);
+    enum ButtonLocation { Controller, VolumeSlider };
+    static PassRefPtr<MediaControlMuteButtonElement> create(HTMLMediaElement*, ButtonLocation);
 
     virtual void defaultEventHandler(Event*);
 
-protected:
-    MediaControlMuteButtonElement(HTMLMediaElement*, MediaControlElementType);
-
 private:
-    virtual void updateDisplayType();
-    virtual AtomicString shadowPseudoId() const;
-};
-
-// ----------------------------
-
-class MediaControlVolumeSliderMuteButtonElement : public MediaControlMuteButtonElement {
-public:
-    static PassRefPtr<MediaControlVolumeSliderMuteButtonElement> create(HTMLMediaElement*);
+    MediaControlMuteButtonElement(HTMLMediaElement*, ButtonLocation);
 
-private:
-    MediaControlVolumeSliderMuteButtonElement(HTMLMediaElement*);
-
-    virtual AtomicString shadowPseudoId() const;
+    virtual void updateDisplayType();
 };
 
-
 // ----------------------------
 
 class MediaControlPlayButtonElement : public MediaControlInputElement {
@@ -233,20 +222,20 @@ private:
     MediaControlPlayButtonElement(HTMLMediaElement*);
 
     virtual void updateDisplayType();
-    virtual AtomicString shadowPseudoId() const;
 };
 
 // ----------------------------
 
 class MediaControlSeekButtonElement : public MediaControlInputElement {
 public:
-    virtual void defaultEventHandler(Event*);
+    static PassRefPtr<MediaControlSeekButtonElement> create(HTMLMediaElement*, PseudoId);
 
-protected:
-    MediaControlSeekButtonElement(HTMLMediaElement*, MediaControlElementType);
+    virtual void defaultEventHandler(Event*);
 
 private:
-    virtual bool isForwardButton() const = 0;
+    MediaControlSeekButtonElement(HTMLMediaElement*, PseudoId);
+
+    bool isForwardButton() const;
 
     virtual void detach();
     void seekTimerFired(Timer<MediaControlSeekButtonElement>*);
@@ -255,33 +244,7 @@ private:
     bool m_capturing;
     Timer<MediaControlSeekButtonElement> m_seekTimer;
 };
-
-// ----------------------------
-
-class MediaControlSeekForwardButtonElement : public MediaControlSeekButtonElement {
-public:
-    static PassRefPtr<MediaControlSeekForwardButtonElement> create(HTMLMediaElement*);
-
-private:
-    MediaControlSeekForwardButtonElement(HTMLMediaElement*);
-
-    virtual bool isForwardButton() const { return true; }
-    virtual AtomicString shadowPseudoId() const;
-};
-
-// ----------------------------
-
-class MediaControlSeekBackButtonElement : public MediaControlSeekButtonElement {
-public:
-    static PassRefPtr<MediaControlSeekBackButtonElement> create(HTMLMediaElement*);
-
-private:
-    MediaControlSeekBackButtonElement(HTMLMediaElement*);
-
-    virtual bool isForwardButton() const { return false; }
-    virtual AtomicString shadowPseudoId() const;
-};
-
+    
 // ----------------------------
 
 class MediaControlRewindButtonElement : public MediaControlInputElement {
@@ -292,8 +255,6 @@ public:
 
 private:
     MediaControlRewindButtonElement(HTMLMediaElement*);
-
-    virtual AtomicString shadowPseudoId() const;
 };
 
 // ----------------------------
@@ -306,8 +267,6 @@ public:
 
 private:
     MediaControlReturnToRealtimeButtonElement(HTMLMediaElement*);
-
-    virtual AtomicString shadowPseudoId() const;
 };    
 
 // ----------------------------
@@ -322,7 +281,6 @@ private:
     MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement*);
 
     virtual void updateDisplayType();
-    virtual AtomicString shadowPseudoId() const;
 };    
 
 // ----------------------------
@@ -336,8 +294,6 @@ public:
 
 private:
     MediaControlTimelineElement(HTMLMediaElement*);
-
-    virtual AtomicString shadowPseudoId() const;
 };
 
 // ----------------------------
@@ -351,8 +307,6 @@ public:
 
 private:
     MediaControlVolumeSliderElement(HTMLMediaElement*);
-
-    virtual AtomicString shadowPseudoId() const;
 };
 
 // ----------------------------
@@ -365,8 +319,6 @@ public:
 
 private:
     MediaControlFullscreenButtonElement(HTMLMediaElement*);
-
-    virtual AtomicString shadowPseudoId() const;
 };
 
 // ----------------------------
index 70b1b33..7da72db 100644 (file)
@@ -190,7 +190,7 @@ void RenderMedia::createPanel()
 void RenderMedia::createMuteButton()
 {
     ASSERT(!m_muteButton);
-    m_muteButton = MediaControlMuteButtonElement::create(mediaElement());
+    m_muteButton = MediaControlMuteButtonElement::create(mediaElement(), MediaControlMuteButtonElement::Controller);
     m_muteButton->attachToParent(m_panel.get());
 }
 
@@ -204,14 +204,14 @@ void RenderMedia::createPlayButton()
 void RenderMedia::createSeekBackButton()
 {
     ASSERT(!m_seekBackButton);
-    m_seekBackButton = MediaControlSeekBackButtonElement::create(mediaElement());
+    m_seekBackButton = MediaControlSeekButtonElement::create(mediaElement(), MEDIA_CONTROLS_SEEK_BACK_BUTTON);
     m_seekBackButton->attachToParent(m_panel.get());
 }
 
 void RenderMedia::createSeekForwardButton()
 {
     ASSERT(!m_seekForwardButton);
-    m_seekForwardButton = MediaControlSeekForwardButtonElement::create(mediaElement());
+    m_seekForwardButton = MediaControlSeekButtonElement::create(mediaElement(), MEDIA_CONTROLS_SEEK_FORWARD_BUTTON);
     m_seekForwardButton->attachToParent(m_panel.get());
 }
 
@@ -278,7 +278,7 @@ void RenderMedia::createVolumeSlider()
 void RenderMedia::createVolumeSliderMuteButton()
 {
     ASSERT(!m_volumeSliderMuteButton);
-    m_volumeSliderMuteButton = MediaControlVolumeSliderMuteButtonElement::create(mediaElement());
+    m_volumeSliderMuteButton = MediaControlMuteButtonElement::create(mediaElement(), MediaControlMuteButtonElement::VolumeSlider);
     m_volumeSliderMuteButton->attachToParent(m_volumeSliderContainer.get());
     
 }
index 633d482..7cd4903 100644 (file)
@@ -69,7 +69,11 @@ enum PseudoId {
     // The order must be NOP ID, public IDs, and then internal IDs.
     NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER,
     SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
-    MEDIA_CONTROLS_TIMELINE_CONTAINER, MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER, MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, 
+    MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
+    MEDIA_CONTROLS_VOLUME_SLIDER, MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER, MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON, 
+    MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY, 
+    MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON, 
+    MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON,
     MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
     INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE,
     METER_HORIZONTAL_BAR, METER_HORIZONTAL_OPTIMUM, METER_HORIZONTAL_SUBOPTIMAL, METER_HORIZONTAL_EVEN_LESS_GOOD,