| Index: Source/core/html/shadow/MediaControlElements.cpp
|
| diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
|
| index 9a184f89efd4b4c5a0acac0047e90323cfed540a..a9dbcc7d45e5123a8d982bfbca159f26f9936a7b 100644
|
| --- a/Source/core/html/shadow/MediaControlElements.cpp
|
| +++ b/Source/core/html/shadow/MediaControlElements.cpp
|
| @@ -210,6 +210,18 @@ const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const
|
| return id;
|
| }
|
|
|
| +void* MediaControlOverlayEnclosureElement::preDispatchEventHandler(Event* event)
|
| +{
|
| + // When the media element is clicked or touched we want to make the overlay cast button visible
|
| + // (if the other requirements are right) even if JavaScript is doing its own handling of the event.
|
| + // Doing it in preDispatchEventHandler prevents any interference from JavaScript.
|
| + // Note that we can't simply test for click, since JS handling of touch events can prevent their translation to click events.
|
| + if (event && (event->type() == EventTypeNames::click || event->type() == EventTypeNames::touchstart) && mediaElement().hasRemoteRoutes() && !mediaElement().shouldShowControls())
|
| + mediaControls().showOverlayCastButton();
|
| + return MediaControlDivElement::preDispatchEventHandler(event);
|
| +}
|
| +
|
| +
|
| // ----------------------------
|
|
|
| MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& mediaControls)
|
| @@ -552,6 +564,50 @@ void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen)
|
|
|
| // ----------------------------
|
|
|
| +MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& mediaControls, bool isOverlayButton)
|
| + : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayButton(isOverlayButton)
|
| +{
|
| +}
|
| +
|
| +PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElement::create(MediaControls& mediaControls, bool isOverlayButton)
|
| +{
|
| + RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeRefCountedGarbageCollected(new MediaControlCastButtonElement(mediaControls, isOverlayButton));
|
| + button->ensureUserAgentShadowRoot();
|
| + button->setType("button");
|
| + return button.release();
|
| +}
|
| +
|
| +void MediaControlCastButtonElement::defaultEventHandler(Event* event)
|
| +{
|
| + if (event->type() == EventTypeNames::click) {
|
| + if (mediaElement().isPlayingRemotely()) {
|
| + mediaElement().requestRemotePlaybackControl();
|
| + } else {
|
| + mediaElement().requestRemotePlayback();
|
| + }
|
| + }
|
| + HTMLInputElement::defaultEventHandler(event);
|
| +}
|
| +
|
| +const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const
|
| +{
|
| + DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, ("-internal-media-controls-cast-button", AtomicString::ConstructFromLiteral));
|
| + DEFINE_STATIC_LOCAL(AtomicString, id_overlay, ("-internal-media-controls-overlay-cast-button", AtomicString::ConstructFromLiteral));
|
| + return m_isOverlayButton ? id_overlay : id_nonOverlay;
|
| +}
|
| +
|
| +void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely)
|
| +{
|
| + setDisplayType(isPlayingRemotely ? MediaCastOnButton : MediaCastOffButton);
|
| +}
|
| +
|
| +bool MediaControlCastButtonElement::keepEventInNode(Event* event)
|
| +{
|
| + return isUserInteractionEvent(event);
|
| +}
|
| +
|
| +// ----------------------------
|
| +
|
| MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement(MediaControls& mediaControls)
|
| : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay)
|
| {
|
|
|