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

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

Issue 1270313002: Handle closed mode shadow for /deep/ and ::shadow selectors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 4 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 | Annotate | Revision Log
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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 nextContext.isSubSelector = false; 411 nextContext.isSubSelector = false;
412 nextContext.inRightmostCompound = false; 412 nextContext.inRightmostCompound = false;
413 return matchSelector(nextContext, result); 413 return matchSelector(nextContext, result);
414 } 414 }
415 415
416 case CSSSelector::ShadowDeep: 416 case CSSSelector::ShadowDeep:
417 { 417 {
418 if (!context.isUARule) 418 if (!context.isUARule)
419 UseCounter::countDeprecation(context.element->document(), UseCou nter::CSSDeepCombinator); 419 UseCounter::countDeprecation(context.element->document(), UseCou nter::CSSDeepCombinator);
420 if (ShadowRoot* root = context.element->containingShadowRoot()) { 420 if (ShadowRoot* root = context.element->containingShadowRoot()) {
421 if (root->type() == ShadowRootType::UserAgent) 421 if (!root->isOpen())
422 return SelectorFailsCompletely; 422 return SelectorFailsCompletely;
423 } 423 }
424 424
425 if (context.selector->relationIsAffectedByPseudoContent()) { 425 if (context.selector->relationIsAffectedByPseudoContent()) {
426 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) { 426 for (Element* element = context.element; element; element = elem ent->parentOrShadowHostElement()) {
427 if (matchForShadowDistributed(nextContext, *element, result) == SelectorMatches) 427 if (matchForShadowDistributed(nextContext, *element, result) == SelectorMatches)
428 return SelectorMatches; 428 return SelectorMatches;
429 } 429 }
430 return SelectorFailsCompletely; 430 return SelectorFailsCompletely;
431 } 431 }
432 432
433 nextContext.isSubSelector = false; 433 nextContext.isSubSelector = false;
434 nextContext.inRightmostCompound = false; 434 nextContext.inRightmostCompound = false;
435 for (nextContext.element = context.element->parentOrShadowHostElemen t(); nextContext.element; nextContext.element = nextContext.element->parentOrSha dowHostElement()) { 435 for (nextContext.element = context.element->parentOrShadowHostElemen t(); nextContext.element; nextContext.element = nextContext.element->parentOrSha dowHostElement()) {
436 if (nextContext.element->closedShadowRoot())
437 return SelectorFailsCompletely;
436 Match match = matchSelector(nextContext, result); 438 Match match = matchSelector(nextContext, result);
437 if (match == SelectorMatches || match == SelectorFailsCompletely ) 439 if (match == SelectorMatches || match == SelectorFailsCompletely )
438 return match; 440 return match;
439 if (nextSelectorExceedsScope(nextContext)) 441 if (nextSelectorExceedsScope(nextContext))
440 return SelectorFailsCompletely; 442 return SelectorFailsCompletely;
441 } 443 }
442 return SelectorFailsCompletely; 444 return SelectorFailsCompletely;
443 } 445 }
444 446
445 case CSSSelector::SubSelector: 447 case CSSSelector::SubSelector:
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1179 }
1178 1180
1179 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1181 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1180 { 1182 {
1181 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1183 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1182 return true; 1184 return true;
1183 return element.focused() && isFrameFocused(element); 1185 return element.focused() && isFrameFocused(element);
1184 } 1186 }
1185 1187
1186 } 1188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698