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 4017f379c8cca22e0fe45e387d703b258ae3d24a..22cf9b25fbfc1fca0762f2db91de6df39a2f1571 100644 |
| --- a/third_party/WebKit/Source/core/dom/Text.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Text.cpp |
| @@ -350,12 +350,17 @@ LayoutText* Text::createTextLayoutObject(const ComputedStyle& style) { |
| } |
| void Text::attachLayoutTree(const AttachContext& context) { |
| - if (ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this)) { |
| - if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) { |
| - if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), |
| - *parentLayoutObject)) |
| - LayoutTreeBuilderForText(*this, parentLayoutObject) |
| - .createLayoutObject(); |
| + ContainerNode* styleParent = LayoutTreeBuilderTraversal::parent(*this); |
| + LayoutObject* parentLayoutObject = |
| + LayoutTreeBuilderTraversal::parentLayoutObject(*this); |
| + |
| + if (styleParent && parentLayoutObject) { |
| + DCHECK(styleParent->computedStyle()); |
| + if (textLayoutObjectIsNeeded(*styleParent->computedStyle(), |
| + *parentLayoutObject)) { |
| + LayoutTreeBuilderForText(*this, parentLayoutObject, |
| + styleParent->mutableComputedStyle()) |
| + .createLayoutObject(); |
| } |
| } |
| CharacterData::attachLayoutTree(context); |
| @@ -363,13 +368,12 @@ void Text::attachLayoutTree(const AttachContext& context) { |
| void Text::reattachLayoutTreeIfNeeded(const AttachContext& context) { |
| bool layoutObjectIsNeeded = false; |
| - ContainerNode* layoutParent = LayoutTreeBuilderTraversal::parent(*this); |
| - if (layoutParent) { |
| - if (LayoutObject* parentLayoutObject = layoutParent->layoutObject()) { |
| - if (textLayoutObjectIsNeeded(*parentLayoutObject->style(), |
| - *parentLayoutObject)) |
| - layoutObjectIsNeeded = true; |
| - } |
| + ContainerNode* styleParent = LayoutTreeBuilderTraversal::parent(*this); |
|
jfernandez
2016/10/27 17:08:02
What's the rationale of this variable name change
|
| + LayoutObject* parentLayoutObject = |
| + LayoutTreeBuilderTraversal::parentLayoutObject(*this); |
| + if (styleParent && parentLayoutObject) { |
| + layoutObjectIsNeeded = textLayoutObjectIsNeeded( |
| + *styleParent->computedStyle(), *parentLayoutObject); |
| } |
| if (layoutObjectIsNeeded == !!layoutObject()) |
| @@ -383,9 +387,11 @@ void Text::reattachLayoutTreeIfNeeded(const AttachContext& context) { |
| if (getStyleChangeType() < NeedsReattachStyleChange) |
| detachLayoutTree(reattachContext); |
| - if (layoutObjectIsNeeded) |
| - LayoutTreeBuilderForText(*this, layoutParent->layoutObject()) |
| + if (layoutObjectIsNeeded) { |
| + LayoutTreeBuilderForText(*this, parentLayoutObject, |
| + styleParent->mutableComputedStyle()) |
| .createLayoutObject(); |
| + } |
| CharacterData::attachLayoutTree(reattachContext); |
| } |