Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Fullscreen.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/dom/Fullscreen.cpp |
| index 380a2438ffe881ba7375f8c08e19fd17fdf73dae..c519ff0a046d09596d340d2841d03a3aea2ccfc0 100644 |
| --- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp |
| @@ -29,6 +29,7 @@ |
| #include "core/dom/Fullscreen.h" |
| +#include "bindings/core/v8/ConditionalFeatures.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ElementTraversal.h" |
| #include "core/dom/StyleEngine.h" |
| @@ -308,6 +309,18 @@ void Fullscreen::requestFullscreen(Element& element, |
| return; |
| do { |
| + Frame* frame = document.frame(); |
|
foolip
2016/11/28 23:33:22
Making this part of fullscreenSupported should red
lunalu1
2016/12/01 20:10:07
Done.
|
| + DCHECK(frame->isLocalFrame()); |
| + if (!isFeatureEnabledInFrame(blink::kFullscreenFeature, |
| + toLocalFrame(frame))) { |
| + if (RuntimeEnabledFeatures::featurePolicyEnabled()) { |
| + document.addConsoleMessage(ConsoleMessage::create( |
| + JSMessageSource, WarningMessageLevel, |
| + "Fullscreen API is not enabled in feature policy for this frame")); |
|
foolip
2016/11/28 23:33:22
Is this the wording used for other features? "Full
lunalu1
2016/12/01 20:10:07
Done.
|
| + break; |
| + } |
| + } |
| + |
| // 1. If any of the following conditions are false, then terminate these |
| // steps and queue a task to fire an event named fullscreenerror with its |
| // bubbles attribute set to true on the context object's node document: |
| @@ -542,11 +555,24 @@ void Fullscreen::exitFullscreen(Document& document) { |
| // https://fullscreen.spec.whatwg.org/#dom-document-fullscreenenabled |
| bool Fullscreen::fullscreenEnabled(Document& document) { |
| + Frame* frame = document.frame(); |
| + if (!isFeatureEnabledInFrame(blink::kFullscreenFeature, |
| + toLocalFrame(frame))) { |
| + if (RuntimeEnabledFeatures::featurePolicyEnabled()) { |
| + document.addConsoleMessage(ConsoleMessage::create( |
| + JSMessageSource, WarningMessageLevel, |
| + "Fullscreen API is not enabled in feature policy for this frame")); |
| + return false; |
| + } |
| + } |
| + |
| // The fullscreenEnabled attribute's getter must return true if the context |
| // object is allowed to use the feature indicated by attribute name |
| // allowfullscreen and fullscreen is supported, and false otherwise. |
| - return allowedToUseFullscreen(document.frame()) && |
| - fullscreenIsSupported(document); |
| + if (!fullscreenIsSupported(document)) |
| + return false; |
| + |
| + return allowedToUseFullscreen(frame); |
| } |
| void Fullscreen::didEnterFullscreenForElement(Element* element) { |