Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index 092a92c5d5ca550d397f6ecc7a90e669b7d6720a..8558f90919029868744a1ca08ade56ffb5e73c16 100644 |
--- a/Source/core/css/resolver/StyleResolver.cpp |
+++ b/Source/core/css/resolver/StyleResolver.cpp |
@@ -70,6 +70,7 @@ |
#include "core/css/resolver/ViewportStyleResolver.h" |
#include "core/dom/CSSSelectorWatch.h" |
#include "core/dom/FirstLetterPseudoElement.h" |
+#include "core/dom/MarkerPseudoElement.h" |
#include "core/dom/NodeComputedStyle.h" |
#include "core/dom/StyleEngine.h" |
#include "core/dom/Text.h" |
@@ -713,25 +714,43 @@ PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap |
PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element* parent, PseudoId pseudoId) |
{ |
+ if (pseudoId == MARKER) { |
+ ASSERT(RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()); |
+ return MarkerPseudoElement::create(parent); |
+ } |
if (pseudoId == FIRST_LETTER) |
return FirstLetterPseudoElement::create(parent); |
return PseudoElement::create(parent, pseudoId); |
} |
+static bool pseudoElementRequired(PseudoId pseudoId, LayoutObject& parentRenderer) |
+{ |
+ if (pseudoId == FIRST_LETTER) |
+ return true; |
+ if (pseudoId == MARKER) |
+ return true; |
+ if (parentRenderer.style()->hasPseudoStyle(pseudoId)) |
+ return true; |
+ return pseudoId >= FIRST_INTERNAL_PSEUDOID; |
+} |
+ |
PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded(Element& parent, PseudoId pseudoId) |
{ |
LayoutObject* parentLayoutObject = parent.layoutObject(); |
if (!parentLayoutObject) |
return nullptr; |
- // The first letter pseudo element has to look up the tree and see if any |
- // of the ancestors are first letter. |
- if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && !parentLayoutObject->style()->hasPseudoStyle(pseudoId)) |
+ if (!pseudoElementRequired(pseudoId, *parentLayoutObject)) |
return nullptr; |
if (pseudoId == BACKDROP && !parent.isInTopLayer()) |
return nullptr; |
+ // FIXME: This should also probably take inline-list-item into account when |
+ // we add support. |
+ if (pseudoId == MARKER && parentLayoutObject->style()->display() != LIST_ITEM) |
+ return nullptr; |
+ |
if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudoElement::firstLetterTextRenderer(parent))) |
return nullptr; |
@@ -801,10 +820,11 @@ bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo |
matchUARules(collector); |
matchAuthorRules(state.element(), collector, false); |
- if (collector.matchedResult().matchedProperties.isEmpty()) |
+ if (!collector.matchedResult().matchedProperties.isEmpty()) |
+ applyMatchedProperties(state, collector.matchedResult()); |
+ else if (pseudoStyleRequest.pseudoId != MARKER) |
return false; |
- applyMatchedProperties(state, collector.matchedResult()); |
applyCallbackSelectors(state); |
// Cache our original display. |