Changeset 76951 in webkit


Ignore:
Timestamp:
Jan 28, 2011 9:52:58 AM (13 years ago)
Author:
Dimitri Glazkov
Message:

2011-01-27 Dimitri Glazkov <Dimitri Glazkov>

Reviewed by Kent Tamura.

Change HTMLInputElement-derived parts of media element shadow DOM to use shadowPseudoId.
https://bugs.webkit.org/show_bug.cgi?id=53122

This is the first step in converting HTMLMediaElement to the new shadow DOM.

Should not regress any existing tests. No observable change in behavior.

  • css/CSSSelector.cpp: (WebCore::CSSSelector::pseudoId): Removed now-unnecessary hard-coded pseudo-element selectors. (WebCore::nameToPseudoTypeMap): Ditto. (WebCore::CSSSelector::extractPseudoType): Ditto.
  • css/CSSSelector.h: Ditto.
  • css/mediaControls.css: Added proper initial values, now that elements use the proper selector pipeline.
  • rendering/MediaControlElements.cpp: (WebCore::MediaControlInputElement::MediaControlInputElement): Removed the switch statement,

which is now replaced with virtual shadowPseudoId on each corresponding class.

(WebCore::MediaControlInputElement::styleForElement): Changed to use element pipeline.
(WebCore::MediaControlMuteButtonElement::MediaControlMuteButtonElement): Changed to set

display type in constructor.

(WebCore::MediaControlMuteButtonElement::create): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlMuteButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement): Added

to disambiguate from the MediaControlMuteButtonElement.

(WebCore::MediaControlVolumeSliderMuteButtonElement::create): Added.
(WebCore::MediaControlVolumeSliderMuteButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlPlayButtonElement::MediaControlPlayButtonElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlPlayButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlSeekButtonElement::MediaControlSeekButtonElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement): Added.
(WebCore::MediaControlSeekForwardButtonElement::create): Added.
(WebCore::MediaControlSeekForwardButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement): Added.
(WebCore::MediaControlSeekBackButtonElement::create): Added.
(WebCore::MediaControlSeekBackButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlRewindButtonElement::MediaControlRewindButtonElement): Added.
(WebCore::MediaControlRewindButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlReturnToRealtimeButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlToggleClosedCaptionsButtonElement::shadowPseudoId): Added.
(WebCore::MediaControlTimelineElement::MediaControlTimelineElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlTimelineElement::shadowPseudoId): Added.
(WebCore::MediaControlVolumeSliderElement::MediaControlVolumeSliderElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlVolumeSliderElement::shadowPseudoId): Added.
(WebCore::MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement): Changed to not take PseudoId as

constructor argument.

