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 #include "platform/RuntimeEnabledFeatures.h" | 33 #include "platform/RuntimeEnabledFeatures.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 using namespace HTMLNames; | 37 using namespace HTMLNames; |
38 | 38 |
39 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) | 39 inline HTMLIFrameElement::HTMLIFrameElement(Document& document) |
40 : HTMLFrameElementBase(iframeTag, document), | 40 : HTMLFrameElementBase(iframeTag, document), |
41 m_didLoadNonEmptyDocument(false), | 41 m_didLoadNonEmptyDocument(false), |
| 42 m_shouldCollapse(false), |
42 m_sandbox(HTMLIFrameElementSandbox::create(this)), | 43 m_sandbox(HTMLIFrameElementSandbox::create(this)), |
43 m_referrerPolicy(ReferrerPolicyDefault) {} | 44 m_referrerPolicy(ReferrerPolicyDefault) {} |
44 | 45 |
45 DEFINE_NODE_FACTORY(HTMLIFrameElement) | 46 DEFINE_NODE_FACTORY(HTMLIFrameElement) |
46 | 47 |
47 DEFINE_TRACE(HTMLIFrameElement) { | 48 DEFINE_TRACE(HTMLIFrameElement) { |
48 visitor->trace(m_sandbox); | 49 visitor->trace(m_sandbox); |
49 visitor->trace(m_permissions); | 50 visitor->trace(m_permissions); |
50 HTMLFrameElementBase::trace(visitor); | 51 HTMLFrameElementBase::trace(visitor); |
51 Supplementable<HTMLIFrameElement>::trace(visitor); | 52 Supplementable<HTMLIFrameElement>::trace(visitor); |
52 } | 53 } |
53 | 54 |
54 HTMLIFrameElement::~HTMLIFrameElement() {} | 55 HTMLIFrameElement::~HTMLIFrameElement() {} |
55 | 56 |
| 57 void HTMLIFrameElement::setShouldCollapse(bool collapse) { |
| 58 if (m_shouldCollapse == collapse) |
| 59 return; |
| 60 |
| 61 m_shouldCollapse = collapse; |
| 62 if (document().inStyleRecalc()) |
| 63 reattachLayoutTree(); |
| 64 else |
| 65 lazyReattachIfAttached(); |
| 66 } |
| 67 |
56 DOMTokenList* HTMLIFrameElement::sandbox() const { | 68 DOMTokenList* HTMLIFrameElement::sandbox() const { |
57 return m_sandbox.get(); | 69 return m_sandbox.get(); |
58 } | 70 } |
59 | 71 |
60 DOMTokenList* HTMLIFrameElement::permissions() const { | 72 DOMTokenList* HTMLIFrameElement::permissions() const { |
61 if (!const_cast<HTMLIFrameElement*>(this)->initializePermissionsAttribute()) | 73 if (!const_cast<HTMLIFrameElement*>(this)->initializePermissionsAttribute()) |
62 return nullptr; | 74 return nullptr; |
63 return m_permissions.get(); | 75 return m_permissions.get(); |
64 } | 76 } |
65 | 77 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (m_csp != oldCSP) | 159 if (m_csp != oldCSP) |
148 frameOwnerPropertiesChanged(); | 160 frameOwnerPropertiesChanged(); |
149 } else { | 161 } else { |
150 if (name == srcAttr) | 162 if (name == srcAttr) |
151 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", params); | 163 logUpdateAttributeIfIsolatedWorldAndInDocument("iframe", params); |
152 HTMLFrameElementBase::parseAttribute(params); | 164 HTMLFrameElementBase::parseAttribute(params); |
153 } | 165 } |
154 } | 166 } |
155 | 167 |
156 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) { | 168 bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) { |
157 return contentFrame() && HTMLElement::layoutObjectIsNeeded(style); | 169 return contentFrame() && !m_shouldCollapse && |
| 170 HTMLFrameElementBase::layoutObjectIsNeeded(style); |
158 } | 171 } |
159 | 172 |
160 LayoutObject* HTMLIFrameElement::createLayoutObject(const ComputedStyle&) { | 173 LayoutObject* HTMLIFrameElement::createLayoutObject(const ComputedStyle&) { |
161 return new LayoutIFrame(this); | 174 return new LayoutIFrame(this); |
162 } | 175 } |
163 | 176 |
164 Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto( | 177 Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto( |
165 ContainerNode* insertionPoint) { | 178 ContainerNode* insertionPoint) { |
166 InsertionNotificationRequest result = | 179 InsertionNotificationRequest result = |
167 HTMLFrameElementBase::insertedInto(insertionPoint); | 180 HTMLFrameElementBase::insertedInto(insertionPoint); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 bool HTMLIFrameElement::initializePermissionsAttribute() { | 228 bool HTMLIFrameElement::initializePermissionsAttribute() { |
216 if (!RuntimeEnabledFeatures::permissionDelegationEnabled()) | 229 if (!RuntimeEnabledFeatures::permissionDelegationEnabled()) |
217 return false; | 230 return false; |
218 | 231 |
219 if (!m_permissions) | 232 if (!m_permissions) |
220 m_permissions = HTMLIFrameElementPermissions::create(this); | 233 m_permissions = HTMLIFrameElementPermissions::create(this); |
221 return true; | 234 return true; |
222 } | 235 } |
223 | 236 |
224 } // namespace blink | 237 } // namespace blink |
OLD | NEW |