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 clicked or 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 // Note that we can't simply test for click, since JS handling of touch even
ts can prevent their translation to click events. |
| 219 if (event && (event->type() == EventTypeNames::click || event->type() == Eve
ntTypeNames::touchstart) && mediaElement().hasRemoteRoutes() && !mediaElement().
shouldShowControls()) |
| 220 mediaControls().showOverlayCastButton(); |
| 221 return MediaControlDivElement::preDispatchEventHandler(event); |
| 222 } |
| 223 |
| 224 |
213 // ---------------------------- | 225 // ---------------------------- |
214 | 226 |
215 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi
aControls) | 227 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi
aControls) |
216 : MediaControlInputElement(mediaControls, MediaMuteButton) | 228 : MediaControlInputElement(mediaControls, MediaMuteButton) |
217 { | 229 { |
218 } | 230 } |
219 | 231 |
220 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem
ent::create(MediaControls& mediaControls) | 232 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem
ent::create(MediaControls& mediaControls) |
221 { | 233 { |
222 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo
p(new MediaControlMuteButtonElement(mediaControls)); | 234 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo
p(new MediaControlMuteButtonElement(mediaControls)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 return id; | 557 return id; |
546 } | 558 } |
547 | 559 |
548 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) | 560 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) |
549 { | 561 { |
550 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre
enButton); | 562 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre
enButton); |
551 } | 563 } |
552 | 564 |
553 // ---------------------------- | 565 // ---------------------------- |
554 | 566 |
| 567 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi
aControls, bool isOverlayButton) |
| 568 : MediaControlInputElement(mediaControls, MediaCastOnButton), m_isOverlayBut
ton(isOverlayButton) |
| 569 { |
| 570 } |
| 571 |
| 572 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem
ent::create(MediaControls& mediaControls, bool isOverlayButton) |
| 573 { |
| 574 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeRef
CountedGarbageCollected(new MediaControlCastButtonElement(mediaControls, isOverl
ayButton)); |
| 575 button->ensureUserAgentShadowRoot(); |
| 576 button->setType("button"); |
| 577 return button.release(); |
| 578 } |
| 579 |
| 580 void MediaControlCastButtonElement::defaultEventHandler(Event* event) |
| 581 { |
| 582 if (event->type() == EventTypeNames::click) { |
| 583 if (mediaElement().isPlayingRemotely()) { |
| 584 mediaElement().requestRemotePlaybackControl(); |
| 585 } else { |
| 586 mediaElement().requestRemotePlayback(); |
| 587 } |
| 588 } |
| 589 HTMLInputElement::defaultEventHandler(event); |
| 590 } |
| 591 |
| 592 const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const |
| 593 { |
| 594 DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, ("-internal-media-controls-
cast-button", AtomicString::ConstructFromLiteral)); |
| 595 DEFINE_STATIC_LOCAL(AtomicString, id_overlay, ("-internal-media-controls-ove
rlay-cast-button", AtomicString::ConstructFromLiteral)); |
| 596 return m_isOverlayButton ? id_overlay : id_nonOverlay; |
| 597 } |
| 598 |
| 599 void MediaControlCastButtonElement::setIsPlayingRemotely(bool isPlayingRemotely) |
| 600 { |
| 601 setDisplayType(isPlayingRemotely ? MediaCastOnButton : MediaCastOffButton); |
| 602 } |
| 603 |
| 604 bool MediaControlCastButtonElement::keepEventInNode(Event* event) |
| 605 { |
| 606 return isUserInteractionEvent(event); |
| 607 } |
| 608 |
| 609 // ---------------------------- |
| 610 |
555 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement
(MediaControls& mediaControls) | 611 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement
(MediaControls& mediaControls) |
556 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) | 612 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) |
557 { | 613 { |
558 } | 614 } |
559 | 615 |
560 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime
RemainingDisplayElement::create(MediaControls& mediaControls) | 616 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime
RemainingDisplayElement::create(MediaControls& mediaControls) |
561 { | 617 { |
562 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC
ontrols)); | 618 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC
ontrols)); |
563 } | 619 } |
564 | 620 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 float fontSize = smallestDimension * 0.05f; | 770 float fontSize = smallestDimension * 0.05f; |
715 if (fontSize != m_fontSize) { | 771 if (fontSize != m_fontSize) { |
716 m_fontSize = fontSize; | 772 m_fontSize = fontSize; |
717 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 773 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
718 } | 774 } |
719 } | 775 } |
720 | 776 |
721 // ---------------------------- | 777 // ---------------------------- |
722 | 778 |
723 } // namespace blink | 779 } // namespace blink |
OLD | NEW |