Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index ec3e3cab6ba4461399d2e34149e40d9f994f4e9b..3be6fd48abb5d1984fe989aacf138b89e322ec94 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -1463,6 +1463,11 @@ void Element::attach(const AttachContext& context) |
// from any of them. |
createPseudoElementIfNeeded(FIRST_LETTER); |
+ // The marker has to come after the other content, including the BEFORE pseudo |
+ // element so make sure we create it last. |
+ if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
+ createPseudoElementIfNeeded(MARKER); |
+ |
if (hasRareData() && !renderer()) { |
if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations()) { |
activeAnimations->cssAnimations().cancel(); |
@@ -1626,6 +1631,8 @@ void Element::recalcStyle(StyleRecalcChange change, Text* nextTextSibling) |
updatePseudoElement(AFTER, change); |
updatePseudoElement(BACKDROP, change); |
+ if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled()) |
+ updatePseudoElement(MARKER, change); |
// If our children have changed then we need to force the first-letter |
// checks as we don't know if they effected the first letter or not. |
@@ -2632,7 +2639,8 @@ void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) |
// is false, otherwise we could continuously create and destroy PseudoElements |
// when RenderObject::isChildAllowed on our parent returns false for the |
// PseudoElement's renderer for each style recalc. |
- if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId))) |
+ if (!renderer() |
+ || (!pseudoElementRendererIsNeeded(renderer()->getCachedPseudoStyle(pseudoId)) && (pseudoId == MARKER && renderer()->style()->display() != LIST_ITEM))) |
elementRareData()->setPseudoElement(pseudoId, nullptr); |
} else if (pseudoId == FIRST_LETTER && element && change >= UpdatePseudoElements && !FirstLetterPseudoElement::firstLetterTextRenderer(*element)) { |
// This can happen if we change to a float, for example. We need to cleanup the |
@@ -2667,7 +2675,7 @@ bool Element::updateFirstLetter(Element* element) |
void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
{ |
- if (isPseudoElement()) |
+ if (isPseudoElement() && (pseudoId != MARKER || isMarkerPseudoElement())) |
return; |
// Document::ensureStyleResolver is not inlined and shows up on profiles, avoid it here. |
@@ -2675,9 +2683,9 @@ void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
RefPtrWillBeRawPtr<PseudoElement> element = engine->ensureResolver().createPseudoElementIfNeeded(*this, pseudoId); |
if (!element) |
return; |
- |
if (pseudoId == BACKDROP) |
document().addToTopLayer(element.get(), this); |
+ |
element->insertedInto(this); |
element->attach(); |