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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 2789283003: [css-display] Support pseudo-elements on display: contents elements. (Closed)
Patch Set: Created 3 years, 8 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/css/resolver/StyleResolver.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
index 7bec57d2a31bccc757cfb78acd0ad13c2691ce41..8367155174afee758de04aed6bdefb5f0bc70529 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp
@@ -826,15 +826,27 @@ PseudoElement* StyleResolver::createPseudoElement(Element* parent,
PseudoElement* StyleResolver::createPseudoElementIfNeeded(Element& parent,
PseudoId pseudoId) {
+ if (!parent.canGeneratePseudoElement(pseudoId))
+ return nullptr;
+
LayoutObject* parentLayoutObject = parent.layoutObject();
+ if (!parentLayoutObject) {
+ DCHECK(parent.hasDisplayContentsStyle());
+ parentLayoutObject = LayoutTreeBuilderTraversal::parentLayoutObject(parent);
+ }
+
if (!parentLayoutObject)
return nullptr;
+ ComputedStyle* parentStyle = parent.mutableComputedStyle();
+ DCHECK(parentStyle);
+
// The first letter pseudo element has to look up the tree and see if any
// of the ancestors are first letter.
if (pseudoId < FirstInternalPseudoId && pseudoId != PseudoIdFirstLetter &&
- !parentLayoutObject->style()->hasPseudoStyle(pseudoId))
+ !parentStyle->hasPseudoStyle(pseudoId)) {
return nullptr;
+ }
if (pseudoId == PseudoIdBackdrop && !parent.isInTopLayer())
return nullptr;
@@ -847,7 +859,6 @@ PseudoElement* StyleResolver::createPseudoElementIfNeeded(Element& parent,
if (!canHaveGeneratedChildren(*parentLayoutObject))
return nullptr;
- ComputedStyle* parentStyle = parentLayoutObject->mutableStyle();
if (ComputedStyle* cachedStyle =
parentStyle->getCachedPseudoStyle(pseudoId)) {
if (!pseudoElementLayoutObjectIsNeeded(cachedStyle))
@@ -855,7 +866,8 @@ PseudoElement* StyleResolver::createPseudoElementIfNeeded(Element& parent,
return createPseudoElement(&parent, pseudoId);
}
- StyleResolverState state(document(), &parent, parentStyle, parentStyle);
+ StyleResolverState state(document(), &parent, parentStyle,
+ parentLayoutObject->style());
if (!pseudoStyleForElementInternal(parent, pseudoId, parentStyle, state))
return nullptr;
RefPtr<ComputedStyle> style = state.takeStyle();
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Element.h » ('j') | third_party/WebKit/Source/core/dom/Element.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698