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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 template<typename SiblingTraversalStrategy> 131 template<typename SiblingTraversalStrategy>
132 bool checkPseudoClass(const SelectorCheckingContext&, const SiblingTraversal Strategy&, unsigned* specificity) const; 132 bool checkPseudoClass(const SelectorCheckingContext&, const SiblingTraversal Strategy&, unsigned* specificity) const;
133 template<typename SiblingTraversalStrategy> 133 template<typename SiblingTraversalStrategy>
134 bool checkPseudoElement(const SelectorCheckingContext&, const SiblingTravers alStrategy&) const; 134 bool checkPseudoElement(const SelectorCheckingContext&, const SiblingTravers alStrategy&) const;
135 135
136 bool checkScrollbarPseudoClass(const SelectorCheckingContext&, Document*, co nst CSSSelector&) const; 136 bool checkScrollbarPseudoClass(const SelectorCheckingContext&, Document*, co nst CSSSelector&) const;
137 template<typename SiblingTraversalStrategy> 137 template<typename SiblingTraversalStrategy>
138 bool checkPseudoHost(const SelectorCheckingContext&, const SiblingTraversalS trategy&, unsigned*) const; 138 bool checkPseudoHost(const SelectorCheckingContext&, const SiblingTraversalS trategy&, unsigned*) const;
139 139
140 static bool isFrameFocused(const Element&); 140 static bool isFrameFocused(const Element&);
141 bool shouldMatchHoverOrActive(const SelectorCheckingContext&) const;
141 142
142 bool m_strictParsing; 143 bool m_strictParsing;
143 Mode m_mode; 144 Mode m_mode;
144 }; 145 };
145 146
146 inline bool SelectorChecker::isCommonPseudoClassSelector(const CSSSelector& sele ctor) 147 inline bool SelectorChecker::isCommonPseudoClassSelector(const CSSSelector& sele ctor)
147 { 148 {
148 if (selector.match() != CSSSelector::PseudoClass) 149 if (selector.match() != CSSSelector::PseudoClass)
149 return false; 150 return false;
150 CSSSelector::PseudoType pseudoType = selector.pseudoType(); 151 CSSSelector::PseudoType pseudoType = selector.pseudoType();
(...skipping 21 matching lines...) Expand all
172 return true; 173 return true;
173 } 174 }
174 return false; 175 return false;
175 } 176 }
176 177
177 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const ContainerNode* scope) 178 inline bool SelectorChecker::isHostInItsShadowTree(const Element& element, const ContainerNode* scope)
178 { 179 {
179 return scope && scope->isInShadowTree() && scope->shadowHost() == element; 180 return scope && scope->isInShadowTree() && scope->shadowHost() == element;
180 } 181 }
181 182
183 inline bool SelectorChecker::shouldMatchHoverOrActive(const SelectorCheckingCont ext& context) const
184 {
185 // If we're in quirks mode, then :hover and :active should never match ancho rs with no
186 // href and *:hover and *:active should not match anything. This is specifie d in
187 // https://quirks.spec.whatwg.org/#the-:active-and-:hover-quirk
188 return m_strictParsing || context.isSubSelector || (context.selector->relati on() == CSSSelector::SubSelector && context.selector->tagHistory()) || context.e lement->isLink();
189 }
190
182 } 191 }
183 192
184 #endif 193 #endif
OLDNEW
« 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