Chromium Code Reviews| 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 21 matching lines...) Expand all Loading... | |
| 32 #include "core/layout/LayoutIFrame.h" | 32 #include "core/layout/LayoutIFrame.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 using namespace HTMLNames; | 36 using namespace HTMLNames; |
| 37 | 37 |
| 38 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) | 38 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) |
| 39 : HTMLFrameElementBase(iframeTag, document) | 39 : HTMLFrameElementBase(iframeTag, document) |
| 40 , m_didLoadNonEmptyDocument(false) | 40 , m_didLoadNonEmptyDocument(false) |
| 41 , m_sandbox(HTMLIFrameElementSandbox::create(this)) | 41 , m_sandbox(HTMLIFrameElementSandbox::create(this)) |
| 42 , m_permissions(HTMLIFrameElementPermissions::create(this)) | |
|
sof
2016/06/27 08:38:52
As this isn't commonly accessed (or enabled by def
raymes
2016/06/28 01:19:03
Done.
| |
| 42 , m_referrerPolicy(ReferrerPolicyDefault) | 43 , m_referrerPolicy(ReferrerPolicyDefault) |
| 43 { | 44 { |
| 44 } | 45 } |
| 45 | 46 |
| 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) | 47 DEFINE_NODE_FACTORY(HTMLIFrameElement) |
| 47 | 48 |
| 48 DEFINE_TRACE(HTMLIFrameElement) | 49 DEFINE_TRACE(HTMLIFrameElement) |
| 49 { | 50 { |
| 50 visitor->trace(m_sandbox); | 51 visitor->trace(m_sandbox); |
| 52 visitor->trace(m_permissions); | |
| 51 HTMLFrameElementBase::trace(visitor); | 53 HTMLFrameElementBase::trace(visitor); |
| 52 DOMTokenListObserver::trace(visitor); | |
| 53 } | 54 } |
| 54 | 55 |
| 55 HTMLIFrameElement::~HTMLIFrameElement() | 56 HTMLIFrameElement::~HTMLIFrameElement() |
| 56 { | 57 { |
| 57 } | 58 } |
| 58 | 59 |
| 59 DOMTokenList* HTMLIFrameElement::sandbox() const | 60 DOMTokenList* HTMLIFrameElement::sandbox() const |
| 60 { | 61 { |
| 61 return m_sandbox.get(); | 62 return m_sandbox.get(); |
| 62 } | 63 } |
| 63 | 64 |
| 65 DOMTokenList* HTMLIFrameElement::permissions() const | |
| 66 { | |
| 67 return m_permissions.get(); | |
| 68 } | |
| 69 | |
| 64 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const | 70 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const |
| 65 { | 71 { |
| 66 if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr) | 72 if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr) |
| 67 return true; | 73 return true; |
| 68 return HTMLFrameElementBase::isPresentationAttribute(name); | 74 return HTMLFrameElementBase::isPresentationAttribute(name); |
| 69 } | 75 } |
| 70 | 76 |
| 71 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style) | 77 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style) |
| 72 { | 78 { |
| 73 if (name == widthAttr) { | 79 if (name == widthAttr) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 102 UseCounter::count(document(), UseCounter::SandboxViaIFrame); | 108 UseCounter::count(document(), UseCounter::SandboxViaIFrame); |
| 103 } else if (name == referrerpolicyAttr) { | 109 } else if (name == referrerpolicyAttr) { |
| 104 m_referrerPolicy = ReferrerPolicyDefault; | 110 m_referrerPolicy = ReferrerPolicyDefault; |
| 105 if (!value.isNull()) | 111 if (!value.isNull()) |
| 106 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); | 112 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); |
| 107 } else if (name == allowfullscreenAttr) { | 113 } else if (name == allowfullscreenAttr) { |
| 108 bool oldAllowFullscreen = m_allowFullscreen; | 114 bool oldAllowFullscreen = m_allowFullscreen; |
| 109 m_allowFullscreen = !value.isNull(); | 115 m_allowFullscreen = !value.isNull(); |
| 110 if (m_allowFullscreen != oldAllowFullscreen) | 116 if (m_allowFullscreen != oldAllowFullscreen) |
| 111 frameOwnerPropertiesChanged(); | 117 frameOwnerPropertiesChanged(); |
| 118 } else if (name == permissionsAttr) { | |
| 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 (!RuntimeEnabledFeatures::permissionDelegationEnabled()) | |
| 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 } |
| 163 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |