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

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

Issue 1240573005: Make video.webkitSupportsFullscreen an alias of document.fullscreenEnabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move comments to assert descriptions Created 5 years, 5 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 | « Source/core/html/HTMLVideoElement.idl ('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 17d1096113fffeb9acbde1c6aaa10e83a405b48e..152a02d58e87681884076aab6f36aa7e9f1dac22 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -29,6 +29,7 @@
#include "bindings/core/v8/ExceptionStatePlaceholder.h"
#include "core/dom/ClientRect.h"
+#include "core/dom/Fullscreen.h"
#include "core/events/MouseEvent.h"
#include "core/frame/Settings.h"
#include "core/html/HTMLMediaElement.h"
@@ -42,9 +43,23 @@ namespace blink {
// LayoutTests/media/media-controls.js.
static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3;
-static bool fullscreenIsSupported(const Document& document)
+static bool shouldShowFullscreenButton(const HTMLMediaElement& mediaElement)
{
- return !document.settings() || document.settings()->fullscreenSupported();
+ // Unconditionally allow the user to exit fullscreen if we are in it
+ // now. Especially on android, when we might not yet know if
+ // fullscreen is supported, we sometimes guess incorrectly and show
+ // the button earlier, and we don't want to remove it here if the
+ // user chose to enter fullscreen. crbug.com/500732 .
+ if (mediaElement.isFullscreen())
+ return true;
+
+ if (!mediaElement.hasVideo())
+ return false;
+
+ if (!Fullscreen::fullscreenEnabled(mediaElement.document()))
+ return false;
+
+ return true;
}
MediaControls::MediaControls(HTMLMediaElement& mediaElement)
@@ -184,13 +199,7 @@ void MediaControls::reset()
refreshClosedCaptionsButtonVisibility();
- // Unconditionally allow the user to exit fullscreen if we are in it
- // now. Especially on android, when we might not yet know if
- // fullscreen is supported, we sometimes guess incorrectly and show
- // the button earlier, and we don't want to remove it here if the
- // user chose to enter fullscreen. crbug.com/500732 .
- if ((mediaElement().hasVideo() && fullscreenIsSupported(document()))
- || mediaElement().isFullscreen())
+ if (shouldShowFullscreenButton(mediaElement()))
m_fullScreenButton->show();
else
m_fullScreenButton->hide();
« no previous file with comments | « Source/core/html/HTMLVideoElement.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698