Chromium Code Reviews| Index: Source/core/dom/FullscreenElementStack.cpp |
| diff --git a/Source/core/dom/FullscreenElementStack.cpp b/Source/core/dom/FullscreenElementStack.cpp |
| index 1530559fc02298b96cbcd3b9dd8943a63141472a..6321318bd44e88498e43f652b0bed6b5757c7f57 100644 |
| --- a/Source/core/dom/FullscreenElementStack.cpp |
| +++ b/Source/core/dom/FullscreenElementStack.cpp |
| @@ -57,6 +57,15 @@ static bool fullscreenIsAllowedForAllOwners(const Document& document) |
| return true; |
| } |
| +static bool fullscreenIsSupported(const Document& document, const Element* element) |
|
philipj_slow
2014/08/04 09:24:13
I think this would be slightly nicer with separate
Ignacio Solla
2014/08/04 11:43:33
Done.
|
| +{ |
| + // Fullscreen is supported if there is no previously-established user preference, |
| + // security risk, or platform limitation. |
| + if (element && document.settings()->disallowFullscreenForNonMediaElements() && !isHTMLMediaElement(*element)) |
| + return false; |
| + return document.settings()->fullscreenEnabled(); |
| +} |
| + |
| static PassRefPtrWillBeRawPtr<Event> createEvent(const AtomicString& type, EventTarget& target) |
| { |
| RefPtrWillBeRawPtr<Event> event = Event::createBubble(type); |
| @@ -213,10 +222,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()->fullscreenEnabled()) |
| - 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 +384,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, 0); |
| } |
| void FullscreenElementStack::willEnterFullScreenForElement(Element* element) |