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 b95120597c5e8e93838348787c43b88cfcd63a15..97543f88f00f73bb9fb40b1134deed255a9e17cf 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLIFrameElement.cpp |
@@ -39,6 +39,7 @@ using namespace HTMLNames; |
inline HTMLIFrameElement::HTMLIFrameElement(Document& document) |
: HTMLFrameElementBase(iframeTag, document), |
m_didLoadNonEmptyDocument(false), |
+ m_collapsedByClient(false), |
m_sandbox(HTMLIFrameElementSandbox::create(this)), |
m_allow(HTMLIFrameElementAllow::create(this)), |
m_referrerPolicy(ReferrerPolicyDefault) {} |
@@ -55,6 +56,17 @@ DEFINE_TRACE(HTMLIFrameElement) { |
HTMLIFrameElement::~HTMLIFrameElement() {} |
+void HTMLIFrameElement::setCollapsedByClient(bool collapse) { |
+ if (m_collapsedByClient == collapse) |
+ return; |
+ |
+ m_collapsedByClient = collapse; |
+ if (document().inStyleRecalc()) |
+ reattachLayoutTree(); |
+ else |
+ lazyReattachIfAttached(); |
+} |
+ |
DOMTokenList* HTMLIFrameElement::sandbox() const { |
return m_sandbox.get(); |
} |
@@ -175,7 +187,8 @@ void HTMLIFrameElement::parseAttribute( |
} |
bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) { |
- return contentFrame() && HTMLElement::layoutObjectIsNeeded(style); |
+ return contentFrame() && !m_collapsedByClient && |
+ HTMLFrameElementBase::layoutObjectIsNeeded(style); |
} |
LayoutObject* HTMLIFrameElement::createLayoutObject(const ComputedStyle&) { |