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)) | |
| 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); | 54 DOMTokenListObserver::trace(visitor); |
| 53 } | 55 } |
| 54 | 56 |
| 55 HTMLIFrameElement::~HTMLIFrameElement() | 57 HTMLIFrameElement::~HTMLIFrameElement() |
| 56 { | 58 { |
| 57 } | 59 } |
| 58 | 60 |
| 59 DOMTokenList* HTMLIFrameElement::sandbox() const | 61 DOMTokenList* HTMLIFrameElement::sandbox() const |
| 60 { | 62 { |
| 61 return m_sandbox.get(); | 63 return m_sandbox.get(); |
| 62 } | 64 } |
| 63 | 65 |
| 66 DOMTokenList* HTMLIFrameElement::permissions() const | |
| 67 { | |
| 68 return m_permissions.get(); | |
| 69 } | |
| 70 | |
| 64 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const | 71 bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const |
| 65 { | 72 { |
| 66 if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr) | 73 if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr) |
| 67 return true; | 74 return true; |
| 68 return HTMLFrameElementBase::isPresentationAttribute(name); | 75 return HTMLFrameElementBase::isPresentationAttribute(name); |
| 69 } | 76 } |
| 70 | 77 |
| 71 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style) | 78 void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style) |
| 72 { | 79 { |
| 73 if (name == widthAttr) { | 80 if (name == widthAttr) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 102 UseCounter::count(document(), UseCounter::SandboxViaIFrame); | 109 UseCounter::count(document(), UseCounter::SandboxViaIFrame); |
| 103 } else if (name == referrerpolicyAttr) { | 110 } else if (name == referrerpolicyAttr) { |
| 104 m_referrerPolicy = ReferrerPolicyDefault; | 111 m_referrerPolicy = ReferrerPolicyDefault; |
| 105 if (!value.isNull()) | 112 if (!value.isNull()) |
| 106 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); | 113 SecurityPolicy::referrerPolicyFromString(value, &m_referrerPolicy); |
| 107 } else if (name == allowfullscreenAttr) { | 114 } else if (name == allowfullscreenAttr) { |
| 108 bool oldAllowFullscreen = m_allowFullscreen; | 115 bool oldAllowFullscreen = m_allowFullscreen; |
| 109 m_allowFullscreen = !value.isNull(); | 116 m_allowFullscreen = !value.isNull(); |
| 110 if (m_allowFullscreen != oldAllowFullscreen) | 117 if (m_allowFullscreen != oldAllowFullscreen) |
| 111 frameOwnerPropertiesChanged(); | 118 frameOwnerPropertiesChanged(); |
| 119 } else if (name == permissionsAttr) { | |
| 120 m_permissions->setValue(value); | |
| 112 } else { | 121 } else { |
| 113 if (name == srcAttr) | 122 if (name == srcAttr) |
| 114 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", srcAttr, ol dValue, value); | 123 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", srcAttr, ol dValue, value); |
| 115 HTMLFrameElementBase::parseAttribute(name, oldValue, value); | 124 HTMLFrameElementBase::parseAttribute(name, oldValue, value); |
| 116 } | 125 } |
| 117 } | 126 } |
| 118 | 127 |
| 119 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) | 128 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) |
| 120 { | 129 { |
| 121 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); | 130 return isURLAllowed() && HTMLElement::layoutObjectIsNeeded(style); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 142 toHTMLDocument(document()).removeExtraNamedItem(m_name); | 151 toHTMLDocument(document()).removeExtraNamedItem(m_name); |
| 143 } | 152 } |
| 144 | 153 |
| 145 bool HTMLIFrameElement::isInteractiveContent() const | 154 bool HTMLIFrameElement::isInteractiveContent() const |
| 146 { | 155 { |
| 147 return true; | 156 return true; |
| 148 } | 157 } |
| 149 | 158 |
| 150 void HTMLIFrameElement::valueWasSet() | 159 void HTMLIFrameElement::valueWasSet() |
| 151 { | 160 { |
| 161 // TODO(raymes): How can we distinguish between these two calls? Should we | |
| 162 // change DOMTokenListObserver to take a function pointer or to pass the | |
| 163 // DOMTokenList* to valueWasSet()? | |
|
esprehn
2016/06/01 05:05:57
I think you want to split it into two observers in
raymes
2016/06/06 06:48:29
Done.
| |
| 164 sandboxValueWasSet(); | |
| 165 permissionsValueWasSet(); | |
| 166 } | |
| 167 | |
| 168 void HTMLIFrameElement::permissionsValueWasSet() | |
| 169 { | |
| 170 String invalidTokens; | |
| 171 m_delegatedPermissions = m_permissions->parseDelegatedPermissions(invalidTok ens); | |
| 172 if (!invalidTokens.isNull()) | |
| 173 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'permissions' attribute: " + invalid Tokens)); | |
| 174 setSynchronizedLazyAttribute(permissionsAttr, m_permissions->value()); | |
| 175 frameOwnerPropertiesChanged(); | |
| 176 } | |
| 177 | |
| 178 void HTMLIFrameElement::sandboxValueWasSet() | |
| 179 { | |
| 152 String invalidTokens; | 180 String invalidTokens; |
| 153 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli cy(m_sandbox->tokens(), invalidTokens)); | 181 setSandboxFlags(m_sandbox->value().isNull() ? SandboxNone : parseSandboxPoli cy(m_sandbox->tokens(), invalidTokens)); |
| 154 if (!invalidTokens.isNull()) | 182 if (!invalidTokens.isNull()) |
| 155 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke ns)); | 183 document().addConsoleMessage(ConsoleMessage::create(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidToke ns)); |
| 156 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); | 184 setSynchronizedLazyAttribute(sandboxAttr, m_sandbox->value()); |
| 157 } | 185 } |
| 158 | 186 |
| 159 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() | 187 ReferrerPolicy HTMLIFrameElement::referrerPolicyAttribute() |
| 160 { | 188 { |
| 161 return m_referrerPolicy; | 189 return m_referrerPolicy; |
| 162 } | 190 } |
| 163 } // namespace blink | 191 } // namespace blink |
| OLD | NEW |