Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.h

Issue 2701433003: Hide overlay play button if it can't be shown without clipping (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
89 // Called by LayoutMedia.
90 void onLayout(int width, int height);
91
92 void toggleOverflowMenu(); 92 void toggleOverflowMenu();
93 93
94 bool overflowMenuVisible(); 94 bool overflowMenuVisible();
95 95
96 // TODO(mlamouri): this is temporary to notify the controls that an 96 // TODO(mlamouri): this is temporary to notify the controls that an
97 // HTMLTrackElement failed to load because there is no web exposed way to 97 // HTMLTrackElement failed to load because there is no web exposed way to
98 // be notified on the TextTrack object. See https://crbug.com/669977 98 // be notified on the TextTrack object. See https://crbug.com/669977
99 void onTrackElementFailedToLoad() { onTextTracksAddedOrRemoved(); } 99 void onTrackElementFailedToLoad() { onTextTracksAddedOrRemoved(); }
100 100
101 // TODO(mlamouri): the following methods will be able to become private when 101 // TODO(mlamouri): the following methods will be able to become private when
(...skipping 19 matching lines...) Expand all
121 121
122 private: 122 private:
123 friend class MediaControlsMediaEventListener; 123 friend class MediaControlsMediaEventListener;
124 friend class MediaControlsOrientationLockDelegateTest; 124 friend class MediaControlsOrientationLockDelegateTest;
125 friend class MediaControlsTest; 125 friend class MediaControlsTest;
126 126
127 void invalidate(Element*); 127 void invalidate(Element*);
128 128
129 class BatchedControlUpdate; 129 class BatchedControlUpdate;
130 130
131 // Notify us that our controls enclosure has changed size.
132 void notifyElementSizeChanged(int newWidth, int newHeight);
133 class MediaControlsResizeObserverCallback;
whywhat 2017/02/23 21:37:32 nits: - move the class declaration next to Batched
steimel 2017/02/24 00:42:44 Done.
134 Member<ResizeObserver> m_resizeObserver;
135 bool m_sizingInitialized = false;
136
131 explicit MediaControls(HTMLMediaElement&); 137 explicit MediaControls(HTMLMediaElement&);
132 138
133 void initializeControls(); 139 void initializeControls();
134 140
135 void makeOpaque(); 141 void makeOpaque();
136 void makeTransparent(); 142 void makeTransparent();
137 143
138 void updatePlayState(); 144 void updatePlayState();
139 145
140 enum HideBehaviorFlags { 146 enum HideBehaviorFlags {
141 IgnoreNone = 0, 147 IgnoreNone = 0,
142 IgnoreVideoHover = 1 << 0, 148 IgnoreVideoHover = 1 << 0,
143 IgnoreFocus = 1 << 1, 149 IgnoreFocus = 1 << 1,
144 IgnoreControlsHover = 1 << 2, 150 IgnoreControlsHover = 1 << 2,
145 IgnoreWaitForTimer = 1 << 3, 151 IgnoreWaitForTimer = 1 << 3,
146 }; 152 };
147 153
148 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; 154 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const;
149 void hideMediaControlsTimerFired(TimerBase*); 155 void hideMediaControlsTimerFired(TimerBase*);
150 void startHideMediaControlsTimer(); 156 void startHideMediaControlsTimer();
151 void stopHideMediaControlsTimer(); 157 void stopHideMediaControlsTimer();
152 void resetHideMediaControlsTimer(); 158 void resetHideMediaControlsTimer();
153 159
154 void panelWidthChangedTimerFired(TimerBase*); 160 void elementSizeChangedTimerFired(TimerBase*);
155 161
156 void hideAllMenus(); 162 void hideAllMenus();
157 163
158 // Hide elements that don't fit, and show those things that we want which 164 // Hide elements that don't fit, and show those things that we want which
159 // do fit. This requires that m_panelWidth is current. 165 // do fit. This requires that m_elementWidth and m_elementHeight are current.
160 void computeWhichControlsFit(); 166 void computeWhichControlsFit();
161 167
162 // Node 168 // Node
163 bool isMediaControls() const override { return true; } 169 bool isMediaControls() const override { return true; }
164 bool willRespondToMouseMoveEvents() override { return true; } 170 bool willRespondToMouseMoveEvents() override { return true; }
165 void defaultEventHandler(Event*) override; 171 void defaultEventHandler(Event*) override;
166 bool containsRelatedTarget(Event*); 172 bool containsRelatedTarget(Event*);
167 173
168 // Methods called by MediaControlsMediaEventListener. 174 // Methods called by MediaControlsMediaEventListener.
169 void onVolumeChange(); 175 void onVolumeChange();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 216
211 Member<MediaControlsMediaEventListener> m_mediaEventListener; 217 Member<MediaControlsMediaEventListener> m_mediaEventListener;
212 Member<MediaControlsWindowEventListener> m_windowEventListener; 218 Member<MediaControlsWindowEventListener> m_windowEventListener;
213 Member<MediaControlsOrientationLockDelegate> m_orientationLockDelegate; 219 Member<MediaControlsOrientationLockDelegate> m_orientationLockDelegate;
214 220
215 TaskRunnerTimer<MediaControls> m_hideMediaControlsTimer; 221 TaskRunnerTimer<MediaControls> m_hideMediaControlsTimer;
216 unsigned m_hideTimerBehaviorFlags; 222 unsigned m_hideTimerBehaviorFlags;
217 bool m_isMouseOverControls : 1; 223 bool m_isMouseOverControls : 1;
218 bool m_isPausedForScrubbing : 1; 224 bool m_isPausedForScrubbing : 1;
219 225
220 TaskRunnerTimer<MediaControls> m_panelWidthChangedTimer; 226 TaskRunnerTimer<MediaControls> m_elementSizeChangedTimer;
221 int m_panelWidth; 227 int m_elementWidth;
228 int m_elementHeight;
222 229
223 bool m_keepShowingUntilTimerFires : 1; 230 bool m_keepShowingUntilTimerFires : 1;
224 }; 231 };
225 232
226 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); 233 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls());
227 234
228 } // namespace blink 235 } // namespace blink
229 236
230 #endif 237 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698