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 "modules/media_controls/MediaControlsImpl.h" | 27 #include "modules/media_controls/MediaControlsImpl.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/media/HTMLMediaElementControlsList.h" | 42 #include "core/html/media/HTMLMediaElementControlsList.h" |
42 #include "core/html/shadow/MediaControlsMediaEventListener.h" | 43 #include "core/html/shadow/MediaControlsMediaEventListener.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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
758 } | 759 } |
759 | 760 |
760 if (event->type() == EventTypeNames::mousemove) { | 761 if (event->type() == EventTypeNames::mousemove) { |
761 // When we get a mouse move, show the media controls, and start a timer | 762 // When we get a mouse move, show the media controls, and start a timer |
762 // that will hide the media controls after a 3 seconds without a mouse move. | 763 // that will hide the media controls after a 3 seconds without a mouse move. |
763 makeOpaque(); | 764 makeOpaque(); |
764 if (shouldHideMediaControls(IgnoreVideoHover)) | 765 if (shouldHideMediaControls(IgnoreVideoHover)) |
765 startHideMediaControlsTimer(); | 766 startHideMediaControlsTimer(); |
766 return; | 767 return; |
767 } | 768 } |
769 | |
770 if (event->type() == EventTypeNames::input) { | |
771 resetHideMediaControlsTimer(); | |
772 } | |
mlamouri (slow - plz ping)
2017/04/10 13:14:02
I think steimel@'s CL doing this has landed.
CJ
2017/04/12 23:21:05
Done.
CJ
2017/04/12 23:21:05
Done.
| |
773 | |
774 if (event->isKeyboardEvent()) { | |
775 const String& key = toKeyboardEvent(event)->key(); | |
776 if (key == "Enter" || toKeyboardEvent(event)->keyCode() == ' ') { | |
777 m_playButton->onMediaKeyboardEvent(event); | |
778 return; | |
779 } | |
780 if (key == "ArrowLeft" || key == "ArrowRight" || key == "Home" || | |
781 key == "End") { | |
782 timelineElement()->onMediaKeyboardEvent(event); | |
mlamouri (slow - plz ping)
2017/04/10 13:14:02
nit: use the member directly
CJ
2017/04/12 23:21:05
Done.
| |
783 return; | |
784 } | |
785 if (key == "ArrowDown" || key == "ArrowUp") { | |
786 volumeSliderElement()->onMediaKeyboardEvent(event); | |
mlamouri (slow - plz ping)
2017/04/10 13:14:02
ditto
CJ
2017/04/12 23:21:05
Done.
| |
787 return; | |
788 } | |
789 } | |
768 } | 790 } |
769 | 791 |
770 void MediaControlsImpl::hideMediaControlsTimerFired(TimerBase*) { | 792 void MediaControlsImpl::hideMediaControlsTimerFired(TimerBase*) { |
771 unsigned behaviorFlags = | 793 unsigned behaviorFlags = |
772 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; | 794 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; |
773 m_hideTimerBehaviorFlags = IgnoreNone; | 795 m_hideTimerBehaviorFlags = IgnoreNone; |
774 m_keepShowingUntilTimerFires = false; | 796 m_keepShowingUntilTimerFires = false; |
775 | 797 |
776 if (mediaElement().paused()) | 798 if (mediaElement().paused()) |
777 return; | 799 return; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1115 visitor->trace(m_castButton); | 1137 visitor->trace(m_castButton); |
1116 visitor->trace(m_overlayCastButton); | 1138 visitor->trace(m_overlayCastButton); |
1117 visitor->trace(m_mediaEventListener); | 1139 visitor->trace(m_mediaEventListener); |
1118 visitor->trace(m_windowEventListener); | 1140 visitor->trace(m_windowEventListener); |
1119 visitor->trace(m_orientationLockDelegate); | 1141 visitor->trace(m_orientationLockDelegate); |
1120 MediaControls::trace(visitor); | 1142 MediaControls::trace(visitor); |
1121 HTMLDivElement::trace(visitor); | 1143 HTMLDivElement::trace(visitor); |
1122 } | 1144 } |
1123 | 1145 |
1124 } // namespace blink | 1146 } // namespace blink |
OLD | NEW |