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 6f13781c84c15f403811150eaae2479a0c74c964..077963821b50075ca116e06f7283d3061d1c59ef 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_shouldCollapse(false), |
m_sandbox(HTMLIFrameElementSandbox::create(this)), |
m_referrerPolicy(ReferrerPolicyDefault) {} |
@@ -53,6 +54,17 @@ DEFINE_TRACE(HTMLIFrameElement) { |
HTMLIFrameElement::~HTMLIFrameElement() {} |
+void HTMLIFrameElement::setShouldCollapse(bool collapse) { |
+ if (m_shouldCollapse == collapse) |
+ return; |
+ |
+ m_shouldCollapse = collapse; |
+ if (document().inStyleRecalc()) |
+ reattachLayoutTree(); |
+ else |
+ lazyReattachIfAttached(); |
+} |
+ |
DOMTokenList* HTMLIFrameElement::sandbox() const { |
return m_sandbox.get(); |
} |
@@ -154,7 +166,8 @@ void HTMLIFrameElement::parseAttribute( |
} |
bool HTMLIFrameElement::layoutObjectIsNeeded(const ComputedStyle& style) { |
- return contentFrame() && HTMLElement::layoutObjectIsNeeded(style); |
+ return contentFrame() && !m_shouldCollapse && |
+ HTMLFrameElementBase::layoutObjectIsNeeded(style); |
} |
LayoutObject* HTMLIFrameElement::createLayoutObject(const ComputedStyle&) { |