Chromium Code Reviews| 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..f87dfdac28040b2ea19033535613c641f90e4b16 100644 |
| --- a/third_party/WebKit/Source/core/dom/Text.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Text.cpp |
| @@ -381,7 +381,7 @@ void Text::reattachLayoutTreeIfNeeded(const AttachContext& context) { |
| AttachContext reattachContext(context); |
| reattachContext.performingReattach = true; |
| - if (getStyleChangeType() < NeedsReattachStyleChange) |
| + if (getStyleChangeType() <= SubtreeStyleChange) |
|
nainar
2016/11/29 06:13:39
Again this will always be true. Make it a no op? O
rune
2016/12/05 10:05:17
Replace with !needsReattachLayoutTree(), I think.
|
| detachLayoutTree(reattachContext); |
| if (layoutObjectIsNeeded) |
| LayoutTreeBuilderForText(*this, layoutParent->layoutObject()) |
| @@ -395,16 +395,26 @@ void Text::recalcTextStyle(StyleRecalcChange change, Text* nextTextSibling) { |
| layoutItem.setStyle(document().ensureStyleResolver().styleForText(this)); |
| if (needsStyleRecalc()) |
| layoutItem.setText(dataImpl()); |
| - clearNeedsStyleRecalc(); |
| } 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()); |
| + |
| reattachLayoutTree(); |
| - if (layoutObject()) |
| - reattachWhitespaceSiblingsIfNeeded(nextTextSibling); |
| + if (layoutObject()) { |
| + reattachWhitespaceSiblingsIfNeeded( |
| + document().getStyleReattachData(*this).nextTextSibling); |
| + } |
| clearNeedsReattachLayoutTree(); |
| } |