Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 #include "core/html/shadow/MediaControls.h" | 27 #include "core/html/shadow/MediaControls.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
| 30 #include "core/dom/ClientRect.h" | 30 #include "core/dom/ClientRect.h" |
| 31 #include "core/dom/Fullscreen.h" | 31 #include "core/dom/Fullscreen.h" |
| 32 #include "core/dom/ResizeObserver.h" | 32 #include "core/dom/ResizeObserver.h" |
| 33 #include "core/dom/ResizeObserverCallback.h" | 33 #include "core/dom/ResizeObserverCallback.h" |
| 34 #include "core/dom/ResizeObserverEntry.h" | 34 #include "core/dom/ResizeObserverEntry.h" |
| 35 #include "core/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
| 36 #include "core/events/KeyboardEvent.h" | |
| 36 #include "core/events/MouseEvent.h" | 37 #include "core/events/MouseEvent.h" |
| 37 #include "core/frame/Settings.h" | 38 #include "core/frame/Settings.h" |
| 38 #include "core/frame/UseCounter.h" | 39 #include "core/frame/UseCounter.h" |
| 39 #include "core/html/HTMLMediaElement.h" | 40 #include "core/html/HTMLMediaElement.h" |
| 40 #include "core/html/HTMLVideoElement.h" | 41 #include "core/html/HTMLVideoElement.h" |
| 41 #include "core/html/shadow/MediaControlsMediaEventListener.h" | 42 #include "core/html/shadow/MediaControlsMediaEventListener.h" |
| 42 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h" | 43 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h" |
| 43 #include "core/html/shadow/MediaControlsWindowEventListener.h" | 44 #include "core/html/shadow/MediaControlsWindowEventListener.h" |
| 44 #include "core/html/track/TextTrackContainer.h" | 45 #include "core/html/track/TextTrackContainer.h" |
| 45 #include "core/html/track/TextTrackList.h" | 46 #include "core/html/track/TextTrackList.h" |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 } | 745 } |
| 745 | 746 |
| 746 if (event->type() == EventTypeNames::mousemove) { | 747 if (event->type() == EventTypeNames::mousemove) { |
| 747 // When we get a mouse move, show the media controls, and start a timer | 748 // When we get a mouse move, show the media controls, and start a timer |
| 748 // that will hide the media controls after a 3 seconds without a mouse move. | 749 // that will hide the media controls after a 3 seconds without a mouse move. |
| 749 makeOpaque(); | 750 makeOpaque(); |
| 750 if (shouldHideMediaControls(IgnoreVideoHover)) | 751 if (shouldHideMediaControls(IgnoreVideoHover)) |
| 751 startHideMediaControlsTimer(); | 752 startHideMediaControlsTimer(); |
| 752 return; | 753 return; |
| 753 } | 754 } |
| 755 | |
| 756 if (event->isKeyboardEvent()) { | |
| 757 if (!mediaElement().paused()) { | |
| 758 makeOpaque(); | |
| 759 if (shouldHideMediaControls()) | |
| 760 startHideMediaControlsTimer(); | |
| 761 } | |
| 762 | |
| 763 int key = toKeyboardEvent(event)->keyCode(); | |
| 764 switch (key) { | |
| 765 case ('\r'): | |
| 766 case (' '): | |
| 767 m_playButton->defaultEventHandler(event); | |
| 768 return; | |
| 769 case (37): | |
| 770 case (39): | |
| 771 timelineElement()->defaultEventHandler(event); | |
| 772 onTimeUpdate(); | |
|
mlamouri (slow - plz ping)
2017/03/16 12:17:22
Shouldn't this be called automatically?
CJ
2017/03/16 20:08:28
Didn't seem to work without it. Will double check.
| |
| 773 return; | |
| 774 case (38): | |
| 775 case (40): | |
| 776 volumeSliderElement()->defaultEventHandler(event); | |
|
mlamouri (slow - plz ping)
2017/03/16 12:17:22
For the issue you mention, is onVolueChange called
CJ
2017/03/16 20:08:28
I tried that. Instead of refreshing the blue line
| |
| 777 return; | |
| 778 } | |
| 779 } | |
| 754 } | 780 } |
| 755 | 781 |
| 756 void MediaControls::hideMediaControlsTimerFired(TimerBase*) { | 782 void MediaControls::hideMediaControlsTimerFired(TimerBase*) { |
| 757 unsigned behaviorFlags = | 783 unsigned behaviorFlags = |
| 758 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; | 784 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; |
| 759 m_hideTimerBehaviorFlags = IgnoreNone; | 785 m_hideTimerBehaviorFlags = IgnoreNone; |
| 760 m_keepShowingUntilTimerFires = false; | 786 m_keepShowingUntilTimerFires = false; |
| 761 | 787 |
| 762 if (mediaElement().paused()) | 788 if (mediaElement().paused()) |
| 763 return; | 789 return; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 799 m_volumeSlider->setVolume(mediaElement().muted() ? 0 | 825 m_volumeSlider->setVolume(mediaElement().muted() ? 0 |
| 800 : mediaElement().volume()); | 826 : mediaElement().volume()); |
| 801 | 827 |
| 802 // Update visibility of volume controls. | 828 // Update visibility of volume controls. |
| 803 // TODO(mlamouri): it should not be part of the volumechange handling because | 829 // TODO(mlamouri): it should not be part of the volumechange handling because |
| 804 // it is using audio availability as input. | 830 // it is using audio availability as input. |
| 805 BatchedControlUpdate batch(this); | 831 BatchedControlUpdate batch(this); |
| 806 m_volumeSlider->setIsWanted(mediaElement().hasAudio() && | 832 m_volumeSlider->setIsWanted(mediaElement().hasAudio() && |
| 807 !preferHiddenVolumeControls(document())); | 833 !preferHiddenVolumeControls(document())); |
| 808 m_muteButton->setIsWanted(mediaElement().hasAudio()); | 834 m_muteButton->setIsWanted(mediaElement().hasAudio()); |
| 835 startHideMediaControlsTimer(); | |
|
mlamouri (slow - plz ping)
2017/03/16 12:17:22
Why are you hiding this?
CJ
2017/03/16 20:08:28
Not sure why that is there. Removing.
| |
| 809 } | 836 } |
| 810 | 837 |
| 811 void MediaControls::onFocusIn() { | 838 void MediaControls::onFocusIn() { |
| 812 if (!mediaElement().shouldShowControls()) | 839 if (!mediaElement().shouldShowControls()) |
| 813 return; | 840 return; |
| 814 | 841 |
| 815 show(); | 842 show(); |
| 816 resetHideMediaControlsTimer(); | 843 resetHideMediaControlsTimer(); |
| 817 } | 844 } |
| 818 | 845 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1100 visitor->trace(m_overflowList); | 1127 visitor->trace(m_overflowList); |
| 1101 visitor->trace(m_castButton); | 1128 visitor->trace(m_castButton); |
| 1102 visitor->trace(m_overlayCastButton); | 1129 visitor->trace(m_overlayCastButton); |
| 1103 visitor->trace(m_mediaEventListener); | 1130 visitor->trace(m_mediaEventListener); |
| 1104 visitor->trace(m_windowEventListener); | 1131 visitor->trace(m_windowEventListener); |
| 1105 visitor->trace(m_orientationLockDelegate); | 1132 visitor->trace(m_orientationLockDelegate); |
| 1106 HTMLDivElement::trace(visitor); | 1133 HTMLDivElement::trace(visitor); |
| 1107 } | 1134 } |
| 1108 | 1135 |
| 1109 } // namespace blink | 1136 } // namespace blink |
| OLD | NEW |