Chromium Code Reviews| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 { | 210 { |
| 211 return adoptRefWillBeNoop(new MediaControlOverlayEnclosureElement(mediaContr ols)); | 211 return adoptRefWillBeNoop(new MediaControlOverlayEnclosureElement(mediaContr ols)); |
| 212 } | 212 } |
| 213 | 213 |
| 214 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const | 214 const AtomicString& MediaControlOverlayEnclosureElement::shadowPseudoId() const |
| 215 { | 215 { |
| 216 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo sure", AtomicString::ConstructFromLiteral)); | 216 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-enclo sure", AtomicString::ConstructFromLiteral)); |
| 217 return id; | 217 return id; |
| 218 } | 218 } |
| 219 | 219 |
| 220 void* MediaControlOverlayEnclosureElement::preDispatchEventHandler(Event* event) | |
| 221 { | |
| 222 if (event && (event->type() == EventTypeNames::click || event->type() == Eve ntTypeNames::touchstart)) { | |
| 223 // When the media element is touched we want to make the controls visibl e even if JavaScript is doing its own handling of the event. | |
| 224 // Doing it in preDispatchEventHandler prevents any interference from Ja vaScript. | |
|
acolwell GONE FROM CHROMIUM
2014/08/05 19:36:34
This behavior won't prevent user controls from rec
aberent
2014/08/22 14:08:34
This particular code simply makes the overlay cast
| |
| 225 mediaControls().mediaElementFocused(); | |
| 226 } | |
| 227 return MediaControlDivElement::preDispatchEventHandler(event); | |
| 228 } | |
| 229 | |
| 230 | |
| 220 // ---------------------------- | 231 // ---------------------------- |
| 221 | 232 |
| 222 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi aControls) | 233 MediaControlMuteButtonElement::MediaControlMuteButtonElement(MediaControls& medi aControls) |
| 223 : MediaControlInputElement(mediaControls, MediaMuteButton) | 234 : MediaControlInputElement(mediaControls, MediaMuteButton) |
| 224 { | 235 { |
| 225 } | 236 } |
| 226 | 237 |
| 227 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem ent::create(MediaControls& mediaControls) | 238 PassRefPtrWillBeRawPtr<MediaControlMuteButtonElement> MediaControlMuteButtonElem ent::create(MediaControls& mediaControls) |
| 228 { | 239 { |
| 229 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo p(new MediaControlMuteButtonElement(mediaControls)); | 240 RefPtrWillBeRawPtr<MediaControlMuteButtonElement> button = adoptRefWillBeNoo p(new MediaControlMuteButtonElement(mediaControls)); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 return id; | 563 return id; |
| 553 } | 564 } |
| 554 | 565 |
| 555 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) | 566 void MediaControlFullscreenButtonElement::setIsFullscreen(bool isFullscreen) |
| 556 { | 567 { |
| 557 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton); | 568 setDisplayType(isFullscreen ? MediaExitFullscreenButton : MediaEnterFullscre enButton); |
| 558 } | 569 } |
| 559 | 570 |
| 560 // ---------------------------- | 571 // ---------------------------- |
| 561 | 572 |
| 573 MediaControlCastButtonElement::MediaControlCastButtonElement(MediaControls& medi aControls) | |
| 574 : MediaControlInputElement(mediaControls, MediaCastOnButton) | |
| 575 { | |
| 576 } | |
| 577 | |
| 578 PassRefPtrWillBeRawPtr<MediaControlCastButtonElement> MediaControlCastButtonElem ent::create(MediaControls& mediaControls) | |
| 579 { | |
| 580 RefPtrWillBeRawPtr<MediaControlCastButtonElement> button = adoptRefWillBeRef CountedGarbageCollected(new MediaControlCastButtonElement(mediaControls)); | |
| 581 button->ensureUserAgentShadowRoot(); | |
| 582 button->setType("button"); | |
| 583 return button.release(); | |
| 584 } | |
| 585 | |
| 586 void MediaControlCastButtonElement::defaultEventHandler(Event* event) | |
| 587 { | |
| 588 if (event->type() == EventTypeNames::click) { | |
| 589 if (mediaElement().isCasting()) { | |
| 590 mediaElement().requestRemotePlaybackControl(); | |
| 591 } else { | |
| 592 mediaElement().requestRemotePlayback(); | |
| 593 } | |
| 594 } | |
| 595 HTMLInputElement::defaultEventHandler(event); | |
| 596 } | |
| 597 | |
| 598 const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const | |
| 599 { | |
| 600 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-cast-button", AtomicString::ConstructFromLiteral)); | |
| 601 return id; | |
| 602 } | |
| 603 | |
| 604 void MediaControlCastButtonElement::setIsCasting(bool isCasting) | |
| 605 { | |
| 606 setDisplayType(isCasting ? MediaCastOnButton : MediaCastOffButton); | |
| 607 } | |
| 608 | |
| 609 // ---------------------------- | |
| 610 | |
| 611 MediaControlOverlayCastButtonElement::MediaControlOverlayCastButtonElement(Media Controls& mediaControls) | |
| 612 : MediaControlInputElement(mediaControls, MediaCastOnButton) | |
| 613 { | |
| 614 hide(); | |
| 615 } | |
| 616 | |
| 617 PassRefPtrWillBeRawPtr<MediaControlOverlayCastButtonElement> MediaControlOverlay CastButtonElement::create(MediaControls& mediaControls) | |
| 618 { | |
| 619 RefPtrWillBeRawPtr<MediaControlOverlayCastButtonElement> button = adoptRefWi llBeRefCountedGarbageCollected(new MediaControlOverlayCastButtonElement(mediaCon trols)); | |
| 620 button->ensureUserAgentShadowRoot(); | |
| 621 button->setType("button"); | |
| 622 return button.release(); | |
| 623 } | |
| 624 | |
| 625 void MediaControlOverlayCastButtonElement::defaultEventHandler(Event* event) | |
|
acolwell GONE FROM CHROMIUM
2014/08/05 19:36:34
Why do we need 2 classes here? The code looks iden
aberent
2014/08/22 14:08:34
Done.
| |
| 626 { | |
| 627 if (event->type() == EventTypeNames::click) { | |
| 628 if (mediaElement().isCasting()) { | |
|
acolwell GONE FROM CHROMIUM
2014/08/05 19:36:34
Shouldn't there be a mediaElement().hasRemoteRoute
aberent
2014/08/22 14:08:34
The logic is such that the cast button can never b
| |
| 629 mediaElement().requestRemotePlaybackControl(); | |
| 630 } else { | |
| 631 mediaElement().requestRemotePlayback(); | |
| 632 } | |
| 633 } | |
| 634 HTMLInputElement::defaultEventHandler(event); | |
| 635 } | |
| 636 | |
| 637 const AtomicString& MediaControlOverlayCastButtonElement::shadowPseudoId() const | |
| 638 { | |
| 639 DEFINE_STATIC_LOCAL(AtomicString, id, ("-webkit-media-controls-overlay-cast- button", AtomicString::ConstructFromLiteral)); | |
| 640 return id; | |
| 641 } | |
| 642 | |
| 643 void MediaControlOverlayCastButtonElement::setIsCasting(bool isCasting) | |
| 644 { | |
| 645 setDisplayType(isCasting ? MediaOverlayCastOnButton : MediaOverlayCastOffBut ton); | |
| 646 } | |
| 647 | |
| 648 bool MediaControlOverlayCastButtonElement::keepEventInNode(Event* event) | |
| 649 { | |
| 650 return isUserInteractionEvent(event); | |
| 651 } | |
| 652 | |
| 653 // ---------------------------- | |
| 654 | |
| 562 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement (MediaControls& mediaControls) | 655 MediaControlTimeRemainingDisplayElement::MediaControlTimeRemainingDisplayElement (MediaControls& mediaControls) |
| 563 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) | 656 : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) |
| 564 { | 657 { |
| 565 } | 658 } |
| 566 | 659 |
| 567 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls) | 660 PassRefPtrWillBeRawPtr<MediaControlTimeRemainingDisplayElement> MediaControlTime RemainingDisplayElement::create(MediaControls& mediaControls) |
| 568 { | 661 { |
| 569 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC ontrols)); | 662 return adoptRefWillBeNoop(new MediaControlTimeRemainingDisplayElement(mediaC ontrols)); |
| 570 } | 663 } |
| 571 | 664 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 721 float fontSize = smallestDimension * 0.05f; | 814 float fontSize = smallestDimension * 0.05f; |
| 722 if (fontSize != m_fontSize) { | 815 if (fontSize != m_fontSize) { |
| 723 m_fontSize = fontSize; | 816 m_fontSize = fontSize; |
| 724 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); | 817 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue: :CSS_PX); |
| 725 } | 818 } |
| 726 } | 819 } |
| 727 | 820 |
| 728 // ---------------------------- | 821 // ---------------------------- |
| 729 | 822 |
| 730 } // namespace blink | 823 } // namespace blink |
| OLD | NEW |