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

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: add a layout test for 2 /deep/s 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
436 Element* element = context.element;
hayato 2015/08/20 03:47:11 I'm afraid that it would be difficult to read what
kochi 2015/08/20 06:04:26 Done.
437 while (true) {
438 if (element->parentNode() && element->parentNode()->isShadowRoot ()) {
439 if (!toShadowRoot(element->parentNode())->isOpen())
440 break;
441 }
442 element = element->parentOrShadowHostElement();
443 if (!element)
444 break;
445
446 nextContext.element = element;
436 Match match = matchSelector(nextContext, result); 447 Match match = matchSelector(nextContext, result);
437 if (match == SelectorMatches || match == SelectorFailsCompletely ) 448 if (match == SelectorMatches || match == SelectorFailsCompletely )
438 return match; 449 return match;
439 if (nextSelectorExceedsScope(nextContext)) 450 if (nextSelectorExceedsScope(nextContext))
440 return SelectorFailsCompletely; 451 break;
441 } 452 }
442 return SelectorFailsCompletely; 453 return SelectorFailsCompletely;
443 } 454 }
444 455
445 case CSSSelector::SubSelector: 456 case CSSSelector::SubSelector:
446 ASSERT_NOT_REACHED(); 457 ASSERT_NOT_REACHED();
447 } 458 }
448 459
449 ASSERT_NOT_REACHED(); 460 ASSERT_NOT_REACHED();
450 return SelectorFailsCompletely; 461 return SelectorFailsCompletely;
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1188 }
1178 1189
1179 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1190 bool SelectorChecker::matchesFocusPseudoClass(const Element& element)
1180 { 1191 {
1181 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus)) 1192 if (InspectorInstrumentation::forcePseudoState(const_cast<Element*>(&element ), CSSSelector::PseudoFocus))
1182 return true; 1193 return true;
1183 return element.focused() && isFrameFocused(element); 1194 return element.focused() && isFrameFocused(element);
1184 } 1195 }
1185 1196
1186 } 1197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698