| 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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 if (event->type() == EventTypeNames::mousemove) { | 760 if (event->type() == EventTypeNames::mousemove) { |
| 761 // When we get a mouse move, show the media controls, and start a timer | 761 // 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. | 762 // that will hide the media controls after a 3 seconds without a mouse move. |
| 763 makeOpaque(); | 763 makeOpaque(); |
| 764 if (shouldHideMediaControls(IgnoreVideoHover)) | 764 if (shouldHideMediaControls(IgnoreVideoHover)) |
| 765 startHideMediaControlsTimer(); | 765 startHideMediaControlsTimer(); |
| 766 return; | 766 return; |
| 767 } | 767 } |
| 768 |
| 769 // If the user is interacting with the controls via the keyboard, don't hide |
| 770 // the controls. This will fire when the user tabs between controls (focusin) |
| 771 // or when they seek either the timeline or volume sliders (input). |
| 772 if (event->type() == EventTypeNames::focusin || |
| 773 event->type() == EventTypeNames::input) |
| 774 resetHideMediaControlsTimer(); |
| 768 } | 775 } |
| 769 | 776 |
| 770 void MediaControlsImpl::hideMediaControlsTimerFired(TimerBase*) { | 777 void MediaControlsImpl::hideMediaControlsTimerFired(TimerBase*) { |
| 771 unsigned behaviorFlags = | 778 unsigned behaviorFlags = |
| 772 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; | 779 m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; |
| 773 m_hideTimerBehaviorFlags = IgnoreNone; | 780 m_hideTimerBehaviorFlags = IgnoreNone; |
| 774 m_keepShowingUntilTimerFires = false; | 781 m_keepShowingUntilTimerFires = false; |
| 775 | 782 |
| 776 if (mediaElement().paused()) | 783 if (mediaElement().paused()) |
| 777 return; | 784 return; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 stopHideMediaControlsTimer(); | 912 stopHideMediaControlsTimer(); |
| 906 startHideMediaControlsTimer(); | 913 startHideMediaControlsTimer(); |
| 907 } | 914 } |
| 908 | 915 |
| 909 void MediaControlsImpl::onExitedFullscreen() { | 916 void MediaControlsImpl::onExitedFullscreen() { |
| 910 m_fullscreenButton->setIsFullscreen(false); | 917 m_fullscreenButton->setIsFullscreen(false); |
| 911 stopHideMediaControlsTimer(); | 918 stopHideMediaControlsTimer(); |
| 912 startHideMediaControlsTimer(); | 919 startHideMediaControlsTimer(); |
| 913 } | 920 } |
| 914 | 921 |
| 922 void MediaControlsImpl::onPanelKeypress() { |
| 923 // If the user is interacting with the controls via the keyboard, don't hide |
| 924 // the controls. This is called when the user mutes/unmutes, turns CC on/off, |
| 925 // etc. |
| 926 resetHideMediaControlsTimer(); |
| 927 } |
| 928 |
| 915 void MediaControlsImpl::notifyElementSizeChanged(ClientRect* newSize) { | 929 void MediaControlsImpl::notifyElementSizeChanged(ClientRect* newSize) { |
| 916 // Note that this code permits a bad frame on resize, since it is | 930 // Note that this code permits a bad frame on resize, since it is |
| 917 // run after the relayout / paint happens. It would be great to improve | 931 // run after the relayout / paint happens. It would be great to improve |
| 918 // this, but it would be even greater to move this code entirely to | 932 // this, but it would be even greater to move this code entirely to |
| 919 // JS and fix it there. | 933 // JS and fix it there. |
| 920 | 934 |
| 921 IntSize oldSize = m_size; | 935 IntSize oldSize = m_size; |
| 922 m_size.setWidth(newSize->width()); | 936 m_size.setWidth(newSize->width()); |
| 923 m_size.setHeight(newSize->height()); | 937 m_size.setHeight(newSize->height()); |
| 924 | 938 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 visitor->trace(m_castButton); | 1133 visitor->trace(m_castButton); |
| 1120 visitor->trace(m_overlayCastButton); | 1134 visitor->trace(m_overlayCastButton); |
| 1121 visitor->trace(m_mediaEventListener); | 1135 visitor->trace(m_mediaEventListener); |
| 1122 visitor->trace(m_windowEventListener); | 1136 visitor->trace(m_windowEventListener); |
| 1123 visitor->trace(m_orientationLockDelegate); | 1137 visitor->trace(m_orientationLockDelegate); |
| 1124 MediaControls::trace(visitor); | 1138 MediaControls::trace(visitor); |
| 1125 HTMLDivElement::trace(visitor); | 1139 HTMLDivElement::trace(visitor); |
| 1126 } | 1140 } |
| 1127 | 1141 |
| 1128 } // namespace blink | 1142 } // namespace blink |
| OLD | NEW |