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

Unified Diff: Source/core/dom/FullscreenElementStack.cpp

Issue 426593010: Set fullscreenEnabled to false when fullscreen is not supported. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase against tot Created 6 years, 4 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/fullscreen/full-screen-not-enabled-when-unsupported-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/FullscreenElementStack.cpp
diff --git a/Source/core/dom/FullscreenElementStack.cpp b/Source/core/dom/FullscreenElementStack.cpp
index bff981a9522f57b1152bf5a61f572fb766926e2b..1e90d92b3cd4f5e9ee6201d0cdcf689628398cae 100644
--- a/Source/core/dom/FullscreenElementStack.cpp
+++ b/Source/core/dom/FullscreenElementStack.cpp
@@ -57,6 +57,20 @@ static bool fullscreenIsAllowedForAllOwners(const Document& document)
return true;
}
+static bool fullscreenIsSupported(const Document& document)
+{
+ // Fullscreen is supported if there is no previously-established user preference,
+ // security risk, or platform limitation.
+ return document.settings()->fullscreenSupported();
+}
+
+static bool fullscreenIsSupported(const Document& document, const Element& element)
+{
+ if (document.settings()->disallowFullscreenForNonMediaElements() && !isHTMLMediaElement(element))
+ return false;
+ return fullscreenIsSupported(document);
+}
+
static PassRefPtrWillBeRawPtr<Event> createEvent(const AtomicString& type, EventTarget& target)
{
RefPtrWillBeRawPtr<Event> event = Event::createBubble(type);
@@ -213,10 +227,8 @@ void FullscreenElementStack::requestFullScreenForElement(Element& element, Reque
if (!UserGestureIndicator::processingUserGesture())
break;
- // There is a previously-established user preference, security risk, or platform limitation.
- if (!document()->settings()->fullscreenSupported())
- break;
- if (document()->settings()->disallowFullscreenForNonMediaElements() && !isHTMLMediaElement(element))
+ // Fullscreen is not supported.
+ if (!fullscreenIsSupported(element.document(), element))
break;
// 2. Let doc be element's node document. (i.e. "this")
@@ -377,11 +389,11 @@ void FullscreenElementStack::exitFullscreen()
bool FullscreenElementStack::fullscreenEnabled(Document& document)
{
- // 4. The fullscreenEnabled attribute must return true if the context object and all ancestor
- // browsing context's documents have their fullscreen enabled flag set, or false otherwise.
+ // 4. The fullscreenEnabled attribute must return true if the context object has its
+ // fullscreen enabled flag set and fullscreen is supported, and false otherwise.
// Top-level browsing contexts are implied to have their allowFullScreen attribute set.
- return fullscreenIsAllowedForAllOwners(document);
+ return fullscreenIsAllowedForAllOwners(document) && fullscreenIsSupported(document);
}
void FullscreenElementStack::willEnterFullScreenForElement(Element* element)
« no previous file with comments | « LayoutTests/fullscreen/full-screen-not-enabled-when-unsupported-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698