Index: third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
index 0a9e723d661e0c70d8d428c5e4c11ffd87252239..a61d13530c5ddad50337b6ed61d78babb85b6169 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
@@ -198,6 +198,49 @@ void HTMLIFrameElement::ParseAttribute( |
} |
} |
+Vector<WebParsedFeaturePolicyDeclaration> |
+HTMLIFrameElement::ConstructContainerPolicy() const { |
+ Vector<WebParsedFeaturePolicyDeclaration> container_policy = |
+ HTMLFrameOwnerElement::ConstructContainerPolicy(); |
+ |
+ // If allowfullscreen attribute is present and no fullscreen policy is set, |
+ // enable the feature for all origins; similarly for allowpaymentrequest. |
+ if (AllowFullscreen()) { |
+ bool can_override_fullscreen = true; |
+ for (const auto& declaration : container_policy) { |
+ if (declaration.feature == WebFeaturePolicyFeature::kFullscreen) { |
+ can_override_fullscreen = false; |
+ break; |
+ } |
+ } |
+ if (can_override_fullscreen) { |
+ WebParsedFeaturePolicyDeclaration whitelist; |
+ whitelist.feature = WebFeaturePolicyFeature::kFullscreen; |
+ whitelist.matches_all_origins = true; |
+ whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
+ container_policy.push_back(whitelist); |
+ } |
+ } |
+ if (AllowPaymentRequest()) { |
+ bool can_override_payment = true; |
+ for (const auto& declaration : container_policy) { |
+ if (declaration.feature == WebFeaturePolicyFeature::kPayment) { |
+ can_override_payment = false; |
+ break; |
+ } |
+ } |
+ if (can_override_payment) { |
+ WebParsedFeaturePolicyDeclaration whitelist; |
+ whitelist.feature = WebFeaturePolicyFeature::kPayment; |
+ whitelist.matches_all_origins = true; |
+ whitelist.origins = Vector<WebSecurityOrigin>(0UL); |
+ container_policy.push_back(whitelist); |
+ } |
+ } |
+ |
+ return container_policy; |
+} |
+ |
bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { |
return ContentFrame() && !collapsed_by_client_ && |
HTMLElement::LayoutObjectIsNeeded(style); |