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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Mirror setChildNeedsStyleRecalc and markAncestorsWithNeedsReattachLayoutTree with setChildNeedsReat… Created 3 years, 10 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 1e87792813ed10ae22ece3343ba8fafb276c9143..e13dffeb6a844bf150cc1d1bda059409d2b2014d 100644
--- a/third_party/WebKit/Source/core/dom/Text.cpp
+++ b/third_party/WebKit/Source/core/dom/Text.cpp
@@ -392,15 +392,30 @@ void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) {
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/16 05:49:25 I'm not sure how this is possible, I don't think i
nainar 2017/02/16 06:47:54 Done.
} else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) {
- rebuildTextLayoutTree(nextTextSibling);
+ StyleReattachData styleReattachData;
+ styleReattachData.nextTextSibling = nextTextSibling;
+ document().addStyleReattachData(*this, styleReattachData);
+ setNeedsReattachLayoutTree();
}
}
-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);
+ } else {
+ clearNeedsStyleRecalc();
esprehn 2017/02/16 05:49:25 how can this be true? reattachLayoutTree should ha
nainar 2017/02/16 06:47:54 Done.
+ }
clearNeedsReattachLayoutTree();
}

Powered by Google App Engine
This is Rietveld 408576698