| 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 30 matching lines...) Expand all Loading... |
| 41 , m_sandbox(HTMLIFrameElementSandbox::create(this)) | 41 , m_sandbox(HTMLIFrameElementSandbox::create(this)) |
| 42 , m_referrerPolicy(ReferrerPolicyDefault) | 42 , m_referrerPolicy(ReferrerPolicyDefault) |
| 43 { | 43 { |
| 44 } | 44 } |
| 45 | 45 |
| 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) | 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) |
| 47 | 47 |
| 48 DEFINE_TRACE(HTMLIFrameElement) | 48 DEFINE_TRACE(HTMLIFrameElement) |
| 49 { | 49 { |
| 50 visitor->trace(m_sandbox); | 50 visitor->trace(m_sandbox); |
| 51 visitor->trace(m_permissions); |
| 51 HTMLFrameElementBase::trace(visitor); | 52 HTMLFrameElementBase::trace(visitor); |
| 52 DOMTokenListObserver::trace(visitor); | |
| 53 } | 53 } |
| 54 | 54 |
| 55 HTMLIFrameElement::~HTMLIFrameElement() | 55 HTMLIFrameElement::~HTMLIFrameElement() |
| 56 { | 56 { |
| 57 } | 57 } |
| 58 | 58 |
| 59 DOMTokenList* HTMLIFrameElement::sandbox() const | 59 DOMTokenList* HTMLIFrameElement::sandbox() const |
| 60 { | 60 { |
| 61 return m_sandbox.get(); | 61 return m_sandbox.get(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 DOMTokenList* HTMLIFrameElement::permissions() const |
| 65 { |
| 66 return m_permissions.get(); |
| 67 } |
| 68 |
| 64 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const | 69 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const |
| 65 { | 70 { |
| 66 if (name == widthAttr || name == heightAttr || name == alignAttr || name ==
frameborderAttr) | 71 if (name == widthAttr || name == heightAttr || name == alignAttr || name ==
frameborderAttr) |
| 67 return true; | 72 return true; |
| 68 return HTMLFrameElementBase::isPresentationAttribute(name); | 73 return HTMLFrameElementBase::isPresentationAttribute(name); |
| 69 } | 74 } |
| 70 | 75 |
| 71 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName
& name, const AtomicString& value, MutableStylePropertySet* style) | 76 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName
& name, const AtomicString& value, MutableStylePropertySet* style) |
| 72 { | 77 { |
| 73 if (name == widthAttr) { | 78 if (name == widthAttr) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 102 UseCounter::count(document(), UseCounter::SandboxViaIFrame); | 107 UseCounter::count(document(), UseCounter::SandboxViaIFrame); |
| 103 } else if (name == referrerpolicyAttr) { | 108 } else if (name == referrerpolicyAttr) { |
| 104 m_referrerPolicy = ReferrerPolicyDefault; | 109 m_referrerPolicy = ReferrerPolicyDefault; |
| 105 if (!value.isNull()) | 110 if (!value.isNull()) |
| 106 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); | 111 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); |
| 107 } else if (name == allowfullscreenAttr) { | 112 } else if (name == allowfullscreenAttr) { |
| 108 bool oldAllowFullscreen = m_allowFullscreen; | 113 bool oldAllowFullscreen = m_allowFullscreen; |
| 109 m_allowFullscreen = !value.isNull(); | 114 m_allowFullscreen = !value.isNull(); |
| 110 if (m_allowFullscreen != oldAllowFullscreen) | 115 if (m_allowFullscreen != oldAllowFullscreen) |
| 111 frameOwnerPropertiesChanged(); | 116 frameOwnerPropertiesChanged(); |
| 117 } else if (name == permissionsAttr) { |
| 118 if (initializePermissionsAttribute()) |
| 119 m_permissions->setValue(value); |
| 112 } else { | 120 } else { |
| 113 if (name == srcAttr) | 121 if (name == srcAttr) |
| 114 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", srcAttr, ol
dValue, value); | 122 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", srcAttr, ol
dValue, value); |
| 115 HTMLFrameElementBase::parseAttribute(name, oldValue, value); | 123 HTMLFrameElementBase::parseAttribute(name, oldValue, value); |
| 116 } | 124 } |
| 117 } | 125 } |
| 118 | 126 |
| 119 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) | 127 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 120 { | 128 { |
| 121 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); | 129 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 140 HTMLFrameElementBase::removedFrom(insertionPoint); | 148 HTMLFrameElementBase::removedFrom(insertionPoint); |
| 141 if (insertionPoint->inShadowIncludingDocument() && document().isHTMLDocument
() && !insertionPoint->isInShadowTree()) | 149 if (insertionPoint->inShadowIncludingDocument() && document().isHTMLDocument
() && !insertionPoint->isInShadowTree()) |
| 142 toHTMLDocument(document()).removeExtraNamedItem(m_name); | 150 toHTMLDocument(document()).removeExtraNamedItem(m_name); |
| 143 } | 151 } |
| 144 | 152 |
| 145 bool HTMLIFrameElement::isInteractiveContent() const | 153 bool HTMLIFrameElement::isInteractiveContent() const |
| 146 { | 154 { |
| 147 return true; | 155 return true; |
| 148 } | 156 } |
| 149 | 157 |
| 150 void HTMLIFrameElement::valueWasSet() | 158 void HTMLIFrameElement::permissionsValueWasSet() |
| 159 { |
| 160 if (!initializePermissionsAttribute()) |
| 161 return; |
| 162 |
| 163 String invalidTokens; |
| 164 m_delegatedPermissions = m_permissions->parseDelegatedPermissions(invalidTok
ens); |
| 165 if (!invalidTokens.isNull()) |
| 166 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource,
ErrorMessageLevel, "Error while parsing the 'permissions' attribute: " + invalid
Tokens)); |
| 167 setSynchronizedLazyAttribute(permissionsAttr, m_permissions->value()); |
| 168 frameOwnerPropertiesChanged(); |
| 169 } |
| 170 |
| 171 void HTMLIFrameElement::sandboxValueWasSet() |
| 151 { | 172 { |
| 152 String invalidTokens; | 173 String invalidTokens; |
| 153 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli
cy(m_sandbox->tokens(), invalidTokens)); | 174 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli
cy(m_sandbox->tokens(), invalidTokens)); |
| 154 if (!invalidTokens.isNull()) | 175 if (!invalidTokens.isNull()) |
| 155 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource,
ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke
ns)); | 176 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource,
ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke
ns)); |
| 156 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); | 177 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); |
| 157 } | 178 } |
| 158 | 179 |
| 159 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() | 180 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() |
| 160 { | 181 { |
| 161 return m_referrerPolicy; | 182 return m_referrerPolicy; |
| 162 } | 183 } |
| 184 |
| 185 bool HTMLIFrameElement::initializePermissionsAttribute() |
| 186 { |
| 187 if (!RuntimeEnabledFeatures::permissionDelegationEnabled()) |
| 188 return false; |
| 189 |
| 190 if (!m_permissions) |
| 191 m_permissions = HTMLIFrameElementPermissions::create(this); |
| 192 return true; |
| 193 } |
| 194 |
| 163 } // namespace blink | 195 } // namespace blink |
| OLD | NEW |