Chromium Code Reviews| Index: Source/core/dom/Element.cpp |
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
| index b120e748a731d37a75f2f9e19dd732ca6e6816a8..8a7ddb7e75eff5e608f98bd52da3d5d3a2ea2113 100644 |
| --- a/Source/core/dom/Element.cpp |
| +++ b/Source/core/dom/Element.cpp |
| @@ -1525,6 +1525,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() && !layoutObject()) { |
| if (ElementAnimations* elementAnimations = elementRareData()->elementAnimations()) { |
| elementAnimations->cssAnimations().cancel(); |
| @@ -1691,6 +1696,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. |
| @@ -2757,9 +2764,12 @@ void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) |
| // Wait until our parent is not displayed or pseudoElementRendererIsNeeded |
| // is false, otherwise we could continuously create and destroy PseudoElements |
| // when LayoutObject::isChildAllowed on our parent returns false for the |
| - // PseudoElement's renderer for each style recalc. |
| - if (!layoutObject() || !pseudoElementRendererIsNeeded(layoutObject()->getCachedPseudoStyle(pseudoId))) |
| + // PseudoElement's layoutObject for each style recalc. |
| + if (!layoutObject() |
| + || (!pseudoElementRendererIsNeeded(layoutObject()->getCachedPseudoStyle(pseudoId)) |
| + && (pseudoId == MARKER && layoutObject()->style()->display() != LIST_ITEM))) { |
|
esprehn
2015/04/22 07:45:45
What's up with this check for != LIST_ITEM all ove
dsinclair
2015/04/22 20:00:38
If you have something like: <div style="display: l
|
| 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 |
| // first-letter pseudoElement and then fix the text of the original remaining |
| @@ -2793,16 +2803,16 @@ bool Element::updateFirstLetter(Element* element) |
| void Element::createPseudoElementIfNeeded(PseudoId pseudoId) |
| { |
| - if (isPseudoElement()) |
| + if (isPseudoElement() && (pseudoId != MARKER || isMarkerPseudoElement())) |
|
esprehn
2015/04/22 07:45:45
Marker shouldn't need a special case here. PseudoE
dsinclair
2015/04/22 20:00:38
With marker they can. If we have something like:
|
| return; |
| // Document::ensureStyleResolver is not inlined and shows up on profiles, avoid it here. |
| - RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensureResolver().createPseudoElementIfNeeded(*this, pseudoId); |
| + RefPtrWillBeRawPtr<PseudoElement> element = document().styleEngine().ensureResolver().createPseudoElementIfNeeded(*this, pseudoId); |
| if (!element) |
| return; |
| - |
| if (pseudoId == BACKDROP) |
| document().addToTopLayer(element.get(), this); |
| + |
| element->insertedInto(this); |
| element->attach(); |