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

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

Issue 1796573005: Do not show deprecation message for ::shadow and /deep/ on querySelector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix layout test expectation Created 4 years, 9 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 nextContext.element = ElementTraversal::previousSibling(*context.element ); 338 nextContext.element = ElementTraversal::previousSibling(*context.element );
339 for (; nextContext.element; nextContext.element = ElementTraversal::prev iousSibling(*nextContext.element)) { 339 for (; nextContext.element; nextContext.element = ElementTraversal::prev iousSibling(*nextContext.element)) {
340 Match match = matchSelector(nextContext, result); 340 Match match = matchSelector(nextContext, result);
341 if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely) 341 if (match == SelectorMatches || match == SelectorFailsAllSiblings || match == SelectorFailsCompletely)
342 return match; 342 return match;
343 } 343 }
344 return SelectorFailsAllSiblings; 344 return SelectorFailsAllSiblings;
345 345
346 case CSSSelector::ShadowPseudo: 346 case CSSSelector::ShadowPseudo:
347 { 347 {
348 if (!m_isUARule && context.selector->getPseudoType() == CSSSelector: :PseudoShadow) 348 if (!m_isUARule && !m_isQuerySelector && context.selector->getPseudo Type() == CSSSelector::PseudoShadow)
349 Deprecation::countDeprecation(context.element->document(), UseCo unter::CSSSelectorPseudoShadow); 349 Deprecation::countDeprecation(context.element->document(), UseCo unter::CSSSelectorPseudoShadow);
350 // 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. 350 // 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.
351 if (context.scope && context.scope->shadowHost() && context.scope->s hadowHost()->treeScope() == context.element->treeScope()) 351 if (context.scope && context.scope->shadowHost() && context.scope->s hadowHost()->treeScope() == context.element->treeScope())
352 return SelectorFailsCompletely; 352 return SelectorFailsCompletely;
353 353
354 Element* shadowHost = context.element->shadowHost(); 354 Element* shadowHost = context.element->shadowHost();
355 if (!shadowHost) 355 if (!shadowHost)
356 return SelectorFailsCompletely; 356 return SelectorFailsCompletely;
357 nextContext.element = shadowHost; 357 nextContext.element = shadowHost;
358 return matchSelector(nextContext, result); 358 return matchSelector(nextContext, result);
359 } 359 }
360 360
361 case CSSSelector::ShadowDeep: 361 case CSSSelector::ShadowDeep:
362 { 362 {
363 if (!m_isUARule) 363 if (!m_isUARule && !m_isQuerySelector)
364 Deprecation::countDeprecation(context.element->document(), UseCo unter::CSSDeepCombinator); 364 Deprecation::countDeprecation(context.element->document(), UseCo unter::CSSDeepCombinator);
365 if (ShadowRoot* root = context.element->containingShadowRoot()) { 365 if (ShadowRoot* root = context.element->containingShadowRoot()) {
366 if (root->type() == ShadowRootType::UserAgent) 366 if (root->type() == ShadowRootType::UserAgent)
367 return SelectorFailsCompletely; 367 return SelectorFailsCompletely;
368 } 368 }
369 369
370 if (context.selector->relationIsAffectedByPseudoContent()) { 370 if (context.selector->relationIsAffectedByPseudoContent()) {
371 // TODO(kochi): closed mode tree should be handled as well for : :content. 371 // TODO(kochi): closed mode tree should be handled as well for : :content.
372 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) { 372 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) {
373 if (matchForPseudoContent(nextContext, *element, result) == SelectorMatches) 373 if (matchForPseudoContent(nextContext, *element, result) == SelectorMatches)
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 } 1143 }
1144 1144
1145 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1145 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1146 { 1146 {
1147 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1147 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1148 return true; 1148 return true;
1149 return element.focused() && isFrameFocused(element); 1149 return element.focused() && isFrameFocused(element);
1150 } 1150 }
1151 1151
1152 } // namespace blink 1152 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/SelectorChecker.h ('k') | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698