Chromium Code Reviews| Index: Source/core/css/resolver/StyleResolver.cpp |
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
| index 67b90d34bce5e301c130635d50d4fa46e0c24e9c..ab8be175e07647986add26323f38da5c425e683d 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/NodeRenderStyle.h" |
| #include "core/dom/StyleEngine.h" |
| #include "core/dom/Text.h" |
| @@ -720,25 +721,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, RenderObject& 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) |
| { |
| RenderObject* parentRenderer = parent.renderer(); |
| 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) |
|
Julien - ping for review
2015/02/04 01:56:33
pseudoId == MARKER && parentRenderer->style()->dis
dsinclair
2015/02/04 15:30:59
They're slightly different. This one is == && != a
|
| + return nullptr; |
| + |
| if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudoElement::firstLetterTextRenderer(parent))) |
| return nullptr; |
| @@ -808,10 +825,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) |
|
Julien - ping for review
2015/02/04 01:56:33
This code is pretty confusing now IMHO. Keeping th
dsinclair
2015/02/04 04:41:33
Not sure what you mean, do you mean keeping the ol
|
| return false; |
| - applyMatchedProperties(state, collector.matchedResult()); |
| applyCallbackSelectors(state); |
| // Cache our original display. |