| Index: Source/core/css/resolver/StyleResolver.cpp
|
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
|
| index 9c192f2eaceb76e32a6280ccf10d7a2832dac874..8795e694bd2e7a11dfadeb9ef33c47c73c76f8cb 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,41 @@ PassRefPtrWillBeRawPtr<AnimatableValue> StyleResolver::createAnimatableValueSnap
|
|
|
| PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element* parent, PseudoId pseudoId)
|
| {
|
| + if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER)
|
| + return MarkerPseudoElement::create(parent);
|
| if (pseudoId == FIRST_LETTER)
|
| return FirstLetterPseudoElement::create(parent);
|
| return PseudoElement::create(parent, pseudoId);
|
| }
|
|
|
| +bool StyleResolver::pseudoElementRequired(PseudoId pseudoId, LayoutObject& parentRenderer)
|
| +{
|
| + if (pseudoId == FIRST_LETTER)
|
| + return true;
|
| + if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && 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* parentRenderer = parent.layoutObject();
|
| if (!parentRenderer)
|
| 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 && !parentRenderer->style()->hasPseudoStyle(pseudoId))
|
| + if (!pseudoElementRequired(pseudoId, *parentRenderer))
|
| 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 (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER && parentRenderer->style()->display() != LIST_ITEM)
|
| + return nullptr;
|
| +
|
| if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudoElement::firstLetterTextRenderer(parent)))
|
| return nullptr;
|
|
|
| @@ -801,10 +818,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 || parentStyle->display() != LIST_ITEM)
|
| return false;
|
|
|
| - applyMatchedProperties(state, collector.matchedResult());
|
| applyCallbackSelectors(state);
|
|
|
| // Cache our original display.
|
|
|