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

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

Issue 1605523002: Removed selector matching check for invalid pseudo elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-pseudoelm-check-1-20160118
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 ASSERT(context.selector->tagHistory()); 273 ASSERT(context.selector->tagHistory());
274 nextContext.selector = context.selector->tagHistory(); 274 nextContext.selector = context.selector->tagHistory();
275 return nextContext; 275 return nextContext;
276 } 276 }
277 277
278 SelectorChecker::Match SelectorChecker::matchForSubSelector(const SelectorChecki ngContext& context, MatchResult& result) const 278 SelectorChecker::Match SelectorChecker::matchForSubSelector(const SelectorChecki ngContext& context, MatchResult& result) const
279 { 279 {
280 SelectorCheckingContext nextContext = prepareNextContextForRelation(context) ; 280 SelectorCheckingContext nextContext = prepareNextContextForRelation(context) ;
281 281
282 PseudoId dynamicPseudo = result.dynamicPseudo; 282 PseudoId dynamicPseudo = result.dynamicPseudo;
283 // a selector is invalid if something follows a pseudo-element
284 // We make an exception for scrollbar pseudo elements and allow a set of pse udo classes (but nothing else)
285 // to follow the pseudo elements.
286 nextContext.hasScrollbarPseudo = dynamicPseudo != NOPSEUDO && (context.scrol lbar || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER); 283 nextContext.hasScrollbarPseudo = dynamicPseudo != NOPSEUDO && (context.scrol lbar || dynamicPseudo == SCROLLBAR_CORNER || dynamicPseudo == RESIZER);
287 nextContext.hasSelectionPseudo = dynamicPseudo == SELECTION; 284 nextContext.hasSelectionPseudo = dynamicPseudo == SELECTION;
288 if ((context.inRightmostCompound || m_mode == CollectingCSSRules || m_mode = = CollectingStyleRules || m_mode == QueryingRules) && dynamicPseudo != NOPSEUDO
289 && !nextContext.hasSelectionPseudo
290 && !(nextContext.hasScrollbarPseudo && nextContext.selector->match() == CSSSelector::PseudoClass))
291 return SelectorFailsCompletely;
292
293 nextContext.isSubSelector = true; 285 nextContext.isSubSelector = true;
294 return matchSelector(nextContext, result); 286 return matchSelector(nextContext, result);
295 } 287 }
296 288
297 static inline bool isV0ShadowRoot(const Node* node) 289 static inline bool isV0ShadowRoot(const Node* node)
298 { 290 {
299 return node && node->isShadowRoot() && toShadowRoot(node)->type() == ShadowR ootType::V0; 291 return node && node->isShadowRoot() && toShadowRoot(node)->type() == ShadowR ootType::V0;
300 } 292 }
301 293
302 SelectorChecker::Match SelectorChecker::matchForPseudoShadow(const SelectorCheck ingContext& context, const ContainerNode* node, MatchResult& result) const 294 SelectorChecker::Match SelectorChecker::matchForPseudoShadow(const SelectorCheck ingContext& context, const ContainerNode* node, MatchResult& result) const
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 } 1186 }
1195 1187
1196 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1188 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1197 { 1189 {
1198 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1190 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1199 return true; 1191 return true;
1200 return element.focused() && isFrameFocused(element); 1192 return element.focused() && isFrameFocused(element);
1201 } 1193 }
1202 1194
1203 } 1195 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698