OLD | NEW |
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 Loading... |
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 RefPtr<SecurityOrigin> origin = GetOriginForFeaturePolicy(); |
| 204 Vector<WebParsedFeaturePolicyDeclaration> container_policy; |
| 205 |
| 206 // Populate the initial container policy from the allow attribute. |
| 207 for (const WebFeaturePolicyFeature feature : AllowedFeatures()) { |
| 208 WebParsedFeaturePolicyDeclaration whitelist; |
| 209 whitelist.feature = feature; |
| 210 whitelist.origins = Vector<WebSecurityOrigin>(1UL, {origin}); |
| 211 container_policy.push_back(whitelist); |
| 212 } |
| 213 |
| 214 // If allowfullscreen attribute is present and no fullscreen policy is set, |
| 215 // enable the feature for all origins. |
| 216 if (AllowFullscreen()) { |
| 217 bool has_fullscreen_policy = false; |
| 218 for (const auto& declaration : container_policy) { |
| 219 if (declaration.feature == WebFeaturePolicyFeature::kFullscreen) { |
| 220 has_fullscreen_policy = true; |
| 221 break; |
| 222 } |
| 223 } |
| 224 if (!has_fullscreen_policy) { |
| 225 WebParsedFeaturePolicyDeclaration whitelist; |
| 226 whitelist.feature = WebFeaturePolicyFeature::kFullscreen; |
| 227 whitelist.matches_all_origins = true; |
| 228 whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
| 229 container_policy.push_back(whitelist); |
| 230 } |
| 231 } |
| 232 // If the allowpaymentrequest attribute is present and no 'payment' policy is |
| 233 // set, enable the feature for all origins. |
| 234 if (AllowPaymentRequest()) { |
| 235 bool has_payment_policy = false; |
| 236 for (const auto& declaration : container_policy) { |
| 237 if (declaration.feature == WebFeaturePolicyFeature::kPayment) { |
| 238 has_payment_policy = true; |
| 239 break; |
| 240 } |
| 241 } |
| 242 if (!has_payment_policy) { |
| 243 WebParsedFeaturePolicyDeclaration whitelist; |
| 244 whitelist.feature = WebFeaturePolicyFeature::kPayment; |
| 245 whitelist.matches_all_origins = true; |
| 246 whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
| 247 container_policy.push_back(whitelist); |
| 248 } |
| 249 } |
| 250 |
| 251 return container_policy; |
| 252 } |
| 253 |
201 bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { | 254 bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { |
202 return ContentFrame() && !collapsed_by_client_ && | 255 return ContentFrame() && !collapsed_by_client_ && |
203 HTMLElement::LayoutObjectIsNeeded(style); | 256 HTMLElement::LayoutObjectIsNeeded(style); |
204 } | 257 } |
205 | 258 |
206 LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { | 259 LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { |
207 return new LayoutIFrame(this); | 260 return new LayoutIFrame(this); |
208 } | 261 } |
209 | 262 |
210 Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto( | 263 Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto( |
(...skipping 14 matching lines...) Expand all Loading... |
225 | 278 |
226 bool HTMLIFrameElement::IsInteractiveContent() const { | 279 bool HTMLIFrameElement::IsInteractiveContent() const { |
227 return true; | 280 return true; |
228 } | 281 } |
229 | 282 |
230 ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { | 283 ReferrerPolicy HTMLIFrameElement::ReferrerPolicyAttribute() { |
231 return referrer_policy_; | 284 return referrer_policy_; |
232 } | 285 } |
233 | 286 |
234 } // namespace blink | 287 } // namespace blink |
OLD | NEW |