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

Side by Side Diff: third_party/WebKit/Source/core/css/SelectorChecker.cpp

Issue 1972713002: Multiple :hover/:active incorrectly matching in quirks mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Windows compile error Created 4 years, 7 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 static bool shouldMatchHoverOrActive(const SelectorChecker::SelectorCheckingCont ext& context) 149 static bool shouldMatchHoverOrActive(const SelectorChecker::SelectorCheckingCont ext& context)
150 { 150 {
151 // If we're in quirks mode, then :hover and :active should never match ancho rs with no 151 // If we're in quirks mode, then :hover and :active should never match ancho rs with no
152 // href and *:hover and *:active should not match anything. This is specifie d in 152 // href and *:hover and *:active should not match anything. This is specifie d in
153 // https://quirks.spec.whatwg.org/#the-:active-and-:hover-quirk 153 // https://quirks.spec.whatwg.org/#the-:active-and-:hover-quirk
154 if (!context.element->document().inQuirksMode()) 154 if (!context.element->document().inQuirksMode())
155 return true; 155 return true;
156 if (context.isSubSelector) 156 if (context.isSubSelector)
157 return true; 157 return true;
158 if (context.selector->relation() == CSSSelector::SubSelector && context.sele ctor->tagHistory()) 158 if (context.element->isLink())
159 return true; 159 return true;
160 return context.element->isLink(); 160 const CSSSelector* selector = context.selector;
161 while (selector->relation() == CSSSelector::SubSelector && selector->tagHist ory()) {
162 selector = selector->tagHistory();
163 if (selector->match() != CSSSelector::PseudoClass)
164 return true;
165 if (selector->getPseudoType() != CSSSelector::PseudoHover && selector->g etPseudoType() != CSSSelector::PseudoActive)
166 return true;
167 }
168 return false;
161 } 169 }
162 170
163 static bool isFirstChild(Element& element) 171 static bool isFirstChild(Element& element)
164 { 172 {
165 return !ElementTraversal::previousSibling(element); 173 return !ElementTraversal::previousSibling(element);
166 } 174 }
167 175
168 static bool isLastChild(Element& element) 176 static bool isLastChild(Element& element)
169 { 177 {
170 return !ElementTraversal::nextSibling(element); 178 return !ElementTraversal::nextSibling(element);
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 } 1143 }
1136 1144
1137 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1145 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1138 { 1146 {
1139 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1147 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1140 return true; 1148 return true;
1141 return element.focused() && isFrameFocused(element); 1149 return element.focused() && isFrameFocused(element);
1142 } 1150 }
1143 1151
1144 } // namespace blink 1152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698