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

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

Issue 2439973005: Revert of Move Layout Tree Construction code into Element::rebuildLayoutTree() (Closed)
Patch Set: Revert "Move Layout Tree Construction code into Element::rebuildLayoutTree()" Created 4 years, 2 months 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 10b4fb1ed15d6cfb6d9ad5d3351516df49d395f4..498d9def3d446f2420a90b97897bc2da4ea7cb8b 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1835,7 +1835,7 @@ PassRefPtr<ComputedStyle> Element::originalStyleForLayoutObject() {
return document().ensureStyleResolver().styleForElement(this);
}
-void Element::recalcStyle(StyleRecalcChange change) {
+void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) {
DCHECK(document().inStyleRecalc());
DCHECK(!document().lifecycle().inDetach());
DCHECK(!parentOrShadowHostNode()->needsStyleRecalc());
@@ -1858,7 +1858,6 @@ void Element::recalcStyle(StyleRecalcChange change) {
if (parentComputedStyle())
change = recalcOwnStyle(change);
clearNeedsStyleRecalc();
- clearNeedsReattachLayoutTree();
}
// If we reattached we don't need to recalc the style of our descendants
@@ -1890,11 +1889,13 @@ void Element::recalcStyle(StyleRecalcChange change) {
childNeedsStyleRecalc() ? Force : change);
clearChildNeedsStyleRecalc();
- clearChildNeedsReattachLayoutTree();
}
if (hasCustomStyleCallbacks())
didRecalcStyle(change);
+
+ if (change == Reattach)
+ reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
}
PassRefPtr<ComputedStyle> Element::propagateInheritedProperties(
@@ -1943,7 +1944,6 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) {
if (localChange == Reattach) {
document().addNonAttachedStyle(*this, std::move(newStyle));
- setNeedsReattachLayoutTree();
return rebuildLayoutTree();
}
@@ -1987,31 +1987,12 @@ StyleRecalcChange Element::recalcOwnStyle(StyleRecalcChange change) {
}
StyleRecalcChange Element::rebuildLayoutTree() {
- DCHECK(inActiveDocument());
AttachContext reattachContext;
reattachContext.resolvedStyle = document().getNonAttachedStyle(*this);
bool layoutObjectWillChange = needsAttach() || layoutObject();
-
- // We are calling Element::rebuildLayoutTree() from inside
- // Element::recalcOwnStyle where we set the NeedsReattachLayoutTree
- // flag - so needsReattachLayoutTree() should always be true.
- DCHECK(parentNode());
- DCHECK(parentNode()->childNeedsReattachLayoutTree());
- DCHECK(needsReattachLayoutTree());
reattachLayoutTree(reattachContext);
- // Since needsReattachLayoutTree() is always true we go into
- // reattachLayoutTree() which reattaches all the descendant
- // sub-trees. At this point no child should need reattaching.
- DCHECK(!childNeedsReattachLayoutTree());
-
- if (layoutObjectWillChange || layoutObject()) {
- // nextTextSibling is passed on to recalcStyle from recalcDescendantStyles
- // we can either traverse the current subtree from this node onwards
- // or store it.
- // The choice is between increased time and increased memory complexity.
- reattachWhitespaceSiblingsIfNeeded(nextTextSibling());
+ if (layoutObjectWillChange || layoutObject())
return Reattach;
- }
return ReattachNoLayoutObject;
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698