(WebCore::MediaControlFullscreenButtonElement::shadowPseudoId): Added.

  • rendering/MediaControlElements.h: (WebCore::MediaControlSeekForwardButtonElement::isForwardButton): Added. (WebCore::MediaControlSeekBackButtonElement::isForwardButton): Added.
  • rendering/RenderMedia.cpp: (WebCore::RenderMedia::createMuteButton): Changed to use new constructor. (WebCore::RenderMedia::createSeekBackButton): Ditto. (WebCore::RenderMedia::createSeekForwardButton): Ditto. (WebCore::RenderMedia::createVolumeSliderMuteButton): Ditto.
  • rendering/style/RenderStyleConstants.h: Removed constants that are no longer used.
Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76950 r76951  
     12011-01-27  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        Reviewed by Kent Tamura.
     4
     5        Change HTMLInputElement-derived parts of media element shadow DOM to use shadowPseudoId.
     6        https://bugs.webkit.org/show_bug.cgi?id=53122
     7
     8        This is the first step in converting HTMLMediaElement to the new shadow DOM.
     9
     10        Should not regress any existing tests. No observable change in behavior.
     11
     12        * css/CSSSelector.cpp:
     13        (WebCore::CSSSelector::pseudoId): Removed now-unnecessary hard-coded pseudo-element selectors.
     14        (WebCore::nameToPseudoTypeMap): Ditto.
     15        (WebCore::CSSSelector::extractPseudoType): Ditto.
     16        * css/CSSSelector.h: Ditto.
     17        * css/mediaControls.css: Added proper initial values, now that elements use the proper selector pipeline.
     18        * rendering/MediaControlElements.cpp:
     19        (WebCore::MediaControlInputElement::MediaControlInputElement): Removed the switch statement,
     20            which is now replaced with virtual shadowPseudoId on each corresponding class.
     21        (WebCore::MediaControlInputElement::styleForElement): Changed to use element pipeline.
     22        (WebCore::MediaControlMuteButtonElement::MediaControlMuteButtonElement): Changed to set
     23            display type in constructor.
     24        (WebCore::MediaControlMuteButtonElement::create): Changed to not take PseudoId as
     25            constructor argument.
     26        (WebCore::MediaControlMuteButtonElement::shadowPseudoId): Added.
     27        (WebCore::MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement): Added
     28            to disambiguate from the MediaControlMuteButtonElement.
     29        (WebCore::MediaControlVolumeSliderMuteButtonElement::create): Added.
     30        (WebCore::MediaControlVolumeSliderMuteButtonElement::shadowPseudoId): Added.
     31        (WebCore::MediaControlPlayButtonElement::MediaControlPlayButtonElement): Changed to not take PseudoId as
     32            constructor argument.
     33        (WebCore::MediaControlPlayButtonElement::shadowPseudoId): Added.
     34        (WebCore::MediaControlSeekButtonElement::MediaControlSeekButtonElement): Changed to not take PseudoId as
     35            constructor argument.
     36        (WebCore::MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement): Added.
     37        (WebCore::MediaControlSeekForwardButtonElement::create): Added.
     38        (WebCore::MediaControlSeekForwardButtonElement::shadowPseudoId): Added.
     39        (WebCore::MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement): Added.
     40        (WebCore::MediaControlSeekBackButtonElement::create): Added.
     41        (WebCore::MediaControlSeekBackButtonElement::shadowPseudoId): Added.
     42        (WebCore::MediaControlRewindButtonElement::MediaControlRewindButtonElement): Added.
     43        (WebCore::MediaControlRewindButtonElement::shadowPseudoId): Added.
     44        (WebCore::MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement): Changed to not take PseudoId as
     45            constructor argument.
     46        (WebCore::MediaControlReturnToRealtimeButtonElement::shadowPseudoId): Added.
     47        (WebCore::MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement): Changed to not take PseudoId as
     48            constructor argument.
     49        (WebCore::MediaControlToggleClosedCaptionsButtonElement::shadowPseudoId): Added.
     50        (WebCore::MediaControlTimelineElement::MediaControlTimelineElement): Changed to not take PseudoId as
     51            constructor argument.
     52        (WebCore::MediaControlTimelineElement::shadowPseudoId): Added.
     53        (WebCore::MediaControlVolumeSliderElement::MediaControlVolumeSliderElement): Changed to not take PseudoId as
     54            constructor argument.
     55        (WebCore::MediaControlVolumeSliderElement::shadowPseudoId): Added.
     56        (WebCore::MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement): Changed to not take PseudoId as
     57            constructor argument.
     58        (WebCore::MediaControlFullscreenButtonElement::shadowPseudoId): Added.
     59        * rendering/MediaControlElements.h:
     60        (WebCore::MediaControlSeekForwardButtonElement::isForwardButton): Added.
     61        (WebCore::MediaControlSeekBackButtonElement::isForwardButton): Added.
     62        * rendering/RenderMedia.cpp:
     63        (WebCore::RenderMedia::createMuteButton): Changed to use new constructor.
     64        (WebCore::RenderMedia::createSeekBackButton): Ditto.
     65        (WebCore::RenderMedia::createSeekForwardButton): Ditto.
     66        (WebCore::RenderMedia::createVolumeSliderMuteButton): Ditto.
     67        * rendering/style/RenderStyleConstants.h: Removed constants that are no longer used.
     68
    1692011-01-27  Dimitri Glazkov  <dglazkov@chromium.org>
    270
  • trunk/Source/WebCore/css/CSSSelector.cpp

    r76724 r76951  
    141141    case PseudoMediaControlsPanel:
    142142        return MEDIA_CONTROLS_PANEL;
    143     case PseudoMediaControlsMuteButton:
    144         return MEDIA_CONTROLS_MUTE_BUTTON;
    145     case PseudoMediaControlsPlayButton:
    146         return MEDIA_CONTROLS_PLAY_BUTTON;
    147143    case PseudoMediaControlsTimelineContainer:
    148144        return MEDIA_CONTROLS_TIMELINE_CONTAINER;
     
    153149    case PseudoMediaControlsTimeRemainingDisplay:
    154150        return MEDIA_CONTROLS_TIME_REMAINING_DISPLAY;
    155     case PseudoMediaControlsTimeline:
    156         return MEDIA_CONTROLS_TIMELINE;
    157     case PseudoMediaControlsVolumeSlider:
    158         return MEDIA_CONTROLS_VOLUME_SLIDER;
    159     case PseudoMediaControlsVolumeSliderMuteButton:
    160         return MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON;
    161     case PseudoMediaControlsSeekBackButton:
    162         return MEDIA_CONTROLS_SEEK_BACK_BUTTON;
    163     case PseudoMediaControlsSeekForwardButton:
    164         return MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
    165     case PseudoMediaControlsRewindButton:
    166         return MEDIA_CONTROLS_REWIND_BUTTON;
    167     case PseudoMediaControlsReturnToRealtimeButton:
    168         return MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON;
    169     case PseudoMediaControlsToggleClosedCaptions:
    170         return MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON;
    171151    case PseudoMediaControlsStatusDisplay:
    172152        return MEDIA_CONTROLS_STATUS_DISPLAY;
    173     case PseudoMediaControlsFullscreenButton:
    174         return MEDIA_CONTROLS_FULLSCREEN_BUTTON;
    175153    case PseudoScrollbar:
    176154        return SCROLLBAR;
     
    348326    DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang("));
    349327    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPanel, ("-webkit-media-controls-panel"));
    350     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsMuteButton, ("-webkit-media-controls-mute-button"));
    351     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsPlayButton, ("-webkit-media-controls-play-button"));
    352     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimeline, ("-webkit-media-controls-timeline"));
    353     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSlider, ("-webkit-media-controls-volume-slider"));
    354     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSliderMuteButton, ("-webkit-media-controls-volume-slider-mute-button"));
    355     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekBackButton, ("-webkit-media-controls-seek-back-button"));
    356     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsSeekForwardButton, ("-webkit-media-controls-seek-forward-button"));
    357     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsRewindButton, ("-webkit-media-controls-rewind-button"));
    358     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsReturnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button"));
    359     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsToggleClosedCaptionsButton, ("-webkit-media-controls-toggle-closed-captions-button"));
    360328    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsStatusDisplay, ("-webkit-media-controls-status-display"));
    361     DEFINE_STATIC_LOCAL(AtomicString, mediaControlsFullscreenButton, ("-webkit-media-controls-fullscreen-button"));
    362329    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsTimelineContainer, ("-webkit-media-controls-timeline-container"));
    363330    DEFINE_STATIC_LOCAL(AtomicString, mediaControlsVolumeSliderContainer, ("-webkit-media-controls-volume-slider-container"));
     
    465432        nameToPseudoType->set(lang.impl(), CSSSelector::PseudoLang);
    466433        nameToPseudoType->set(mediaControlsPanel.impl(), CSSSelector::PseudoMediaControlsPanel);
    467         nameToPseudoType->set(mediaControlsMuteButton.impl(), CSSSelector::PseudoMediaControlsMuteButton);
    468         nameToPseudoType->set(mediaControlsPlayButton.impl(), CSSSelector::PseudoMediaControlsPlayButton);
    469434        nameToPseudoType->set(mediaControlsCurrentTimeDisplay.impl(), CSSSelector::PseudoMediaControlsCurrentTimeDisplay);
    470435        nameToPseudoType->set(mediaControlsTimeRemainingDisplay.impl(), CSSSelector::PseudoMediaControlsTimeRemainingDisplay);
    471         nameToPseudoType->set(mediaControlsTimeline.impl(), CSSSelector::PseudoMediaControlsTimeline);
    472         nameToPseudoType->set(mediaControlsVolumeSlider.impl(), CSSSelector::PseudoMediaControlsVolumeSlider);
    473         nameToPseudoType->set(mediaControlsVolumeSliderMuteButton.impl(), CSSSelector::PseudoMediaControlsVolumeSliderMuteButton);
    474         nameToPseudoType->set(mediaControlsSeekBackButton.impl(), CSSSelector::PseudoMediaControlsSeekBackButton);
    475         nameToPseudoType->set(mediaControlsSeekForwardButton.impl(), CSSSelector::PseudoMediaControlsSeekForwardButton);
    476         nameToPseudoType->set(mediaControlsRewindButton.impl(), CSSSelector::PseudoMediaControlsRewindButton);
    477         nameToPseudoType->set(mediaControlsReturnToRealtimeButton.impl(), CSSSelector::PseudoMediaControlsReturnToRealtimeButton);
    478         nameToPseudoType->set(mediaControlsToggleClosedCaptionsButton.impl(), CSSSelector::PseudoMediaControlsToggleClosedCaptions);
    479436        nameToPseudoType->set(mediaControlsStatusDisplay.impl(), CSSSelector::PseudoMediaControlsStatusDisplay);
    480         nameToPseudoType->set(mediaControlsFullscreenButton.impl(), CSSSelector::PseudoMediaControlsFullscreenButton);
    481437        nameToPseudoType->set(mediaControlsTimelineContainer.impl(), CSSSelector::PseudoMediaControlsTimelineContainer);
    482438        nameToPseudoType->set(mediaControlsVolumeSliderContainer.impl(), CSSSelector::PseudoMediaControlsVolumeSliderContainer);
     
    575531    case PseudoInnerSpinButton:
    576532    case PseudoMediaControlsPanel:
    577     case PseudoMediaControlsMuteButton:
    578     case PseudoMediaControlsPlayButton:
    579533    case PseudoMediaControlsCurrentTimeDisplay:
    580534    case PseudoMediaControlsTimeRemainingDisplay:
    581     case PseudoMediaControlsTimeline:
    582     case PseudoMediaControlsVolumeSlider:
    583     case PseudoMediaControlsVolumeSliderMuteButton:
    584     case PseudoMediaControlsSeekBackButton:
    585     case PseudoMediaControlsSeekForwardButton:
    586     case PseudoMediaControlsRewindButton:
    587     case PseudoMediaControlsReturnToRealtimeButton:
    588     case PseudoMediaControlsToggleClosedCaptions:
    589535    case PseudoMediaControlsStatusDisplay:
    590     case PseudoMediaControlsFullscreenButton:
    591536    case PseudoMediaControlsTimelineContainer:
    592537    case PseudoMediaControlsVolumeSliderContainer:
  • trunk/Source/WebCore/css/CSSSelector.h

    r76724 r76951  
    177177            PseudoSearchResultsButton,
    178178            PseudoMediaControlsPanel,
    179             PseudoMediaControlsMuteButton,
    180             PseudoMediaControlsPlayButton,
    181179            PseudoMediaControlsTimelineContainer,
    182180            PseudoMediaControlsVolumeSliderContainer,
    183             PseudoMediaControlsVolumeSliderMuteButton,
    184181            PseudoMediaControlsCurrentTimeDisplay,
    185182            PseudoMediaControlsTimeRemainingDisplay,
    186             PseudoMediaControlsToggleClosedCaptions,
    187             PseudoMediaControlsTimeline,
    188             PseudoMediaControlsVolumeSlider,
    189             PseudoMediaControlsSeekBackButton,
    190             PseudoMediaControlsSeekForwardButton,
    191             PseudoMediaControlsRewindButton,
    192             PseudoMediaControlsReturnToRealtimeButton,
    193183            PseudoMediaControlsStatusDisplay,
    194             PseudoMediaControlsFullscreenButton,
    195184            PseudoMeterHorizontalBar,
    196185            PseudoMeterVerticalBar,
  • trunk/Source/WebCore/css/mediaControls.css

    r76724 r76951  
    5353    width: 16px;
    5454    height: 16px;
     55    background-color: initial;
     56    border: initial;
     57    color: inherit;
    5558}
    5659
     
    6063    width: 16px;
    6164    height: 16px;
     65    background-color: initial;
     66    border: initial;
     67    color: inherit;
    6268}
    6369
     
    8793    height: 16px;
    8894    padding: 0px 2px;
     95    background-color: initial;
     96    border: initial;
     97    color: inherit;
     98    margin: initial;
    8999}
    90100
     
    95105audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
    96106    display: none;
     107    background-color: initial;
     108    border: initial;
     109    color: inherit;
     110    margin: initial;
    97111}
    98112
     
    102116    width: 16px;
    103117    height: 16px;
     118    background-color: initial;
     119    border: initial;
     120    color: inherit;
    104121}
    105122
     
    109126    width: 16px;
    110127    height: 16px;
     128    background-color: initial;
     129    border: initial;
     130    color: inherit;
    111131}
    112132
     
    116136    width: 16px;
    117137    height: 16px;
     138    background-color: initial;
     139    border: initial;
     140    color: inherit;
    118141}
    119142
    120143audio::-webkit-media-controls-rewind-button, video::-webkit-media-controls-rewind-button {
    121144    display: none;
     145    background-color: initial;
     146    border: initial;
     147    color: inherit;
    122148}
    123149
    124150audio::-webkit-media-controls-return-to-realtime-button, video::-webkit-media-controls-return-to-realtime-button {
    125151    display: none;
     152    background-color: initial;
     153    border: initial;
     154    color: inherit;
    126155}
    127156
     
    131160    width: 16px;
    132161    height: 16px;
     162    background-color: initial;
     163    border: initial;
     164    color: inherit;
    133165}
    134166
     
    136168    -webkit-appearance: media-volume-slider-mute-button;
    137169    display: none;
     170    background-color: initial;
     171    border: initial;
     172    color: inherit;
    138173}
  • trunk/Source/WebCore/css/mediaControlsChromium.css

    r74535 r76951  
    158158    padding: 0px;
    159159    margin: 0px 6px;
    160     height: 16px;
     160    height: 18px;
    161161
    162162    border-color: rgba(255, 255, 255, 0.2);
  • trunk/Source/WebCore/html/shadow/MediaControls.cpp

    r76950 r76951  
    247247{
    248248    ASSERT(!m_muteButton);
    249     m_muteButton = MediaControlMuteButtonElement::create(m_mediaElement, MediaControlMuteButtonElement::Controller);
     249    m_muteButton = MediaControlMuteButtonElement::create(m_mediaElement);
    250250    m_muteButton->attachToParent(m_panel.get());
    251251}
     
    261261{
    262262    ASSERT(!m_seekBackButton);
    263     m_seekBackButton = MediaControlSeekButtonElement::create(m_mediaElement, MEDIA_CONTROLS_SEEK_BACK_BUTTON);
     263    m_seekBackButton = MediaControlSeekBackButtonElement::create(m_mediaElement);
    264264    m_seekBackButton->attachToParent(m_panel.get());
    265265}
     
    268268{
    269269    ASSERT(!m_seekForwardButton);
    270     m_seekForwardButton = MediaControlSeekButtonElement::create(m_mediaElement, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON);
     270    m_seekForwardButton = MediaControlSeekForwardButtonElement::create(m_mediaElement);
    271271    m_seekForwardButton->attachToParent(m_panel.get());
    272272}
     
    335335{
    336336    ASSERT(!m_volumeSliderMuteButton);
    337     m_volumeSliderMuteButton = MediaControlMuteButtonElement::create(m_mediaElement, MediaControlMuteButtonElement::VolumeSlider);
     337    m_volumeSliderMuteButton = MediaControlVolumeSliderMuteButtonElement::create(m_mediaElement);
    338338    m_volumeSliderMuteButton->attachToParent(m_volumeSliderContainer.get());
    339339}
  • trunk/Source/WebCore/rendering/MediaControlElements.cpp

    r76950 r76951  
    3333#include "MediaControlElements.h"
    3434
     35#include "CSSStyleSelector.h"
    3536#include "EventNames.h"
    3637#include "FloatConversion.h"
     
    354355// ----------------------------
    355356   
    356 MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo)
     357MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
    357358    : HTMLInputElement(inputTag, mediaElement->document(), 0, false)
    358359    , m_mediaElement(mediaElement)
    359     , m_pseudoStyleId(pseudo)
    360 {
    361     setInDocument();
    362 
    363     switch (pseudo) {
    364     case MEDIA_CONTROLS_MUTE_BUTTON:
    365         m_displayType = MediaMuteButton;
    366         break;
    367     case MEDIA_CONTROLS_PLAY_BUTTON:
    368         m_displayType = MediaPlayButton;
    369         break;
    370     case MEDIA_CONTROLS_SEEK_FORWARD_BUTTON:
    371         m_displayType = MediaSeekForwardButton;
    372         break;
    373     case MEDIA_CONTROLS_SEEK_BACK_BUTTON:
    374         m_displayType = MediaSeekBackButton;
    375         break;
    376     case MEDIA_CONTROLS_FULLSCREEN_BUTTON:
    377         m_displayType = MediaFullscreenButton;
    378         break;
    379     case MEDIA_CONTROLS_TIMELINE:
    380         m_displayType = MediaSlider;
    381         break;
    382     case MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON:
    383         m_displayType = MediaReturnToRealtimeButton;
    384         break;
    385     case MEDIA_CONTROLS_REWIND_BUTTON:
    386         m_displayType = MediaRewindButton;
    387         break;
    388     case MEDIA_CONTROLS_VOLUME_SLIDER:
    389         m_displayType = MediaVolumeSlider;
    390         break;
    391     case MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON:
    392         m_displayType = MediaVolumeSliderMuteButton;
    393         break;
    394     case MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON:
    395         m_displayType = MediaShowClosedCaptionsButton;
    396         break;
    397     default:
    398         ASSERT_NOT_REACHED();
    399         break;
    400     }
     360    , m_displayType(displayType)
     361{
    401362}
    402363
     
    418379PassRefPtr<RenderStyle> MediaControlInputElement::styleForElement()
    419380{
    420     return mediaElement()->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
     381    return document()->styleSelector()->styleForElement(this, 0, true);
    421382}
    422383
     
    483444        shadowNode->recalcStyle(Node::Force);
    484445}
    485    
     446
    486447bool MediaControlInputElement::hitTest(const IntPoint& absPoint)
    487448{
     
    504465// ----------------------------
    505466
    506 inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, ButtonLocation location)
    507     : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON)
    508 {
    509 }
    510 
    511 PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement, ButtonLocation location)
    512 {
    513     RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, location));
     467inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
     468    : MediaControlInputElement(mediaElement, displayType)
     469{
     470}
     471
     472PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement)
     473{
     474    RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, MediaMuteButton));
    514475    button->setType("button");
    515476    return button.release();
     
    525486}
    526487
     488const AtomicString& MediaControlMuteButtonElement::shadowPseudoId() const
     489{
     490    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-mute-button"));
     491    return id;
     492}
     493
    527494void MediaControlMuteButtonElement::updateDisplayType()
    528495{
     
    530497}
    531498
     499inline MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement(HTMLMediaElement* mediaElement)
     500    : MediaControlMuteButtonElement(mediaElement, MediaVolumeSliderMuteButton)
     501{
     502}
     503
     504PassRefPtr<MediaControlVolumeSliderMuteButtonElement> MediaControlVolumeSliderMuteButtonElement::create(HTMLMediaElement* mediaElement)
     505{
     506    RefPtr<MediaControlVolumeSliderMuteButtonElement> button = adoptRef(new MediaControlVolumeSliderMuteButtonElement(mediaElement));
     507    button->setType("button");
     508    return button.release();
     509}
     510
     511const AtomicString& MediaControlVolumeSliderMuteButtonElement::shadowPseudoId() const
     512{
     513    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider-mute-button"));
     514    return id;
     515}
     516
    532517// ----------------------------
    533518
    534519inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(HTMLMediaElement* mediaElement)
    535     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON)
     520    : MediaControlInputElement(mediaElement, MediaPlayButton)
    536521{
    537522}
     
    558543}
    559544
    560 // ----------------------------
    561 
    562 inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, PseudoId pseudoId)
    563     : MediaControlInputElement(mediaElement, pseudoId)
     545const AtomicString& MediaControlPlayButtonElement::shadowPseudoId() const
     546{
     547    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-play-button"));
     548    return id;
     549}
     550
     551// ----------------------------
     552
     553inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
     554    : MediaControlInputElement(mediaElement, displayType)
    564555    , m_seeking(false)
    565556    , m_capturing(false)
    566557    , m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired)
    567558{
    568 }
    569 
    570 PassRefPtr<MediaControlSeekButtonElement> MediaControlSeekButtonElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId)
    571 {
    572     RefPtr<MediaControlSeekButtonElement> button = adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId));
    573     button->setType("button");
    574     return button.release();
    575 }
    576 
    577 inline bool MediaControlSeekButtonElement::isForwardButton() const
    578 {
    579     return pseudoStyleId() == MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
    580559}
    581560
     
    629608// ----------------------------
    630609
     610inline MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement(HTMLMediaElement* mediaElement)
     611    : MediaControlSeekButtonElement(mediaElement, MediaSeekForwardButton)
     612{
     613}
     614
     615PassRefPtr<MediaControlSeekForwardButtonElement> MediaControlSeekForwardButtonElement::create(HTMLMediaElement* mediaElement)
     616{
     617    RefPtr<MediaControlSeekForwardButtonElement> button = adoptRef(new MediaControlSeekForwardButtonElement(mediaElement));
     618    button->setType("button");
     619    return button.release();
     620}
     621
     622const AtomicString& MediaControlSeekForwardButtonElement::shadowPseudoId() const
     623{
     624    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-seek-forward-button"));
     625    return id;
     626}
     627
     628// ----------------------------
     629
     630inline MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement(HTMLMediaElement* mediaElement)
     631    : MediaControlSeekButtonElement(mediaElement, MediaSeekBackButton)
     632{
     633}
     634
     635PassRefPtr<MediaControlSeekBackButtonElement> MediaControlSeekBackButtonElement::create(HTMLMediaElement* mediaElement)
     636{
     637    RefPtr<MediaControlSeekBackButtonElement> button = adoptRef(new MediaControlSeekBackButtonElement(mediaElement));
     638    button->setType("button");
     639    return button.release();
     640}
     641
     642const AtomicString& MediaControlSeekBackButtonElement::shadowPseudoId() const
     643{
     644    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-seek-back-button"));
     645    return id;
     646}
     647
     648// ----------------------------
     649
    631650inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(HTMLMediaElement* element)
    632     : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON)
     651    : MediaControlInputElement(element, MediaRewindButton)
    633652{
    634653}
     
    650669}
    651670
     671const AtomicString& MediaControlRewindButtonElement::shadowPseudoId() const
     672{
     673    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-rewind-button"));
     674    return id;
     675}
     676
    652677// ----------------------------
    653678
    654679inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(HTMLMediaElement* mediaElement)
    655     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON)
     680    : MediaControlInputElement(mediaElement, MediaReturnToRealtimeButton)
    656681{
    657682}
     
    673698}
    674699
     700const AtomicString& MediaControlReturnToRealtimeButtonElement::shadowPseudoId() const
     701{
     702    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-return-to-realtime-button"));
     703    return id;
     704}
    675705
    676706// ----------------------------
    677707
    678708inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement* mediaElement)
    679     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON)
     709    : MediaControlInputElement(mediaElement, MediaShowClosedCaptionsButton)
    680710{
    681711}
     
    703733}
    704734
     735const AtomicString& MediaControlToggleClosedCaptionsButtonElement::shadowPseudoId() const
     736{
     737    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-toggle-closed-captions-button"));
     738    return id;
     739}
     740
    705741// ----------------------------
    706742
    707743MediaControlTimelineElement::MediaControlTimelineElement(HTMLMediaElement* mediaElement)
    708     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE)
     744    : MediaControlInputElement(mediaElement, MediaSlider)
    709745{
    710746}
     
    758794}
    759795
     796const AtomicString& MediaControlTimelineElement::shadowPseudoId() const
     797{
     798    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-timeline"));
     799    return id;
     800}
     801
    760802// ----------------------------
    761803
    762804inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(HTMLMediaElement* mediaElement)
    763     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER)
     805    : MediaControlInputElement(mediaElement, MediaVolumeSlider)
    764806{
    765807}
     
    802844}
    803845
     846const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const
     847{
     848    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-volume-slider"));
     849    return id;
     850}
     851
    804852// ----------------------------
    805853
    806854inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(HTMLMediaElement* mediaElement)
    807     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON)
     855    : MediaControlInputElement(mediaElement, MediaFullscreenButton)
    808856{
    809857}
     
    838886}
    839887
     888const AtomicString& MediaControlFullscreenButtonElement::shadowPseudoId() const
     889{
     890    DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-fullscreen-button"));
     891    return id;
     892}
     893
    840894// ----------------------------
    841895
  • trunk/Source/WebCore/rendering/MediaControlElements.h

    r76724 r76951  
    175175
    176176protected:
    177     MediaControlInputElement(HTMLMediaElement*, PseudoId);
     177    MediaControlInputElement(HTMLMediaElement*, MediaControlElementType);
    178178
    179179    void setDisplayType(MediaControlElementType);
    180 
    181     PseudoId pseudoStyleId() const { return m_pseudoStyleId; }
    182180
    183181private:
     
    191189    virtual void updateDisplayType() { }
    192190
    193     HTMLMediaElement* m_mediaElement;   
    194     PseudoId m_pseudoStyleId;
     191    HTMLMediaElement* m_mediaElement;
    195192    MediaControlElementType m_displayType;
    196193};
     
    200197class MediaControlMuteButtonElement : public MediaControlInputElement {
    201198public:
    202     enum ButtonLocation { Controller, VolumeSlider };
    203     static PassRefPtr<MediaControlMuteButtonElement> create(HTMLMediaElement*, ButtonLocation);
    204 
    205     virtual void defaultEventHandler(Event*);
    206 
    207 private:
    208     MediaControlMuteButtonElement(HTMLMediaElement*, ButtonLocation);
    209 
     199    static PassRefPtr<MediaControlMuteButtonElement> create(HTMLMediaElement*);
     200
     201    virtual void defaultEventHandler(Event*);
     202
     203protected:
     204    MediaControlMuteButtonElement(HTMLMediaElement*, MediaControlElementType);
     205
     206private:
    210207    virtual void updateDisplayType();
    211 };
     208    virtual const AtomicString& shadowPseudoId() const;
     209};
     210
     211// ----------------------------
     212
     213class MediaControlVolumeSliderMuteButtonElement : public MediaControlMuteButtonElement {
     214public:
     215    static PassRefPtr<MediaControlVolumeSliderMuteButtonElement> create(HTMLMediaElement*);
     216
     217private:
     218    MediaControlVolumeSliderMuteButtonElement(HTMLMediaElement*);
     219
     220    virtual const AtomicString& shadowPseudoId() const;
     221};
     222
    212223
    213224// ----------------------------
     
    223234
    224235    virtual void updateDisplayType();
     236    virtual const AtomicString& shadowPseudoId() const;
    225237};
    226238
     
    229241class MediaControlSeekButtonElement : public MediaControlInputElement {
    230242public:
    231     static PassRefPtr<MediaControlSeekButtonElement> create(HTMLMediaElement*, PseudoId);
    232 
    233     virtual void defaultEventHandler(Event*);
    234 
    235 private:
    236     MediaControlSeekButtonElement(HTMLMediaElement*, PseudoId);
    237 
    238     bool isForwardButton() const;
     243    virtual void defaultEventHandler(Event*);
     244
     245protected:
     246    MediaControlSeekButtonElement(HTMLMediaElement*, MediaControlElementType);
     247
     248private:
     249    virtual bool isForwardButton() const = 0;
    239250
    240251    virtual void detach();
     
    245256    Timer<MediaControlSeekButtonElement> m_seekTimer;
    246257};
    247    
     258
     259// ----------------------------
     260
     261class MediaControlSeekForwardButtonElement : public MediaControlSeekButtonElement {
     262public:
     263    static PassRefPtr<MediaControlSeekForwardButtonElement> create(HTMLMediaElement*);
     264
     265private:
     266    MediaControlSeekForwardButtonElement(HTMLMediaElement*);
     267
     268    virtual bool isForwardButton() const { return true; }
     269    virtual const AtomicString& shadowPseudoId() const;
     270};
     271
     272// ----------------------------
     273
     274class MediaControlSeekBackButtonElement : public MediaControlSeekButtonElement {
     275public:
     276    static PassRefPtr<MediaControlSeekBackButtonElement> create(HTMLMediaElement*);
     277
     278private:
     279    MediaControlSeekBackButtonElement(HTMLMediaElement*);
     280
     281    virtual bool isForwardButton() const { return false; }
     282    virtual const AtomicString& shadowPseudoId() const;
     283};
     284
    248285// ----------------------------
    249286
     
    256293private:
    257294    MediaControlRewindButtonElement(HTMLMediaElement*);
     295
     296    virtual const AtomicString& shadowPseudoId() const;
    258297};
    259298
     
    268307private:
    269308    MediaControlReturnToRealtimeButtonElement(HTMLMediaElement*);
     309
     310    virtual const AtomicString& shadowPseudoId() const;
    270311};   
    271312
     
    282323
    283324    virtual void updateDisplayType();
     325    virtual const AtomicString& shadowPseudoId() const;
    284326};   
    285327
     
    295337private:
    296338    MediaControlTimelineElement(HTMLMediaElement*);
     339
     340    virtual const AtomicString& shadowPseudoId() const;
    297341};
    298342
     
    308352private:
    309353    MediaControlVolumeSliderElement(HTMLMediaElement*);
     354
     355    virtual const AtomicString& shadowPseudoId() const;
    310356};
    311357
     
    320366private:
    321367    MediaControlFullscreenButtonElement(HTMLMediaElement*);
     368
     369    virtual const AtomicString& shadowPseudoId() const;
    322370};
    323371
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r76724 r76951  
    7070    NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER,
    7171    SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
    72     MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
    73     MEDIA_CONTROLS_VOLUME_SLIDER, MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER, MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON,
    74     MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY,
    75     MEDIA_CONTROLS_SEEK_BACK_BUTTON, MEDIA_CONTROLS_SEEK_FORWARD_BUTTON, MEDIA_CONTROLS_FULLSCREEN_BUTTON, MEDIA_CONTROLS_REWIND_BUTTON,
    76     MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON,
     72    MEDIA_CONTROLS_TIMELINE_CONTAINER, MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER, MEDIA_CONTROLS_CURRENT_TIME_DISPLAY, MEDIA_CONTROLS_TIME_REMAINING_DISPLAY,
    7773    MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
    7874    INPUT_LIST_BUTTON, INPUT_SPEECH_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON, VISITED_LINK, PROGRESS_BAR_VALUE,
Note: See TracChangeset for help on using the changeset viewer.