Index: Source/core/css/SelectorChecker.h |
diff --git a/Source/core/css/SelectorChecker.h b/Source/core/css/SelectorChecker.h |
index 0e3357b94bab90fbc4b3090e64e89f2e16985189..1b6bd08f16f448a1aa588d92e23077546db48b68 100644 |
--- a/Source/core/css/SelectorChecker.h |
+++ b/Source/core/css/SelectorChecker.h |
@@ -138,6 +138,7 @@ private: |
bool checkPseudoHost(const SelectorCheckingContext&, const SiblingTraversalStrategy&, unsigned*) const; |
static bool isFrameFocused(const Element&); |
+ bool shouldMatchHoverOrActive(const SelectorCheckingContext&) const; |
bool m_strictParsing; |
Mode m_mode; |
@@ -179,6 +180,14 @@ inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const |
return scope && scope->isInShadowTree() && scope->shadowHost() == element; |
} |
+inline bool SelectorChecker::shouldMatchHoverOrActive(const SelectorCheckingContext& context) const |
+{ |
+ // If we're in quirks mode, then :hover and :active should never match anchors with no |
+ // href and *:hover and *:active should not match anything. This is specified in |
+ // https://quirks.spec.whatwg.org/#the-:active-and-:hover-quirk |
+ return m_strictParsing || context.isSubSelector || (context.selector->relation() == CSSSelector::SubSelector && context.selector->tagHistory()) || context.element->isLink(); |
+} |
+ |
} |
#endif |