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

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: Fix compile warning for uninitialized variable 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
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..f3267fad8448bd0fe89bb208b7db21a53da98a2d 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"
@@ -176,6 +177,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 +192,12 @@ bool MediaControlsPainter::paintMediaOverlayPlayButton(
if (!box)
return false;
int mediaHeight = box->pixelSnappedHeight();
+ int mediaPanelHeight = 0;
+ if (panelElement)
+ mediaPanelHeight = panelElement->clientHeight();
mlamouri (slow - plz ping) 2017/03/08 19:13:04 I'm a huge fan of ternary operator and I would obv
steimel 2017/03/09 16:42:24 Done.
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);

Powered by Google App Engine
This is Rietveld 408576698