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

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

Issue 1166833002: Add a deprecation message for shadow-piercing descendant combinators and shadow pseudo elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase further Created 5 years, 6 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 nextContext.inRightmostCompound = false; 391 nextContext.inRightmostCompound = false;
392 for (; nextContext.element; nextContext.element = ElementTraversal::prev iousSibling(*nextContext.element)) { 392 for (; nextContext.element; nextContext.element = ElementTraversal::prev iousSibling(*nextContext.element)) {
393 Match match = matchSelector(nextContext, result); 393 Match match = matchSelector(nextContext, result);
394 if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely) 394 if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely)
395 return match; 395 return match;
396 }; 396 };
397 return SelectorFailsAllSiblings; 397 return SelectorFailsAllSiblings;
398 398
399 case CSSSelector::ShadowPseudo: 399 case CSSSelector::ShadowPseudo:
400 { 400 {
401 if (!context.isUARule && context.selector->pseudoType() == CSSSelect or::PseudoShadow)
402 UseCounter::countDeprecation(context.element->document(), UseCou nter::CSSSelectorPseudoShadow);
401 // If we're in the same tree-scope as the scoping element, then foll owing a shadow descendant combinator would escape that and thus the scope. 403 // If we're in the same tree-scope as the scoping element, then foll owing a shadow descendant combinator would escape that and thus the scope.
402 if (context.scope && context.scope->shadowHost() && context.scope->s hadowHost()->treeScope() == context.element->treeScope()) 404 if (context.scope && context.scope->shadowHost() && context.scope->s hadowHost()->treeScope() == context.element->treeScope())
403 return SelectorFailsCompletely; 405 return SelectorFailsCompletely;
404 406
405 Element* shadowHost = context.element->shadowHost(); 407 Element* shadowHost = context.element->shadowHost();
406 if (!shadowHost) 408 if (!shadowHost)
407 return SelectorFailsCompletely; 409 return SelectorFailsCompletely;
408 nextContext.element = shadowHost; 410 nextContext.element = shadowHost;
409 nextContext.isSubSelector = false; 411 nextContext.isSubSelector = false;
410 nextContext.inRightmostCompound = false; 412 nextContext.inRightmostCompound = false;
411 return matchSelector(nextContext, result); 413 return matchSelector(nextContext, result);
412 } 414 }
413 415
414 case CSSSelector::ShadowDeep: 416 case CSSSelector::ShadowDeep:
415 { 417 {
418 if (!context.isUARule)
419 UseCounter::countDeprecation(context.element->document(), UseCou nter::CSSDeepCombinator);
416 if (ShadowRoot* root = context.element->containingShadowRoot()) { 420 if (ShadowRoot* root = context.element->containingShadowRoot()) {
417 if (root->type() == ShadowRoot::UserAgentShadowRoot) 421 if (root->type() == ShadowRoot::UserAgentShadowRoot)
418 return SelectorFailsCompletely; 422 return SelectorFailsCompletely;
419 } 423 }
420 424
421 if (context.selector->relationIsAffectedByPseudoContent()) { 425 if (context.selector->relationIsAffectedByPseudoContent()) {
422 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) { 426 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) {
423 if (matchForShadowDistributed(nextContext, *element, result) == SelectorMatches) 427 if (matchForShadowDistributed(nextContext, *element, result) == SelectorMatches)
424 return SelectorMatches; 428 return SelectorMatches;
425 } 429 }
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 } 1179 }
1176 1180
1177 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1181 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1178 { 1182 {
1179 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1183 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1180 return true; 1184 return true;
1181 return element.focused() && isFrameFocused(element); 1185 return element.focused() && isFrameFocused(element);
1182 } 1186 }
1183 1187
1184 } 1188 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/stylesheets-order-in-shadow-dom-expected.txt ('k') | Source/core/css/parser/CSSSelectorParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698