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 7ab8e0701db4a629bac56af380740335743a2f07..c77bf86cff8aad5f0ca9e407265d14f89eab2877 100644 |
--- a/third_party/WebKit/Source/core/dom/Text.cpp |
+++ b/third_party/WebKit/Source/core/dom/Text.cpp |
@@ -346,12 +346,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); |
@@ -359,13 +364,13 @@ 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); |
+ LayoutObject* parentLayoutObject = |
+ LayoutTreeBuilderTraversal::parentLayoutObject(*this); |
+ if (styleParent && parentLayoutObject) { |
+ DCHECK(styleParent->computedStyle()); |
+ layoutObjectIsNeeded = textLayoutObjectIsNeeded( |
+ *styleParent->computedStyle(), *parentLayoutObject); |
} |
if (layoutObjectIsNeeded == !!layoutObject()) |
@@ -379,9 +384,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); |
} |