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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Commit the renames Created 4 years, 1 month 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/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index f5972c64070085e883e96563363867652c7fe6a3..b2f5f8b54f9370c91ab21a100e208a735be22c11 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1368,13 +1368,13 @@ Element* Document::scrollingElement() {
// We use HashMap::set over HashMap::add here as we want to
// replace the ComputedStyle but not the Element if the Element is
// already present.
-void Document::addStyleReattachData(Element& element,
+void Document::addStyleReattachData(Node& node,
StyleReattachData& styleReattachData) {
- m_styleReattachDataMap.set(&element, styleReattachData);
+ m_styleReattachDataMap.set(&node, styleReattachData);
}
-StyleReattachData Document::getStyleReattachData(Element& element) {
- return m_styleReattachDataMap.get(&element);
+StyleReattachData Document::getStyleReattachData(Node& node) {
+ return m_styleReattachDataMap.get(&node);
}
/*
@@ -1800,7 +1800,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change) {
// for viewport styles, but we assume root font size changes are rare and just
// invalidate the cache for now.
if (styleEngine().usesRemUnits() &&
- (documentElement()->needsAttach() ||
+ (documentElement()->needsReattachLayoutTree() ||
!documentElement()->computedStyle() ||
documentElement()->computedStyle()->fontSize() !=
documentElementStyle->fontSize())) {
@@ -2051,6 +2051,11 @@ void Document::updateStyle() {
inheritHtmlAndBodyElementStyles(change);
if (documentElement->shouldCallRecalcStyle(change))
documentElement->recalcStyle(change);
+ DCHECK(!documentElement->needsStyleRecalc());
+ DCHECK(!documentElement->childNeedsStyleRecalc());
+ if (documentElement->needsReattachLayoutTree() ||
+ documentElement->childNeedsReattachLayoutTree())
+ documentElement->rebuildLayoutTree();
}
view()->recalcOverflowAfterStyleChange();
@@ -2368,9 +2373,11 @@ void Document::initialize() {
m_layoutView->setStyle(StyleResolver::styleForDocument(*this));
m_layoutView->compositor()->setNeedsCompositingUpdate(
CompositingUpdateAfterCompositingInputChange);
-
+ setNeedsReattachLayoutTree();
nainar 2016/11/29 06:13:39 This is as ContainerNode::attachLayoutTree() asser
ContainerNode::attachLayoutTree();
+ DCHECK(!needsReattachLayoutTree());
+
// The TextAutosizer can't update layout view info while the Document is
// detached, so update now in case anything changed.
if (TextAutosizer* autosizer = textAutosizer())

Powered by Google App Engine
This is Rietveld 408576698