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

Unified Diff: Source/core/dom/Element.cpp

Issue 778003003: List marker pseudo elements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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: 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();

Powered by Google App Engine
This is Rietveld 408576698