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

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

Issue 658173002: Reposition cast button on narrow videos (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: trivial editorial change Created 6 years, 2 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 | « LayoutTests/media/controls-cast-button-narrow.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControls.cpp
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index 0ce4e6e0fca708465e7e1203aed7b1382617dcba..f7163b2c6d82a56110a4ac8005991e8348a793a7 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -28,6 +28,7 @@
#include "core/html/shadow/MediaControls.h"
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
+#include "core/dom/ClientRect.h"
#include "core/events/MouseEvent.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLMediaElement.h"
@@ -380,6 +381,11 @@ void MediaControls::refreshCastButtonVisibility()
} else if (mediaElement().shouldShowControls()) {
m_overlayCastButton->hide();
m_castButton->show();
+ // Check that the cast button actually fits on the bar.
+ if (m_fullScreenButton->getBoundingClientRect()->right() > m_panel->getBoundingClientRect()->right()) {
+ m_castButton->hide();
+ m_overlayCastButton->show();
+ }
}
} else {
m_castButton->hide();
@@ -449,6 +455,7 @@ void MediaControls::defaultEventHandler(Event* event)
// When we get a mouse move, show the media controls, and start a timer
// that will hide the media controls after a 3 seconds without a mouse move.
makeOpaque();
+ refreshCastButtonVisibility();
if (shouldHideMediaControls(IgnoreVideoHover))
startHideMediaControlsTimer();
return;
« no previous file with comments | « LayoutTests/media/controls-cast-button-narrow.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698