Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp

Issue 2564633002: Don't create layout objects for children of display-none iframes. (Closed)
Patch Set: . Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
index 05e28a7fc73ba85483de25684ad64ddd886be869..5426c3dad416ace5555bcbc37502f43130824435 100644
--- a/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLFrameElementBase.cpp
@@ -29,6 +29,7 @@
#include "core/HTMLNames.h"
#include "core/dom/Attribute.h"
#include "core/dom/Document.h"
+#include "core/dom/StyleChangeReason.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/frame/RemoteFrame.h"
@@ -123,13 +124,6 @@ void HTMLFrameElementBase::openURL(bool replaceCurrentItem) {
.executeScriptIfJavaScriptURL(scriptURL, this);
}
-void HTMLFrameElementBase::frameOwnerPropertiesChanged() {
- // Don't notify about updates if contentFrame() is null, for example when
- // the subframe hasn't been created yet.
- if (contentFrame())
- document().frame()->loader().client()->didChangeFrameOwnerProperties(this);
-}
-
void HTMLFrameElementBase::parseAttribute(const QualifiedName& name,
const AtomicString& oldValue,
const AtomicString& value) {
@@ -199,11 +193,23 @@ void HTMLFrameElementBase::didNotifySubtreeInsertionsToDocument() {
void HTMLFrameElementBase::attachLayoutTree(const AttachContext& context) {
HTMLFrameOwnerElement::attachLayoutTree(context);
- if (layoutPart()) {
- if (Frame* frame = contentFrame()) {
- if (frame->isLocalFrame())
- setWidget(toLocalFrame(frame)->view());
- else if (frame->isRemoteFrame())
+ // TODO(esprehn): Why do we only call setWidget() if the frame is
+ // displayed?
+
+ if (Frame* frame = contentFrame()) {
+ if (frame->isLocalFrame()) {
+ LocalFrame* localFrame = toLocalFrame(frame);
+ if (layoutPart())
+ setWidget(localFrame->view());
+ if (Element* documentElement =
+ localFrame->document()->documentElement()) {
+ if (static_cast<bool>(layoutPart()) !=
+ static_cast<bool>(documentElement->layoutObject())) {
+ documentElement->lazyReattachIfAttached();
+ }
+ }
+ } else {
+ if (layoutPart())
setWidget(toRemoteFrame(frame)->view());
}
}
@@ -264,7 +270,7 @@ void HTMLFrameElementBase::setScrollingMode(ScrollbarMode scrollbarMode) {
if (contentDocument()) {
contentDocument()->willChangeFrameOwnerProperties(
- m_marginWidth, m_marginHeight, scrollbarMode);
+ m_marginWidth, m_marginHeight, scrollbarMode, isDisplayNone());
}
m_scrollingMode = scrollbarMode;
frameOwnerPropertiesChanged();
@@ -276,7 +282,7 @@ void HTMLFrameElementBase::setMarginWidth(int marginWidth) {
if (contentDocument()) {
contentDocument()->willChangeFrameOwnerProperties(
- marginWidth, m_marginHeight, m_scrollingMode);
+ marginWidth, m_marginHeight, m_scrollingMode, isDisplayNone());
}
m_marginWidth = marginWidth;
frameOwnerPropertiesChanged();
@@ -288,7 +294,7 @@ void HTMLFrameElementBase::setMarginHeight(int marginHeight) {
if (contentDocument()) {
contentDocument()->willChangeFrameOwnerProperties(
- m_marginWidth, marginHeight, m_scrollingMode);
+ m_marginWidth, marginHeight, m_scrollingMode, isDisplayNone());
}
m_marginHeight = marginHeight;
frameOwnerPropertiesChanged();

Powered by Google App Engine
This is Rietveld 408576698