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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp

Issue 2923563003: Move container policy logic to frame owner classes. (Closed)
Patch Set: Add Frame element unit test Created 3 years, 6 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) 2000 Simon Hausmann (hausmann@kde.org) 4 * (C) 2000 Simon Hausmann (hausmann@kde.org)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2009 Ericsson AB. All rights reserved. 7 * Copyright (C) 2009 Ericsson AB. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 } 191 }
192 FrameOwnerPropertiesChanged(); 192 FrameOwnerPropertiesChanged();
193 UpdateContainerPolicy(); 193 UpdateContainerPolicy();
194 } else { 194 } else {
195 if (name == srcAttr) 195 if (name == srcAttr)
196 LogUpdateAttributeIfIsolatedWorldAndInDocument("iframe", params); 196 LogUpdateAttributeIfIsolatedWorldAndInDocument("iframe", params);
197 HTMLFrameElementBase::ParseAttribute(params); 197 HTMLFrameElementBase::ParseAttribute(params);
198 } 198 }
199 } 199 }
200 200
201 Vector<WebParsedFeaturePolicyDeclaration>
202 HTMLIFrameElement::ConstructContainerPolicy() const {
203 Vector<WebParsedFeaturePolicyDeclaration> container_policy =
204 HTMLFrameOwnerElement::ConstructContainerPolicy();
205
206 // If allowfullscreen attribute is present and no fullscreen policy is set,
207 // enable the feature for all origins; similarly for allowpaymentrequest.
208 if (AllowFullscreen()) {
209 bool can_override_fullscreen = true;
210 for (const auto& declaration : container_policy) {
211 if (declaration.feature == WebFeaturePolicyFeature::kFullscreen) {
212 can_override_fullscreen = false;
213 break;
214 }
215 }
216 if (can_override_fullscreen) {
217 WebParsedFeaturePolicyDeclaration whitelist;
218 whitelist.feature = WebFeaturePolicyFeature::kFullscreen;
219 whitelist.matches_all_origins = true;
220 whitelist.origins = Vector<WebSecurityOrigin>(0UL);
221 container_policy.push_back(whitelist);
222 }
223 }
224 if (AllowPaymentRequest()) {
225 bool can_override_payment = true;
226 for (const auto& declaration : container_policy) {
227 if (declaration.feature == WebFeaturePolicyFeature::kPayment) {
228 can_override_payment = false;
229 break;
230 }
231 }
232 if (can_override_payment) {
233 WebParsedFeaturePolicyDeclaration whitelist;
234 whitelist.feature = WebFeaturePolicyFeature::kPayment;
235 whitelist.matches_all_origins = true;
236 whitelist.origins = Vector<WebSecurityOrigin>(0UL);
237 container_policy.push_back(whitelist);
238 }
239 }
240
241 return container_policy;
242 }
243
201 bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { 244 bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) {
202 return ContentFrame() && !collapsed_by_client_ && 245 return ContentFrame() && !collapsed_by_client_ &&
203 HTMLElement::LayoutObjectIsNeeded(style); 246 HTMLElement::LayoutObjectIsNeeded(style);
204 } 247 }
205 248
206 LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { 249 LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) {
207 return new LayoutIFrame(this); 250 return new LayoutIFrame(this);
208 } 251 }
209 252
210 Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto( 253 Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto(
(...skipping 14 matching lines...) Expand all
225 268
226 bool HTMLIFrameElement::IsInteractiveContent() const { 269 bool HTMLIFrameElement::IsInteractiveContent() const {
227 return true; 270 return true;
228 } 271 }
229 272
230 ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { 273 ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() {
231 return referrer_policy_; 274 return referrer_policy_;
232 } 275 }
233 276
234 } // namespace blink 277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698