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

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

Issue 2450093005: Support display: contents for elements, first-line and first-letter pseudos. (Closed)
Patch Set: Support display: contents for elements, first-line and first-letter pseudos. Created 3 years, 10 months 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698