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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: For review 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Text.h ('k') | third_party/WebKit/Source/core/dom/shadow/ShadowRoot.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/Text.cpp
diff --git a/third_party/WebKit/Source/core/dom/Text.cpp b/third_party/WebKit/Source/core/dom/Text.cpp
index 8c6d94d84da28da44e1804c14189c4dd5b893beb..144783a005d704b0bfb7e0a9a7b1a8819f37ff92 100644
--- a/third_party/WebKit/Source/core/dom/Text.cpp
+++ b/third_party/WebKit/Source/core/dom/Text.cpp
@@ -395,16 +395,31 @@ 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();
} else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) {
- rebuildTextLayoutTree(nextTextSibling);
+ StyleReattachData styleReattachData;
+ styleReattachData.computedStyle = nullptr;
esprehn 2016/12/13 01:19:03 You can add = nullptr in the struct itself so this
+ styleReattachData.nextTextSibling = nextTextSibling;
+ document().addStyleReattachData(*this, styleReattachData);
+ setNeedsReattachLayoutTree();
}
+ clearNeedsStyleRecalc();
}
-void Text::rebuildTextLayoutTree(Text* nextTextSibling) {
+void Text::rebuildTextLayoutTree() {
+ DCHECK(!needsStyleRecalc());
+ DCHECK(!childNeedsStyleRecalc());
+ DCHECK(needsReattachLayoutTree());
+ DCHECK(parentNode());
+
reattachLayoutTree();
- if (layoutObject())
- reattachWhitespaceSiblingsIfNeeded(nextTextSibling);
+ if (layoutObject()) {
+ reattachWhitespaceSiblingsIfNeeded(
+ document().getStyleReattachData(*this).nextTextSibling);
+ }
clearNeedsReattachLayoutTree();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Text.h ('k') | third_party/WebKit/Source/core/dom/shadow/ShadowRoot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698