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..2205ec38952bcc4b32f10ee772fce43a4728d389 100644 |
--- a/third_party/WebKit/Source/core/dom/Text.cpp |
+++ b/third_party/WebKit/Source/core/dom/Text.cpp |
@@ -395,16 +395,28 @@ void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) { |
layoutItem.setStyle(document().ensureStyleResolver().styleForText(this)); |
if (needsStyleRecalc()) |
layoutItem.setText(dataImpl()); |
- clearNeedsStyleRecalc(); |
+ clearNeedsReattachLayoutTree(); |
nainar
2016/12/07 14:48:21
In case we don't perform rebuildTextLayoutTree we
Bugs Nash
2016/12/07 23:21:44
as above, if there is a need to explain the code i
nainar
2016/12/07 23:49:10
Done locally.
|
} else if (needsStyleRecalc() || needsWhitespaceLayoutObject()) { |
- rebuildTextLayoutTree(nextTextSibling); |
+ StyleReattachData styleReattachData; |
+ styleReattachData.computedStyle = nullptr; |
+ 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(); |
} |