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

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2499373002: Implementation for feature policy - fullscreen (Closed)
Patch Set: Modified layout tests Created 4 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 11 matching lines...) Expand all
22 * 22 *
23 * You should have received a copy of the GNU Library General Public License 23 * You should have received a copy of the GNU Library General Public License
24 * along with this library; see the file COPYING.LIB. If not, write to 24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA. 26 * Boston, MA 02110-1301, USA.
27 * 27 *
28 */ 28 */
29 29
30 #include "core/dom/Fullscreen.h" 30 #include "core/dom/Fullscreen.h"
31 31
32 #include "bindings/core/v8/ConditionalFeatures.h"
32 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
33 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
34 #include "core/dom/StyleEngine.h" 35 #include "core/dom/StyleEngine.h"
35 #include "core/events/Event.h" 36 #include "core/events/Event.h"
36 #include "core/frame/FrameHost.h" 37 #include "core/frame/FrameHost.h"
37 #include "core/frame/HostsUsingFeatures.h" 38 #include "core/frame/HostsUsingFeatures.h"
38 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 40 #include "core/frame/Settings.h"
40 #include "core/frame/UseCounter.h" 41 #include "core/frame/UseCounter.h"
41 #include "core/html/HTMLIFrameElement.h" 42 #include "core/html/HTMLIFrameElement.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // Ignore this request if the document is not in a live frame. 302 // Ignore this request if the document is not in a live frame.
302 if (!document.isActive()) 303 if (!document.isActive())
303 return; 304 return;
304 305
305 // If |element| is on top of |doc|'s fullscreen element stack, terminate these 306 // If |element| is on top of |doc|'s fullscreen element stack, terminate these
306 // substeps. 307 // substeps.
307 if (&element == fullscreenElementFrom(document)) 308 if (&element == fullscreenElementFrom(document))
308 return; 309 return;
309 310
310 do { 311 do {
312 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.
313 DCHECK(frame->isLocalFrame());
314 if (!isFeatureEnabledInFrame(blink::kFullscreenFeature,
315 toLocalFrame(frame))) {
316 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
317 document.addConsoleMessage(ConsoleMessage::create(
318 JSMessageSource, WarningMessageLevel,
319 "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.
320 break;
321 }
322 }
323
311 // 1. If any of the following conditions are false, then terminate these 324 // 1. If any of the following conditions are false, then terminate these
312 // steps and queue a task to fire an event named fullscreenerror with its 325 // steps and queue a task to fire an event named fullscreenerror with its
313 // bubbles attribute set to true on the context object's node document: 326 // bubbles attribute set to true on the context object's node document:
314 327
315 // |element|'s namespace is the HTML namespace or |element| is an SVG 328 // |element|'s namespace is the HTML namespace or |element| is an SVG
316 // svg or MathML math element. 329 // svg or MathML math element.
317 // Note: MathML is not supported. 330 // Note: MathML is not supported.
318 if (!element.isHTMLElement() && !isSVGSVGElement(element)) 331 if (!element.isHTMLElement() && !isSVGSVGElement(element))
319 break; 332 break;
320 333
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 host->chromeClient().exitFullscreen(document.frame()); 548 host->chromeClient().exitFullscreen(document.frame());
536 return; 549 return;
537 } 550 }
538 551
539 // Otherwise, notify the chrome of the new full screen element. 552 // Otherwise, notify the chrome of the new full screen element.
540 host->chromeClient().enterFullscreenForElement(newTop); 553 host->chromeClient().enterFullscreenForElement(newTop);
541 } 554 }
542 555
543 // https://fullscreen.spec.whatwg.org/#dom-document-fullscreenenabled 556 // https://fullscreen.spec.whatwg.org/#dom-document-fullscreenenabled
544 bool Fullscreen::fullscreenEnabled(Document& document) { 557 bool Fullscreen::fullscreenEnabled(Document& document) {
558 Frame* frame = document.frame();
559 if (!isFeatureEnabledInFrame(blink::kFullscreenFeature,
560 toLocalFrame(frame))) {
561 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
562 document.addConsoleMessage(ConsoleMessage::create(
563 JSMessageSource, WarningMessageLevel,
564 "Fullscreen API is not enabled in feature policy for this frame"));
565 return false;
566 }
567 }
568
545 // The fullscreenEnabled attribute's getter must return true if the context 569 // The fullscreenEnabled attribute's getter must return true if the context
546 // object is allowed to use the feature indicated by attribute name 570 // object is allowed to use the feature indicated by attribute name
547 // allowfullscreen and fullscreen is supported, and false otherwise. 571 // allowfullscreen and fullscreen is supported, and false otherwise.
548 return allowedToUseFullscreen(document.frame()) && 572 if (!fullscreenIsSupported(document))
549 fullscreenIsSupported(document); 573 return false;
574
575 return allowedToUseFullscreen(frame);
550 } 576 }
551 577
552 void Fullscreen::didEnterFullscreenForElement(Element* element) { 578 void Fullscreen::didEnterFullscreenForElement(Element* element) {
553 DCHECK(element); 579 DCHECK(element);
554 if (!document()->isActive()) 580 if (!document()->isActive())
555 return; 581 return;
556 582
557 if (m_fullScreenLayoutObject) 583 if (m_fullScreenLayoutObject)
558 m_fullScreenLayoutObject->unwrapLayoutObject(); 584 m_fullScreenLayoutObject->unwrapLayoutObject();
559 585
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 788
763 DEFINE_TRACE(Fullscreen) { 789 DEFINE_TRACE(Fullscreen) {
764 visitor->trace(m_currentFullScreenElement); 790 visitor->trace(m_currentFullScreenElement);
765 visitor->trace(m_fullscreenElementStack); 791 visitor->trace(m_fullscreenElementStack);
766 visitor->trace(m_eventQueue); 792 visitor->trace(m_eventQueue);
767 Supplement<Document>::trace(visitor); 793 Supplement<Document>::trace(visitor);
768 ContextLifecycleObserver::trace(visitor); 794 ContextLifecycleObserver::trace(visitor);
769 } 795 }
770 796
771 } // namespace blink 797 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698