Changeset 76719 in webkit


Ignore:
Timestamp:
Jan 26, 2011 2:19:57 PM (13 years ago)
Author:
Dimitri Glazkov
Message:

2011-01-25 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:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76717 r76719  
     12011-01-25  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-26  Kenneth Russell  <kbr@google.com>
    270
  • trunk/Source/WebCore/css/CSSSelector.cpp

    r76648 r76719  
    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

    r76648 r76719  
    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

    r62821 r76719  
    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/rendering/MediaControlElements.cpp

    r76664 r76719  
    3333#include "MediaControlElements.h"
    3434
     35#include "CSSStyleSelector.h"
    3536#include "EventNames.h"
    3637#include "FloatConversion.h"
     
    353354// ----------------------------
    354355   
    355 MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, PseudoId pseudo)
     356MediaControlInputElement::MediaControlInputElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
    356357    : HTMLInputElement(inputTag, mediaElement->document(), 0, false)
    357358    , m_mediaElement(mediaElement)
    358     , m_pseudoStyleId(pseudo)
    359 {
    360     setInDocument();
    361 
    362     switch (pseudo) {
    363     case MEDIA_CONTROLS_MUTE_BUTTON:
    364         m_displayType = MediaMuteButton;
    365         break;
    366     case MEDIA_CONTROLS_PLAY_BUTTON:
    367         m_displayType = MediaPlayButton;
    368         break;
    369     case MEDIA_CONTROLS_SEEK_FORWARD_BUTTON:
    370         m_displayType = MediaSeekForwardButton;
    371         break;
    372     case MEDIA_CONTROLS_SEEK_BACK_BUTTON:
    373         m_displayType = MediaSeekBackButton;
    374         break;
    375     case MEDIA_CONTROLS_FULLSCREEN_BUTTON:
    376         m_displayType = MediaFullscreenButton;
    377         break;
    378     case MEDIA_CONTROLS_TIMELINE:
    379         m_displayType = MediaSlider;
    380         break;
    381     case MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON:
    382         m_displayType = MediaReturnToRealtimeButton;
    383         break;
    384     case MEDIA_CONTROLS_REWIND_BUTTON:
    385         m_displayType = MediaRewindButton;
    386         break;
    387     case MEDIA_CONTROLS_VOLUME_SLIDER:
    388         m_displayType = MediaVolumeSlider;
    389         break;
    390     case MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON:
    391         m_displayType = MediaVolumeSliderMuteButton;
    392         break;
    393     case MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON:
    394         m_displayType = MediaShowClosedCaptionsButton;
    395         break;
    396     default:
    397         ASSERT_NOT_REACHED();
    398         break;
    399     }
     359    , m_displayType(displayType)
     360{
    400361}
    401362
     
    417378PassRefPtr<RenderStyle> MediaControlInputElement::styleForElement()
    418379{
    419     return mediaElement()->renderer()->getCachedPseudoStyle(m_pseudoStyleId);
     380    return document()->styleSelector()->styleForElement(this, 0, true);
    420381}
    421382
     
    482443        shadowNode->recalcStyle(Node::Force);
    483444}
    484    
     445
    485446bool MediaControlInputElement::hitTest(const IntPoint& absPoint)
    486447{
     
    503464// ----------------------------
    504465
    505 inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, ButtonLocation location)
    506     : MediaControlInputElement(mediaElement, location == Controller ? MEDIA_CONTROLS_MUTE_BUTTON : MEDIA_CONTROLS_VOLUME_SLIDER_MUTE_BUTTON)
    507 {
    508 }
    509 
    510 PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement, ButtonLocation location)
    511 {
    512     RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, location));
     466inline MediaControlMuteButtonElement::MediaControlMuteButtonElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
     467    : MediaControlInputElement(mediaElement, displayType)
     468{
     469}
     470
     471PassRefPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElement::create(HTMLMediaElement* mediaElement)
     472{
     473    RefPtr<MediaControlMuteButtonElement> button = adoptRef(new MediaControlMuteButtonElement(mediaElement, MediaMuteButton));
    513474    button->setType("button");
    514475    return button.release();
     
    524485}
    525486
     487AtomicString MediaControlMuteButtonElement::shadowPseudoId() const
     488{
     489    DEFINE_STATIC_LOCAL(AtomicString, muteButton, ("-webkit-media-controls-mute-button"));
     490    return muteButton;
     491}
     492
    526493void MediaControlMuteButtonElement::updateDisplayType()
    527494{
     
    529496}
    530497
     498inline MediaControlVolumeSliderMuteButtonElement::MediaControlVolumeSliderMuteButtonElement(HTMLMediaElement* mediaElement)
     499    : MediaControlMuteButtonElement(mediaElement, MediaVolumeSliderMuteButton)
     500{
     501}
     502
     503PassRefPtr<MediaControlVolumeSliderMuteButtonElement> MediaControlVolumeSliderMuteButtonElement::create(HTMLMediaElement* mediaElement)
     504{
     505    RefPtr<MediaControlVolumeSliderMuteButtonElement> button = adoptRef(new MediaControlVolumeSliderMuteButtonElement(mediaElement));
     506    button->setType("button");
     507    return button.release();
     508}
     509
     510AtomicString MediaControlVolumeSliderMuteButtonElement::shadowPseudoId() const
     511{
     512    DEFINE_STATIC_LOCAL(AtomicString, muteButton, ("-webkit-media-controls-volume-slider-mute-button"));
     513    return muteButton;
     514}
     515
    531516// ----------------------------
    532517
    533518inline MediaControlPlayButtonElement::MediaControlPlayButtonElement(HTMLMediaElement* mediaElement)
    534     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_PLAY_BUTTON)
     519    : MediaControlInputElement(mediaElement, MediaPlayButton)
    535520{
    536521}
     
    557542}
    558543
    559 // ----------------------------
    560 
    561 inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, PseudoId pseudoId)
    562     : MediaControlInputElement(mediaElement, pseudoId)
     544AtomicString MediaControlPlayButtonElement::shadowPseudoId() const
     545{
     546    DEFINE_STATIC_LOCAL(AtomicString, playButton, ("-webkit-media-controls-play-button"));
     547    return playButton;
     548}
     549
     550// ----------------------------
     551
     552inline MediaControlSeekButtonElement::MediaControlSeekButtonElement(HTMLMediaElement* mediaElement, MediaControlElementType displayType)
     553    : MediaControlInputElement(mediaElement, displayType)
    563554    , m_seeking(false)
    564555    , m_capturing(false)
    565556    , m_seekTimer(this, &MediaControlSeekButtonElement::seekTimerFired)
    566557{
    567 }
    568 
    569 PassRefPtr<MediaControlSeekButtonElement> MediaControlSeekButtonElement::create(HTMLMediaElement* mediaElement, PseudoId pseudoStyleId)
    570 {
    571     RefPtr<MediaControlSeekButtonElement> button = adoptRef(new MediaControlSeekButtonElement(mediaElement, pseudoStyleId));
    572     button->setType("button");
    573     return button.release();
    574 }
    575 
    576 inline bool MediaControlSeekButtonElement::isForwardButton() const
    577 {
    578     return pseudoStyleId() == MEDIA_CONTROLS_SEEK_FORWARD_BUTTON;
    579558}
    580559
     
    628607// ----------------------------
    629608
     609inline MediaControlSeekForwardButtonElement::MediaControlSeekForwardButtonElement(HTMLMediaElement* mediaElement)
     610    : MediaControlSeekButtonElement(mediaElement, MediaSeekForwardButton)
     611{
     612}
     613
     614PassRefPtr<MediaControlSeekForwardButtonElement> MediaControlSeekForwardButtonElement::create(HTMLMediaElement* mediaElement)
     615{
     616    RefPtr<MediaControlSeekForwardButtonElement> button = adoptRef(new MediaControlSeekForwardButtonElement(mediaElement));
     617    button->setType("button");
     618    return button.release();
     619}
     620
     621AtomicString MediaControlSeekForwardButtonElement::shadowPseudoId() const
     622{
     623    DEFINE_STATIC_LOCAL(AtomicString, seekForwardButton, ("-webkit-media-controls-seek-forward-button"));
     624    return seekForwardButton;
     625}
     626
     627// ----------------------------
     628
     629inline MediaControlSeekBackButtonElement::MediaControlSeekBackButtonElement(HTMLMediaElement* mediaElement)
     630    : MediaControlSeekButtonElement(mediaElement, MediaSeekBackButton)
     631{
     632}
     633
     634PassRefPtr<MediaControlSeekBackButtonElement> MediaControlSeekBackButtonElement::create(HTMLMediaElement* mediaElement)
     635{
     636    RefPtr<MediaControlSeekBackButtonElement> button = adoptRef(new MediaControlSeekBackButtonElement(mediaElement));
     637    button->setType("button");
     638    return button.release();
     639}
     640
     641AtomicString MediaControlSeekBackButtonElement::shadowPseudoId() const
     642{
     643    DEFINE_STATIC_LOCAL(AtomicString, seekBackButton, ("-webkit-media-controls-seek-back-button"));
     644    return seekBackButton;
     645}
     646
     647// ----------------------------
     648
    630649inline MediaControlRewindButtonElement::MediaControlRewindButtonElement(HTMLMediaElement* element)
    631     : MediaControlInputElement(element, MEDIA_CONTROLS_REWIND_BUTTON)
     650    : MediaControlInputElement(element, MediaRewindButton)
    632651{
    633652}
     
    649668}
    650669
     670AtomicString MediaControlRewindButtonElement::shadowPseudoId() const
     671{
     672    DEFINE_STATIC_LOCAL(AtomicString, rewindButton, ("-webkit-media-controls-rewind-button"));
     673    return rewindButton;
     674}
     675
    651676// ----------------------------
    652677
    653678inline MediaControlReturnToRealtimeButtonElement::MediaControlReturnToRealtimeButtonElement(HTMLMediaElement* mediaElement)
    654     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_RETURN_TO_REALTIME_BUTTON)
     679    : MediaControlInputElement(mediaElement, MediaReturnToRealtimeButton)
    655680{
    656681}
     
    672697}
    673698
     699AtomicString MediaControlReturnToRealtimeButtonElement::shadowPseudoId() const
     700{
     701    DEFINE_STATIC_LOCAL(AtomicString, returnToRealtimeButton, ("-webkit-media-controls-return-to-realtime-button"));
     702    return returnToRealtimeButton;
     703}
    674704
    675705// ----------------------------
    676706
    677707inline MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsButtonElement(HTMLMediaElement* mediaElement)
    678     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TOGGLE_CLOSED_CAPTIONS_BUTTON)
     708    : MediaControlInputElement(mediaElement, MediaShowClosedCaptionsButton)
    679709{
    680710}
     
    702732}
    703733
     734AtomicString MediaControlToggleClosedCaptionsButtonElement::shadowPseudoId() const
     735{
     736    DEFINE_STATIC_LOCAL(AtomicString, closedCaptionsButton, ("-webkit-media-controls-toggle-closed-captions-button"));
     737    return closedCaptionsButton;
     738}
     739
    704740// ----------------------------
    705741
    706742MediaControlTimelineElement::MediaControlTimelineElement(HTMLMediaElement* mediaElement)
    707     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_TIMELINE)
     743    : MediaControlInputElement(mediaElement, MediaSlider)
    708744{
    709745}
     
    757793}
    758794
     795AtomicString MediaControlTimelineElement::shadowPseudoId() const
     796{
     797    DEFINE_STATIC_LOCAL(AtomicString, timelineSlider, ("-webkit-media-controls-timeline"));
     798    return timelineSlider;
     799}
     800
    759801// ----------------------------
    760802
    761803inline MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(HTMLMediaElement* mediaElement)
    762     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_VOLUME_SLIDER)
     804    : MediaControlInputElement(mediaElement, MediaVolumeSlider)
    763805{
    764806}
     
    801843}
    802844
     845AtomicString MediaControlVolumeSliderElement::shadowPseudoId() const
     846{
     847    DEFINE_STATIC_LOCAL(AtomicString, volumeSlider, ("-webkit-media-controls-volume-slider"));
     848    return volumeSlider;
     849}
     850
    803851// ----------------------------
    804852
    805853inline MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(HTMLMediaElement* mediaElement)
    806     : MediaControlInputElement(mediaElement, MEDIA_CONTROLS_FULLSCREEN_BUTTON)
     854    : MediaControlInputElement(mediaElement, MediaFullscreenButton)
    807855{
    808856}
     
    837885}
    838886
     887AtomicString MediaControlFullscreenButtonElement::shadowPseudoId() const
     888{
     889    DEFINE_STATIC_LOCAL(AtomicString, fullscreenButton, ("-webkit-media-controls-fullscreen-button"));
     890    return fullscreenButton;
     891}
     892
    839893// ----------------------------
    840894
  • trunk/Source/WebCore/rendering/MediaControlElements.h

    r73618 r76719  
    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 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 AtomicString shadowPseudoId() const;
     221};
     222
    212223
    213224// ----------------------------
     
    223234
    224235    virtual void updateDisplayType();
     236    virtual 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 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 AtomicString shadowPseudoId() const;
     283};
     284
    248285// ----------------------------
    249286
     
    256293private:
    257294    MediaControlRewindButtonElement(HTMLMediaElement*);
     295
     296    virtual AtomicString shadowPseudoId() const;
    258297};
    259298
     
    268307private:
    269308    MediaControlReturnToRealtimeButtonElement(HTMLMediaElement*);
     309
     310    virtual AtomicString shadowPseudoId() const;
    270311};   
    271312
     
    282323
    283324    virtual void updateDisplayType();
     325    virtual AtomicString shadowPseudoId() const;
    284326};   
    285327
     
    295337private:
    296338    MediaControlTimelineElement(HTMLMediaElement*);
     339
     340    virtual AtomicString shadowPseudoId() const;
    297341};
    298342
     
    308352private:
    309353    MediaControlVolumeSliderElement(HTMLMediaElement*);
     354
     355    virtual AtomicString shadowPseudoId() const;
    310356};
    311357
     
    320366private:
    321367    MediaControlFullscreenButtonElement(HTMLMediaElement*);
     368
     369    virtual AtomicString shadowPseudoId() const;
    322370};
    323371
  • trunk/Source/WebCore/rendering/RenderMedia.cpp

    r73385 r76719  
    191191{
    192192    ASSERT(!m_muteButton);
    193     m_muteButton = MediaControlMuteButtonElement::create(mediaElement(), MediaControlMuteButtonElement::Controller);
     193    m_muteButton = MediaControlMuteButtonElement::create(mediaElement());
    194194    m_muteButton->attachToParent(m_panel.get());
    195195}
     
    205205{
    206206    ASSERT(!m_seekBackButton);
    207     m_seekBackButton = MediaControlSeekButtonElement::create(mediaElement(), MEDIA_CONTROLS_SEEK_BACK_BUTTON);
     207    m_seekBackButton = MediaControlSeekBackButtonElement::create(mediaElement());
    208208    m_seekBackButton->attachToParent(m_panel.get());
    209209}
     
    212212{
    213213    ASSERT(!m_seekForwardButton);
    214     m_seekForwardButton = MediaControlSeekButtonElement::create(mediaElement(), MEDIA_CONTROLS_SEEK_FORWARD_BUTTON);
     214    m_seekForwardButton = MediaControlSeekForwardButtonElement::create(mediaElement());
    215215    m_seekForwardButton->attachToParent(m_panel.get());
    216216}
     
    279279{
    280280    ASSERT(!m_volumeSliderMuteButton);
    281     m_volumeSliderMuteButton = MediaControlMuteButtonElement::create(mediaElement(), MediaControlMuteButtonElement::VolumeSlider);
     281    m_volumeSliderMuteButton = MediaControlVolumeSliderMuteButtonElement::create(mediaElement());
    282282    m_volumeSliderMuteButton->attachToParent(m_volumeSliderContainer.get());
    283283   
  • trunk/Source/WebCore/rendering/style/RenderStyleConstants.h

    r75543 r76719  
    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.