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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 1948363004: Use media controls play button's width rather than hard-coded 48px. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crbug585078_playbutton
Patch Set: rebased. Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index 6594d6178deb9fd634add9ea3297449f708822f6..bd95d98353e658cdb3c1f3a8f19b80ccb1a2c971 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
@@ -700,9 +700,15 @@ void MediaControls::computeWhichControlsFit()
};
int usedWidth = 0;
- // Assume that all controls require 48px. Ideally, we could get this from
- // the computed style, but that requires the controls to be shown.
- const int minimumWidth = 48;
+
+ // Assume that all controls require 48px, unless we can get the computed
+ // style for the play button. Since the play button is always shown, it
+ // should be available the first time we're called after layout. This will
+ // also be the first time we have m_panelWidth!=0, so it won't matter if
+ // we get this wrong before that.
+ int minimumWidth = (m_playButton->layoutObject() && m_playButton->layoutObject()->style())
+ ? m_playButton->layoutObject()->style()->width().pixels()
+ : 48;
// Special-case the play button; it always fits.
if (m_playButton->isWanted()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698