OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 { | 203 { |
204 return adoptRefWillBeNoop(new MediaControlOverlayEnclosureElement(mediaContr ols)); | 204 return adoptRefWillBeNoop(new MediaControlOverlayEnclosureElement(mediaContr ols)); |
205 } | 205 } |
206 | 206 |
207 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const | 207 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const |
208 { | 208 { |
209 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo sure", AtomicString::ConstructFromLiteral)); | 209 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo sure", AtomicString::ConstructFromLiteral)); |
210 return id; | 210 return id; |
211 } | 211 } |
212 | 212 |
213 void* MediaControlOverlayEnclosureElement::preDispatchEventHandler(Event* event) | |
214 { | |
215 // When the media element is touched we want to make the overlay cast button visible | |
216 // (if the other requirements are right) even if JavaScript is doing its own handling of the event. | |
217 // Doing it in preDispatchEventHandler prevents any interference from JavaSc ript. | |
218 if (event && (event->type() == EventTypeNames::click || event->type() == Eve ntTypeNames::touchstart) && mediaElement().hasRemoteRoutes() && !mediaElement(). shouldShowControls()) | |
abarth-chromium
2014/09/11 16:42:54
Why click and touchstart? Isn't click enough?
aberent
2014/09/11 17:08:31
If the JS has a touchstart handler, as on style.co
| |
219 mediaControls().showOverlayCastButton(); | |
220 return MediaControlDivElement::preDispatchEventHandler(event); | |
221 } | |
222 | |
223 | |
213 // ---------------------------- | 224 // ---------------------------- |
214 | 225 |
215 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi aControls) | 226 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi aControls) |
216 : MediaControlInputElement(mediaControls, MediaMuteButton) | 227 : MediaControlInputElement(mediaControls, MediaMuteButton) |
217 { | 228 { |
218 } | 229 } |
219 | 230 |
220 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem ent::create(MediaControls& mediaControls) | 231 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem ent::create(MediaControls& mediaControls) |
221 { | 232 { |
222 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo p(new MediaControlMuteButtonElement(mediaControls)); | 233 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo p(new MediaControlMuteButtonElement(mediaControls)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 return id; | 556 return id; |
546 } | 557 } |
547 | 558 |
548 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) | 559 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) |
549 { | 560 { |
550 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton); | 561 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton); |
551 } | 562 } |
552 | 563 |
553 // ---------------------------- | 564 // ---------------------------- |
554 | 565 |
566 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi aControls, bool isOverlayButton) | |
567 : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayBut ton(isOverlayButton) | |
568 { | |
569 } | |
570 | |
571 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem ent::create(MediaControls& mediaControls, bool isOverlayButton) | |
572 { | |
573 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeRef CountedGarbageCollected(new MediaControlCastButtonElement(mediaControls, isOverl ayButton)); | |
574 button->ensureUserAgentShadowRoot(); | |
575 button->setType("button"); | |
576 return button.release(); | |
577 } | |
578 | |
579 void MediaControlCastButtonElement::defaultEventHandler(Event* event) | |
580 { | |
581 if (event->type() == EventTypeNames::click) { | |
582 if (mediaElement().isPlayingRemotely()) { | |
583 mediaElement().requestRemotePlaybackControl(); | |
584 } else { | |
585 mediaElement().requestRemotePlayback(); | |
586 } | |
587 } | |
588 HTMLInputElement::defaultEventHandler(event); | |
589 } | |
590 | |
591 const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const | |
592 { | |
593 DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, ("-internal-media-controls- cast-button", AtomicString::ConstructFromLiteral)); | |
594 DEFINE_STATIC_LOCAL(AtomicString, id_overlay, ("-internal-media-controls-ove rlay-cast-button", AtomicString::ConstructFromLiteral)); | |
595 return m_isOverlayButton ? id_overlay : id_nonOverlay; | |
596 } | |
597 | |
598 void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely) | |
599 { | |
600 setDisplayType(isPlayingRemotely ? MediaCastOnButton : MediaCastOffButton); | |
601 } | |
602 | |
603 bool MediaControlCastButtonElement::keepEventInNode(Event* event) | |
604 { | |
605 return isUserInteractionEvent(event); | |
606 } | |
607 | |
608 // ---------------------------- | |
609 | |
555 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement (MediaControls& mediaControls) | 610 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement (MediaControls& mediaControls) |
556 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) | 611 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) |
557 { | 612 { |
558 } | 613 } |
559 | 614 |
560 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls) | 615 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls) |
561 { | 616 { |
562 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC ontrols)); | 617 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC ontrols)); |
563 } | 618 } |
564 | 619 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
714 float fontSize = smallestDimension * 0.05f; | 769 float fontSize = smallestDimension * 0.05f; |
715 if (fontSize != m_fontSize) { | 770 if (fontSize != m_fontSize) { |
716 m_fontSize = fontSize; | 771 m_fontSize = fontSize; |
717 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); | 772 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); |
718 } | 773 } |
719 } | 774 } |
720 | 775 |
721 // ---------------------------- | 776 // ---------------------------- |
722 | 777 |
723 } // namespace blink | 778 } // namespace blink |
OLD | NEW |