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

Unified Diff: third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp

Issue 2701433003: Hide overlay play button if it can't be shown without clipping (Closed)
Patch Set: Add comments for dependent constants Created 3 years, 9 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 | « third_party/WebKit/Source/core/layout/LayoutMedia.cpp ('k') | 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/paint/MediaControlsPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp b/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp
index ad84527ad8b9630f4f10859f763e861e6a135025..5d69ffe655861f1781dc423559320c34026f807f 100644
--- a/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/MediaControlsPainter.cpp
@@ -31,6 +31,7 @@
#include "core/html/HTMLMediaElement.h"
#include "core/html/TimeRanges.h"
#include "core/html/shadow/MediaControlElementTypes.h"
+#include "core/html/shadow/MediaControls.h"
#include "core/layout/LayoutBox.h"
#include "core/paint/PaintInfo.h"
#include "core/style/ComputedStyle.h"
@@ -50,7 +51,8 @@ static const int mediaSliderThumbTouchHeight = 48;
static const int mediaSliderThumbPaintWidth = 12; // Painted area.
static const int mediaSliderThumbPaintHeight = 12;
-// Overlay play button size.
+// Overlay play button size. If this changes, it must also be changed in
+// core/html/shadow/MediaControls.cpp.
static const int mediaOverlayPlayButtonWidth = 48;
static const int mediaOverlayPlayButtonHeight = 48;
@@ -176,6 +178,10 @@ bool MediaControlsPainter::paintMediaOverlayPlayButton(
if (!hasSource(mediaElement) || !mediaElement->paused())
return false;
+ MediaControlPanelElement* panelElement = nullptr;
+ if (mediaElement->mediaControls())
+ panelElement = mediaElement->mediaControls()->panelElement();
+
static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay");
IntRect buttonRect(rect);
@@ -187,9 +193,10 @@ bool MediaControlsPainter::paintMediaOverlayPlayButton(
if (!box)
return false;
int mediaHeight = box->pixelSnappedHeight();
+ int mediaPanelHeight = panelElement ? panelElement->clientHeight() : 0;
buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidth / 2);
buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeight / 2 +
- (mediaHeight - rect.height()) / 2);
+ (mediaHeight - rect.height() - mediaPanelHeight) / 2);
buttonRect.setWidth(mediaOverlayPlayButtonWidth);
buttonRect.setHeight(mediaOverlayPlayButtonHeight);
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMedia.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698