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

Unified 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: Add delay to layout test to allow ResizeObserver to run 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/shadow/MediaControls.h
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.h b/third_party/WebKit/Source/core/html/shadow/MediaControls.h
index 74805310d50a486754080001c24d9494b9eecfb0..8e8199946bd84aa79ec8bdcc9c95c0b62966db93 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.h
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.h
@@ -83,12 +83,12 @@ class CORE_EXPORT MediaControls final : public HTMLDivElement {
return m_volumeSlider;
}
- // Notify us that our controls enclosure has changed width.
- void notifyPanelWidthChanged(const LayoutUnit& newWidth);
-
// Notify us that the media element's network state has changed.
void networkStateChanged();
+ // Called by LayoutMedia.
+ void onLayout(int width, int height);
+
void toggleOverflowMenu();
bool overflowMenuVisible();
@@ -126,7 +126,12 @@ class CORE_EXPORT MediaControls final : public HTMLDivElement {
void invalidate(Element*);
+ // Need to be members of MediaControls for private member access.
class BatchedControlUpdate;
+ class MediaControlsResizeObserverCallback;
+
+ // Notify us that our controls enclosure has changed size.
+ void notifyElementSizeChanged(int newWidth, int newHeight);
explicit MediaControls(HTMLMediaElement&);
@@ -151,12 +156,13 @@ class CORE_EXPORT MediaControls final : public HTMLDivElement {
void stopHideMediaControlsTimer();
void resetHideMediaControlsTimer();
- void panelWidthChangedTimerFired(TimerBase*);
+ void elementSizeChangedTimerFired(TimerBase*);
void hideAllMenus();
// Hide elements that don't fit, and show those things that we want which
- // do fit. This requires that m_panelWidth is current.
+ // do fit. This requires that m_effectiveWidth and m_effectiveHeight are
+ // current.
void computeWhichControlsFit();
// Node
@@ -217,8 +223,18 @@ class CORE_EXPORT MediaControls final : public HTMLDivElement {
bool m_isMouseOverControls : 1;
bool m_isPausedForScrubbing : 1;
- TaskRunnerTimer<MediaControls> m_panelWidthChangedTimer;
- int m_panelWidth;
+ // Watches the video element for resize and updates media controls as
+ // necessary.
+ Member<ResizeObserver> m_resizeObserver;
+
+ // Indicates whether |m_effectiveWidth|/|m_effectiveHeight| have been set via
+ // notifyElementSizeChanged yet. Used to decide whether or not to do so on a
+ // layout.
+ bool m_sizingInitialized : 1;
+
+ TaskRunnerTimer<MediaControls> m_elementSizeChangedTimer;
+ int m_effectiveWidth;
+ int m_effectiveHeight;
mlamouri (slow - plz ping) 2017/02/27 18:22:58 Could you use IntSize from platform/geometry/?
steimel 2017/02/28 00:59:47 Given the way they're used in computeWhichControls
bool m_keepShowingUntilTimerFires : 1;
};

Powered by Google App Engine
This is Rietveld 408576698