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

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: Refactor to use ResizeObserver 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. 86 // Notify us that our controls enclosure has changed size.
87 void notifyPanelWidthChanged(const LayoutUnit& newWidth); 87 void notifyPanelSizeChanged(int newWidth, int newHeight);
mlamouri (slow - plz ping) 2017/02/22 11:48:08 I guess the name needs to be updated?
steimel 2017/02/23 00:53:48 Done.
88 88
89 // Notify us that the media element's network state has changed. 89 // Notify us that the media element's network state has changed.
90 void networkStateChanged(); 90 void networkStateChanged();
91 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
(...skipping 16 matching lines...) Expand all
114 114
115 private: 115 private:
116 friend class MediaControlsMediaEventListener; 116 friend class MediaControlsMediaEventListener;
117 friend class MediaControlsOrientationLockDelegateTest; 117 friend class MediaControlsOrientationLockDelegateTest;
118 friend class MediaControlsTest; 118 friend class MediaControlsTest;
119 119
120 void invalidate(Element*); 120 void invalidate(Element*);
121 121
122 class BatchedControlUpdate; 122 class BatchedControlUpdate;
123 123
124 class MediaControlsResizeObserverCallback;
mlamouri (slow - plz ping) 2017/02/22 11:48:08 Do you need to have the class declared here?
steimel 2017/02/23 00:53:48 Discussed offline and leaving here since I'm chang
125 Member<ResizeObserver> m_resizeObserver;
126
124 explicit MediaControls(HTMLMediaElement&); 127 explicit MediaControls(HTMLMediaElement&);
125 128
126 void initializeControls(); 129 void initializeControls();
127 130
128 void makeOpaque(); 131 void makeOpaque();
129 void makeTransparent(); 132 void makeTransparent();
130 133
131 void updatePlayState(); 134 void updatePlayState();
132 135
133 enum HideBehaviorFlags { 136 enum HideBehaviorFlags {
134 IgnoreNone = 0, 137 IgnoreNone = 0,
135 IgnoreVideoHover = 1 << 0, 138 IgnoreVideoHover = 1 << 0,
136 IgnoreFocus = 1 << 1, 139 IgnoreFocus = 1 << 1,
137 IgnoreControlsHover = 1 << 2, 140 IgnoreControlsHover = 1 << 2,
138 IgnoreWaitForTimer = 1 << 3, 141 IgnoreWaitForTimer = 1 << 3,
139 }; 142 };
140 143
141 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; 144 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const;
142 void hideMediaControlsTimerFired(TimerBase*); 145 void hideMediaControlsTimerFired(TimerBase*);
143 void startHideMediaControlsTimer(); 146 void startHideMediaControlsTimer();
144 void stopHideMediaControlsTimer(); 147 void stopHideMediaControlsTimer();
145 void resetHideMediaControlsTimer(); 148 void resetHideMediaControlsTimer();
146 149
147 void panelWidthChangedTimerFired(TimerBase*); 150 void panelSizeChangedTimerFired(TimerBase*);
148 151
149 void hideAllMenus(); 152 void hideAllMenus();
150 153
151 // Hide elements that don't fit, and show those things that we want which 154 // Hide elements that don't fit, and show those things that we want which
152 // do fit. This requires that m_panelWidth is current. 155 // do fit. This requires that m_panelWidth is current.
153 void computeWhichControlsFit(); 156 void computeWhichControlsFit();
154 157
155 // Node 158 // Node
156 bool isMediaControls() const override { return true; } 159 bool isMediaControls() const override { return true; }
157 bool willRespondToMouseMoveEvents() override { return true; } 160 bool willRespondToMouseMoveEvents() override { return true; }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 206
204 Member<MediaControlsMediaEventListener> m_mediaEventListener; 207 Member<MediaControlsMediaEventListener> m_mediaEventListener;
205 Member<MediaControlsWindowEventListener> m_windowEventListener; 208 Member<MediaControlsWindowEventListener> m_windowEventListener;
206 Member<MediaControlsOrientationLockDelegate> m_orientationLockDelegate; 209 Member<MediaControlsOrientationLockDelegate> m_orientationLockDelegate;
207 210
208 TaskRunnerTimer<MediaControls> m_hideMediaControlsTimer; 211 TaskRunnerTimer<MediaControls> m_hideMediaControlsTimer;
209 unsigned m_hideTimerBehaviorFlags; 212 unsigned m_hideTimerBehaviorFlags;
210 bool m_isMouseOverControls : 1; 213 bool m_isMouseOverControls : 1;
211 bool m_isPausedForScrubbing : 1; 214 bool m_isPausedForScrubbing : 1;
212 215
213 TaskRunnerTimer<MediaControls> m_panelWidthChangedTimer; 216 TaskRunnerTimer<MediaControls> m_panelSizeChangedTimer;
214 int m_panelWidth; 217 int m_panelWidth;
218 int m_panelHeight;
215 219
216 bool m_keepShowingUntilTimerFires : 1; 220 bool m_keepShowingUntilTimerFires : 1;
217 }; 221 };
218 222
219 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); 223 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls());
220 224
221 } // namespace blink 225 } // namespace blink
222 226
223 #endif 227 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698