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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 | 76 |
77 // Return the internal elements, which is used by registering clicking | 77 // Return the internal elements, which is used by registering clicking |
78 // EventHandlers from MediaControlsWindowEventListener. | 78 // EventHandlers from MediaControlsWindowEventListener. |
79 MediaControlPanelElement* panelElement() { return m_panel; } | 79 MediaControlPanelElement* panelElement() { return m_panel; } |
80 MediaControlTimelineElement* timelineElement() { return m_timeline; } | 80 MediaControlTimelineElement* timelineElement() { return m_timeline; } |
81 MediaControlCastButtonElement* castButtonElement() { return m_castButton; } | 81 MediaControlCastButtonElement* castButtonElement() { return m_castButton; } |
82 MediaControlVolumeSliderElement* volumeSliderElement() { | 82 MediaControlVolumeSliderElement* volumeSliderElement() { |
83 return m_volumeSlider; | 83 return m_volumeSlider; |
84 } | 84 } |
85 | 85 |
86 // Notify us that our controls enclosure has changed width. | |
87 void notifyPanelWidthChanged(const LayoutUnit& newWidth); | |
88 | |
89 // Notify us that the media element's network state has changed. | 86 // Notify us that the media element's network state has changed. |
90 void networkStateChanged(); | 87 void networkStateChanged(); |
91 | 88 |
92 void toggleOverflowMenu(); | 89 void toggleOverflowMenu(); |
93 | 90 |
94 bool overflowMenuVisible(); | 91 bool overflowMenuVisible(); |
95 | 92 |
96 // TODO(mlamouri): this is temporary to notify the controls that an | 93 // TODO(mlamouri): this is temporary to notify the controls that an |
97 // HTMLTrackElement failed to load because there is no web exposed way to | 94 // HTMLTrackElement failed to load because there is no web exposed way to |
98 // be notified on the TextTrack object. See https://crbug.com/669977 | 95 // be notified on the TextTrack object. See https://crbug.com/669977 |
(...skipping 20 matching lines...) Expand all Loading... | |
119 | 116 |
120 DECLARE_VIRTUAL_TRACE(); | 117 DECLARE_VIRTUAL_TRACE(); |
121 | 118 |
122 private: | 119 private: |
123 friend class MediaControlsMediaEventListener; | 120 friend class MediaControlsMediaEventListener; |
124 friend class MediaControlsOrientationLockDelegateTest; | 121 friend class MediaControlsOrientationLockDelegateTest; |
125 friend class MediaControlsTest; | 122 friend class MediaControlsTest; |
126 | 123 |
127 void invalidate(Element*); | 124 void invalidate(Element*); |
128 | 125 |
126 // Need to be members of MediaControls for private member access. | |
129 class BatchedControlUpdate; | 127 class BatchedControlUpdate; |
128 class MediaControlsResizeObserverCallback; | |
129 | |
130 // Notify us that our controls enclosure has changed size. | |
131 void notifyElementSizeChanged(ClientRect* newSize); | |
130 | 132 |
131 explicit MediaControls(HTMLMediaElement&); | 133 explicit MediaControls(HTMLMediaElement&); |
132 | 134 |
133 void initializeControls(); | 135 void initializeControls(); |
134 | 136 |
135 void makeOpaque(); | 137 void makeOpaque(); |
136 void makeTransparent(); | 138 void makeTransparent(); |
137 | 139 |
138 void updatePlayState(); | 140 void updatePlayState(); |
139 | 141 |
140 enum HideBehaviorFlags { | 142 enum HideBehaviorFlags { |
141 IgnoreNone = 0, | 143 IgnoreNone = 0, |
142 IgnoreVideoHover = 1 << 0, | 144 IgnoreVideoHover = 1 << 0, |
143 IgnoreFocus = 1 << 1, | 145 IgnoreFocus = 1 << 1, |
144 IgnoreControlsHover = 1 << 2, | 146 IgnoreControlsHover = 1 << 2, |
145 IgnoreWaitForTimer = 1 << 3, | 147 IgnoreWaitForTimer = 1 << 3, |
146 }; | 148 }; |
147 | 149 |
148 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; | 150 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; |
149 void hideMediaControlsTimerFired(TimerBase*); | 151 void hideMediaControlsTimerFired(TimerBase*); |
150 void startHideMediaControlsTimer(); | 152 void startHideMediaControlsTimer(); |
151 void stopHideMediaControlsTimer(); | 153 void stopHideMediaControlsTimer(); |
152 void resetHideMediaControlsTimer(); | 154 void resetHideMediaControlsTimer(); |
153 | 155 |
154 void panelWidthChangedTimerFired(TimerBase*); | 156 void elementSizeChangedTimerFired(TimerBase*); |
155 | 157 |
156 void hideAllMenus(); | 158 void hideAllMenus(); |
157 | 159 |
158 // Hide elements that don't fit, and show those things that we want which | 160 // Hide elements that don't fit, and show those things that we want which |
159 // do fit. This requires that m_panelWidth is current. | 161 // do fit. This requires that m_effectiveWidth and m_effectiveHeight are |
162 // current. | |
160 void computeWhichControlsFit(); | 163 void computeWhichControlsFit(); |
161 | 164 |
162 // Node | 165 // Node |
163 bool isMediaControls() const override { return true; } | 166 bool isMediaControls() const override { return true; } |
164 bool willRespondToMouseMoveEvents() override { return true; } | 167 bool willRespondToMouseMoveEvents() override { return true; } |
165 void defaultEventHandler(Event*) override; | 168 void defaultEventHandler(Event*) override; |
166 bool containsRelatedTarget(Event*); | 169 bool containsRelatedTarget(Event*); |
167 | 170 |
168 // Methods called by MediaControlsMediaEventListener. | 171 // Methods called by MediaControlsMediaEventListener. |
169 void onVolumeChange(); | 172 void onVolumeChange(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 | 213 |
211 Member<MediaControlsMediaEventListener> m_mediaEventListener; | 214 Member<MediaControlsMediaEventListener> m_mediaEventListener; |
212 Member<MediaControlsWindowEventListener> m_windowEventListener; | 215 Member<MediaControlsWindowEventListener> m_windowEventListener; |
213 Member<MediaControlsOrientationLockDelegate> m_orientationLockDelegate; | 216 Member<MediaControlsOrientationLockDelegate> m_orientationLockDelegate; |
214 | 217 |
215 TaskRunnerTimer<MediaControls> m_hideMediaControlsTimer; | 218 TaskRunnerTimer<MediaControls> m_hideMediaControlsTimer; |
216 unsigned m_hideTimerBehaviorFlags; | 219 unsigned m_hideTimerBehaviorFlags; |
217 bool m_isMouseOverControls : 1; | 220 bool m_isMouseOverControls : 1; |
218 bool m_isPausedForScrubbing : 1; | 221 bool m_isPausedForScrubbing : 1; |
219 | 222 |
220 TaskRunnerTimer<MediaControls> m_panelWidthChangedTimer; | 223 // Watches the video element for resize and updates media controls as |
221 int m_panelWidth; | 224 // necessary. |
225 Member<ResizeObserver> m_resizeObserver; | |
atotic
2017/03/01 20:27:35
I am not an Oilpan expert, but I think we might ha
| |
226 | |
227 TaskRunnerTimer<MediaControls> m_elementSizeChangedTimer; | |
228 int m_effectiveWidth; | |
229 int m_effectiveHeight; | |
mlamouri (slow - plz ping)
2017/02/28 16:03:14
I still think that `IntSize m_size;` would actuall
steimel
2017/03/01 15:58:31
Done.
| |
222 | 230 |
223 bool m_keepShowingUntilTimerFires : 1; | 231 bool m_keepShowingUntilTimerFires : 1; |
224 }; | 232 }; |
225 | 233 |
226 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); | 234 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); |
227 | 235 |
228 } // namespace blink | 236 } // namespace blink |
229 | 237 |
230 #endif | 238 #endif |
OLD | NEW |