Index: Source/core/css/resolver/StyleResolver.cpp |
diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp |
index e9eda560bf4c5c44413caf09d86b8f2c2bc4c5c9..9d7e31a46c0c88abaf82b6c294578a27125c6870 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); |
esprehn
2015/04/22 07:45:45
if (pseudoId == MARKER) {
ASSERT(RuntimeEnabledF
dsinclair
2015/04/22 20:00:38
Done.
|
if (pseudoId == FIRST_LETTER) |
return FirstLetterPseudoElement::create(parent); |
return PseudoElement::create(parent, pseudoId); |
} |
+bool StyleResolver::pseudoElementRequired(PseudoId pseudoId, LayoutObject& parentRenderer) |
esprehn
2015/04/22 07:45:45
This function doesn't use any state on |this|, it
dsinclair
2015/04/22 20:00:38
Done.
|
+{ |
+ if (pseudoId == FIRST_LETTER) |
+ return true; |
+ if (RuntimeEnabledFeatures::listMarkerPseudoElementEnabled() && pseudoId == MARKER) |
esprehn
2015/04/22 07:45:44
I don't think you need the RuntimeEnabledFeatures
dsinclair
2015/04/22 20:00:38
Done.
|
+ 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) |
esprehn
2015/04/22 07:45:45
ditto, no runtime check.
dsinclair
2015/04/22 20:00:38
Done.
|
+ 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) |
esprehn
2015/04/22 07:45:45
Can you explain this? Why is MARKER and LIST_ITEM
dsinclair
2015/04/22 20:00:38
The LIST_ITEM bit was removed. The MARKER bit is r
|
return false; |
- applyMatchedProperties(state, collector.matchedResult()); |
applyCallbackSelectors(state); |
// Cache our original display. |