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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Final patch - make sure to retain information needed to determine whether to call detachLayoutTree() Created 3 years, 11 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
Index: third_party/WebKit/Source/core/dom/Text.cpp
diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp
index 325cfb89ccaee816c99dae94a775edcd4f68b27c..a91d203ef44d8614c8a0de5a36943083c4687d10 100644
--- a/third_party/WebKit/Source/core/dom/Text.cpp
+++ b/third_party/WebKit/Source/core/dom/Text.cpp
@@ -394,16 +394,29 @@ void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) {
layoutItem.setStyle(document().ensureStyleResolver().styleForText(this));
if (needsStyleRecalc())
layoutItem.setText(dataImpl());
- clearNeedsStyleRecalc();
+ // In case we don't perform rebuildTextLayoutTree we will never clear the
+ // NeedsReattachLayoutTree flag which is set on the creation of each
+ // Node. Clear that here.
+ clearNeedsReattachLayoutTree();
esprehn 2017/02/02 08:37:10 How was this bit set without ended up inside rebui
nainar 2017/02/02 23:13:06 It was set on the text node's creation because Nee
} else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) {
- rebuildTextLayoutTree(nextTextSibling);
+ StyleReattachData styleReattachData;
+ styleReattachData.nextTextSibling = nextTextSibling;
+ document().addStyleReattachData(*this, styleReattachData);
+ setNeedsReattachLayoutTree();
}
+ clearNeedsStyleRecalc();
}
-void Text::rebuildTextLayoutTree(Text* nextTextSibling) {
+void Text::rebuildTextLayoutTree() {
+ DCHECK(!childNeedsStyleRecalc());
+ DCHECK(needsReattachLayoutTree());
+ DCHECK(parentNode());
+
reattachLayoutTree();
- if (layoutObject())
- reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
+ if (layoutObject()) {
+ reattachWhitespaceSiblingsIfNeeded(
+ document().getStyleReattachData(*this).nextTextSibling);
+ }
clearNeedsReattachLayoutTree();
}

Powered by Google App Engine
This is Rietveld 408576698