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

Unified Diff: Source/core/css/SelectorChecker.h

Issue 848853004: Support :hover/:active in quirks when leftmost in compound. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved comments 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
« no previous file with comments | « LayoutTests/fast/css/hover-pseudo-element-quirks-expected.txt ('k') | Source/core/css/SelectorChecker.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « LayoutTests/fast/css/hover-pseudo-element-quirks-expected.txt ('k') | Source/core/css/SelectorChecker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698