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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
744 } | 744 } |
745 | 745 |
746 if (event->type() == EventTypeNames::mousemove) { | 746 if (event->type() == EventTypeNames::mousemove) { |
747 // When we get a mouse move, show the media controls, and start a timer | 747 // 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. | 748 // that will hide the media controls after a 3 seconds without a mouse move. |
749 makeOpaque(); | 749 makeOpaque(); |
750 if (shouldHideMediaControls(IgnoreVideoHover)) | 750 if (shouldHideMediaControls(IgnoreVideoHover)) |
751 startHideMediaControlsTimer(); | 751 startHideMediaControlsTimer(); |
752 return; | 752 return; |
753 } | 753 } |
754 | |
755 // If the user is interacting with the controls via the keyboard, don't hide | |
756 // the controls. This will fire when the user tabs between controls (focusin) | |
757 // or when they seek either the timeline or volume sliders (input). | |
758 if (event->type() == EventTypeNames::focusin || | |
759 event->type() == EventTypeNames::input) | |
760 resetHideMediaControlsTimer(); | |
754 } | 761 } |
755 | 762 |
756 void MediaControls::hideMediaControlsTimerFired(TimerBase*) { | 763 void MediaControls::hideMediaControlsTimerFired(TimerBase*) { |
757 unsigned behaviorFlags = | 764 unsigned behaviorFlags = |
758 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; | 765 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; |
759 m_hideTimerBehaviorFlags = IgnoreNone; | 766 m_hideTimerBehaviorFlags = IgnoreNone; |
760 m_keepShowingUntilTimerFires = false; | 767 m_keepShowingUntilTimerFires = false; |
761 | 768 |
762 if (mediaElement().paused()) | 769 if (mediaElement().paused()) |
763 return; | 770 return; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 stopHideMediaControlsTimer(); | 894 stopHideMediaControlsTimer(); |
888 startHideMediaControlsTimer(); | 895 startHideMediaControlsTimer(); |
889 } | 896 } |
890 | 897 |
891 void MediaControls::onExitedFullscreen() { | 898 void MediaControls::onExitedFullscreen() { |
892 m_fullscreenButton->setIsFullscreen(false); | 899 m_fullscreenButton->setIsFullscreen(false); |
893 stopHideMediaControlsTimer(); | 900 stopHideMediaControlsTimer(); |
894 startHideMediaControlsTimer(); | 901 startHideMediaControlsTimer(); |
895 } | 902 } |
896 | 903 |
904 void MediaControls::onPanelKeypress() { | |
905 // If the user is interacting with the controls via the keyboard, don't hide | |
906 // the controls. This is called when the user mutes/unmutes, turns CC on/off, | |
907 // etc. | |
908 resetHideMediaControlsTimer(); | |
johnme
2017/03/30 17:21:41
It seems that `resetHideMediaControlsTimer` will s
steimel
2017/04/05 23:38:21
Discussed offline with mlamouri@. It will be looke
| |
909 } | |
910 | |
897 void MediaControls::notifyElementSizeChanged(ClientRect* newSize) { | 911 void MediaControls::notifyElementSizeChanged(ClientRect* newSize) { |
898 // Note that this code permits a bad frame on resize, since it is | 912 // Note that this code permits a bad frame on resize, since it is |
899 // run after the relayout / paint happens. It would be great to improve | 913 // run after the relayout / paint happens. It would be great to improve |
900 // this, but it would be even greater to move this code entirely to | 914 // this, but it would be even greater to move this code entirely to |
901 // JS and fix it there. | 915 // JS and fix it there. |
902 | 916 |
903 IntSize oldSize = m_size; | 917 IntSize oldSize = m_size; |
904 m_size.setWidth(newSize->width()); | 918 m_size.setWidth(newSize->width()); |
905 m_size.setHeight(newSize->height()); | 919 m_size.setHeight(newSize->height()); |
906 | 920 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1100 visitor->trace(m_overflowList); | 1114 visitor->trace(m_overflowList); |
1101 visitor->trace(m_castButton); | 1115 visitor->trace(m_castButton); |
1102 visitor->trace(m_overlayCastButton); | 1116 visitor->trace(m_overlayCastButton); |
1103 visitor->trace(m_mediaEventListener); | 1117 visitor->trace(m_mediaEventListener); |
1104 visitor->trace(m_windowEventListener); | 1118 visitor->trace(m_windowEventListener); |
1105 visitor->trace(m_orientationLockDelegate); | 1119 visitor->trace(m_orientationLockDelegate); |
1106 HTMLDivElement::trace(visitor); | 1120 HTMLDivElement::trace(visitor); |
1107 } | 1121 } |
1108 | 1122 |
1109 } // namespace blink | 1123 } // namespace blink |
OLD | NEW |