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/track/TextTrackContainer.h" | 43 #include "core/html/track/TextTrackContainer.h" |
43 #include "core/html/track/TextTrackList.h" | 44 #include "core/html/track/TextTrackList.h" |
44 #include "core/layout/LayoutObject.h" | 45 #include "core/layout/LayoutObject.h" |
45 #include "core/layout/LayoutTheme.h" | 46 #include "core/layout/LayoutTheme.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 StartHideMediaControlsTimer(); | 760 StartHideMediaControlsTimer(); |
760 return; | 761 return; |
761 } | 762 } |
762 | 763 |
763 // If the user is interacting with the controls via the keyboard, don't hide | 764 // If the user is interacting with the controls via the keyboard, don't hide |
764 // the controls. This will fire when the user tabs between controls (focusin) | 765 // the controls. This will fire when the user tabs between controls (focusin) |
765 // or when they seek either the timeline or volume sliders (input). | 766 // or when they seek either the timeline or volume sliders (input). |
766 if (event->type() == EventTypeNames::focusin || | 767 if (event->type() == EventTypeNames::focusin || |
767 event->type() == EventTypeNames::input) | 768 event->type() == EventTypeNames::input) |
768 ResetHideMediaControlsTimer(); | 769 ResetHideMediaControlsTimer(); |
770 | |
771 if (event->IsKeyboardEvent()) { | |
mlamouri (slow - plz ping)
2017/05/09 17:32:10
I realised the other day (not sure why I was think
lethalantidote
2017/05/18 00:03:34
Done.
| |
772 const String& key = ToKeyboardEvent(event)->key(); | |
773 if (key == "Enter" || ToKeyboardEvent(event)->keyCode() == ' ') { | |
774 play_button_->OnMediaKeyboardEvent(event); | |
775 return; | |
776 } | |
777 if (key == "ArrowLeft" || key == "ArrowRight" || key == "Home" || | |
778 key == "End") { | |
779 timeline_->OnMediaKeyboardEvent(event); | |
780 return; | |
781 } | |
782 if (key == "ArrowDown" || key == "ArrowUp") { | |
783 volume_slider_->OnMediaKeyboardEvent(event); | |
784 return; | |
785 } | |
786 } | |
769 } | 787 } |
770 | 788 |
771 void MediaControlsImpl::HideMediaControlsTimerFired(TimerBase*) { | 789 void MediaControlsImpl::HideMediaControlsTimerFired(TimerBase*) { |
772 unsigned behavior_flags = | 790 unsigned behavior_flags = |
773 hide_timer_behavior_flags_ | kIgnoreFocus | kIgnoreVideoHover; | 791 hide_timer_behavior_flags_ | kIgnoreFocus | kIgnoreVideoHover; |
774 hide_timer_behavior_flags_ = kIgnoreNone; | 792 hide_timer_behavior_flags_ = kIgnoreNone; |
775 keep_showing_until_timer_fires_ = false; | 793 keep_showing_until_timer_fires_ = false; |
776 | 794 |
777 if (MediaElement().paused()) | 795 if (MediaElement().paused()) |
778 return; | 796 return; |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1129 visitor->Trace(cast_button_); | 1147 visitor->Trace(cast_button_); |
1130 visitor->Trace(overlay_cast_button_); | 1148 visitor->Trace(overlay_cast_button_); |
1131 visitor->Trace(media_event_listener_); | 1149 visitor->Trace(media_event_listener_); |
1132 visitor->Trace(window_event_listener_); | 1150 visitor->Trace(window_event_listener_); |
1133 visitor->Trace(orientation_lock_delegate_); | 1151 visitor->Trace(orientation_lock_delegate_); |
1134 MediaControls::Trace(visitor); | 1152 MediaControls::Trace(visitor); |
1135 HTMLDivElement::Trace(visitor); | 1153 HTMLDivElement::Trace(visitor); |
1136 } | 1154 } |
1137 | 1155 |
1138 } // namespace blink | 1156 } // namespace blink |
OLD | NEW |