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 c58604cddcba2c973a70bf50e5b9cffcf2e86fa8..37be21f2a01c77749140944d1ea3d61e9c345c2a 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), |
did_load_non_empty_document_(false), |
+ collapsed_by_client_(false), |
sandbox_(HTMLIFrameElementSandbox::Create(this)), |
allow_(HTMLIFrameElementAllow::Create(this)), |
referrer_policy_(kReferrerPolicyDefault) {} |
@@ -54,6 +55,18 @@ DEFINE_TRACE(HTMLIFrameElement) { |
HTMLIFrameElement::~HTMLIFrameElement() {} |
+void HTMLIFrameElement::SetCollapsed(bool collapse) { |
+ if (collapsed_by_client_ == collapse) |
+ return; |
+ |
+ collapsed_by_client_ = collapse; |
+ |
+ // This is always called in response to an IPC, so should not happen in the |
+ // middle of a style recalc. |
+ DCHECK(!GetDocument().InStyleRecalc()); |
+ LazyReattachIfAttached(); |
+} |
+ |
DOMTokenList* HTMLIFrameElement::sandbox() const { |
return sandbox_.Get(); |
} |
@@ -168,7 +181,8 @@ void HTMLIFrameElement::ParseAttribute( |
} |
bool HTMLIFrameElement::LayoutObjectIsNeeded(const ComputedStyle& style) { |
- return ContentFrame() && HTMLElement::LayoutObjectIsNeeded(style); |
+ return ContentFrame() && !collapsed_by_client_ && |
+ HTMLElement::LayoutObjectIsNeeded(style); |
} |
LayoutObject* HTMLIFrameElement::CreateLayoutObject(const ComputedStyle&) { |