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

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

Issue 2873433002: Enable Feature Policy without experimental features or fullscreen (Closed)
Patch Set: Update webkit_unit_tests(vibrate is not valid feature name) and layout_tests for fp-fullscreen (exp… Created 3 years, 7 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 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 // https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use 57 // https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use
58 bool AllowedToUseFullscreen(const Frame* frame) { 58 bool AllowedToUseFullscreen(const Frame* frame) {
59 // To determine whether a Document object |document| is allowed to use the 59 // To determine whether a Document object |document| is allowed to use the
60 // feature indicated by attribute name |allowattribute|, run these steps: 60 // feature indicated by attribute name |allowattribute|, run these steps:
61 61
62 // 1. If |document| has no browsing context, then return false. 62 // 1. If |document| has no browsing context, then return false.
63 if (!frame) 63 if (!frame)
64 return false; 64 return false;
65 65
66 // TODO(lunalu): Re-enable fullscreen in feature policy once all fullscreen
iclelland 2017/05/09 17:58:45 As mentioned offline, I don't really like this, ev
67 // tests have been re-written that "allowfullscreen" / "fullscreen" policy
68 // cannot be updated dynamically, by replacing the block below by commented
69 // block below.
70 // crbug.com/666761
71 // 2. If |document|'s browsing context is a top-level browsing context, then
72 // return true.
73 if (frame->IsMainFrame())
74 return true;
75
76 // 3. If |document|'s browsing context has a browsing context container that
77 // is an iframe element with an |allowattribute| attribute specified, and
78 // whose node document is allowed to use the feature indicated by
79 // |allowattribute|, then return true.
80 if (frame->Owner() && frame->Owner()->AllowFullscreen())
81 return AllowedToUseFullscreen(frame->Tree().Parent());
82
83 // 4. Return false.
84 return false;
85 /*
66 if (!RuntimeEnabledFeatures::featurePolicyEnabled()) { 86 if (!RuntimeEnabledFeatures::featurePolicyEnabled()) {
67 // 2. If |document|'s browsing context is a top-level browsing context, then 87 // 2. If |document|'s browsing context is a top-level browsing context, then
68 // return true. 88 // return true.
69 if (frame->IsMainFrame()) 89 if (frame->IsMainFrame())
70 return true; 90 return true;
71 91
72 // 3. If |document|'s browsing context has a browsing context container that 92 // 3. If |document|'s browsing context has a browsing context container that
73 // is an iframe element with an |allowattribute| attribute specified, and 93 // is an iframe element with an |allowattribute| attribute specified, and
74 // whose node document is allowed to use the feature indicated by 94 // whose node document is allowed to use the feature indicated by
75 // |allowattribute|, then return true. 95 // |allowattribute|, then return true.
76 if (frame->Owner() && frame->Owner()->AllowFullscreen()) 96 if (frame->Owner() && frame->Owner()->AllowFullscreen())
77 return AllowedToUseFullscreen(frame->Tree().Parent()); 97 return AllowedToUseFullscreen(frame->Tree().Parent());
78 98
79 // 4. Return false. 99 // 4. Return false.
80 return false; 100 return false;
81 } 101 }
82 102
83 // 2. If Feature Policy is enabled, return the policy for "fullscreen" 103 // 2. If Feature Policy is enabled, return the policy for "fullscreen"
84 // feature. 104 // feature.
85 return frame->IsFeatureEnabled(WebFeaturePolicyFeature::kFullscreen); 105 return frame->IsFeatureEnabled(WebFeaturePolicyFeature::kFullscreen);
106 */
86 } 107 }
87 108
88 bool AllowedToRequestFullscreen(Document& document) { 109 bool AllowedToRequestFullscreen(Document& document) {
89 // An algorithm is allowed to request fullscreen if one of the following is 110 // An algorithm is allowed to request fullscreen if one of the following is
90 // true: 111 // true:
91 112
92 // The algorithm is triggered by a user activation. 113 // The algorithm is triggered by a user activation.
93 if (UserGestureIndicator::ProcessingUserGesture()) 114 if (UserGestureIndicator::ProcessingUserGesture())
94 return true; 115 return true;
95 116
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 DEFINE_TRACE(Fullscreen) { 868 DEFINE_TRACE(Fullscreen) {
848 visitor->Trace(pending_fullscreen_element_); 869 visitor->Trace(pending_fullscreen_element_);
849 visitor->Trace(fullscreen_element_stack_); 870 visitor->Trace(fullscreen_element_stack_);
850 visitor->Trace(current_full_screen_element_); 871 visitor->Trace(current_full_screen_element_);
851 visitor->Trace(event_queue_); 872 visitor->Trace(event_queue_);
852 Supplement<Document>::Trace(visitor); 873 Supplement<Document>::Trace(visitor);
853 ContextLifecycleObserver::Trace(visitor); 874 ContextLifecycleObserver::Trace(visitor);
854 } 875 }
855 876
856 } // namespace blink 877 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698