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

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

Issue 201573003: Reset SelectorCheckingContext.elementStyle for :ancestor matching. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/dom/shadow/ancestor-first-child-expected.txt ('k') | 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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 bool matched = false; 898 bool matched = false;
899 unsigned maxSpecificity = 0; 899 unsigned maxSpecificity = 0;
900 900
901 // If one of simple selectors matches an element, returns Select orMatches. Just "OR". 901 // If one of simple selectors matches an element, returns Select orMatches. Just "OR".
902 for (subContext.selector = selector.selectorList()->first(); sub Context.selector; subContext.selector = CSSSelectorList::next(*subContext.select or)) { 902 for (subContext.selector = selector.selectorList()->first(); sub Context.selector; subContext.selector = CSSSelectorList::next(*subContext.select or)) {
903 subContext.behaviorAtBoundary = ScopeIsShadowHostInPseudoHos tParameter; 903 subContext.behaviorAtBoundary = ScopeIsShadowHostInPseudoHos tParameter;
904 subContext.scope = shadowHost; 904 subContext.scope = shadowHost;
905 // Use NodeRenderingTraversal to traverse a composed ancesto r list of a given element. 905 // Use NodeRenderingTraversal to traverse a composed ancesto r list of a given element.
906 Element* nextElement = &element; 906 Element* nextElement = &element;
907 SelectorCheckingContext hostContext(subContext);
907 do { 908 do {
908 MatchResult subResult; 909 MatchResult subResult;
909 subContext.element = nextElement; 910 hostContext.element = nextElement;
910 if (match(subContext, siblingTraversalStrategy, &subResu lt) == SelectorMatches) { 911 if (match(hostContext, siblingTraversalStrategy, &subRes ult) == SelectorMatches) {
911 matched = true; 912 matched = true;
912 // Consider div:host(div:host(div:host(div:host...)) ). 913 // Consider div:host(div:host(div:host(div:host...)) ).
913 maxSpecificity = std::max(maxSpecificity, subContext .selector->specificity() + subResult.specificity); 914 maxSpecificity = std::max(maxSpecificity, hostContex t.selector->specificity() + subResult.specificity);
914 break; 915 break;
915 } 916 }
916 subContext.behaviorAtBoundary = DoesNotCrossBoundary; 917 hostContext.behaviorAtBoundary = DoesNotCrossBoundary;
917 subContext.scope = 0; 918 hostContext.scope = 0;
918 919
919 if (selector.pseudoType() == CSSSelector::PseudoHost) 920 if (selector.pseudoType() == CSSSelector::PseudoHost)
920 break; 921 break;
921 922
923 hostContext.elementStyle = 0;
922 nextElement = NodeRenderingTraversal::parentElement(next Element); 924 nextElement = NodeRenderingTraversal::parentElement(next Element);
923 } while (nextElement); 925 } while (nextElement);
924 } 926 }
925 if (matched) { 927 if (matched) {
926 if (specificity) 928 if (specificity)
927 *specificity = maxSpecificity; 929 *specificity = maxSpecificity;
928 return true; 930 return true;
929 } 931 }
930 } 932 }
931 break; 933 break;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 return element.focused() && isFrameFocused(element); 1103 return element.focused() && isFrameFocused(element);
1102 } 1104 }
1103 1105
1104 template 1106 template
1105 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const; 1107 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst DOMSiblingTraversalStrategy&, MatchResult*) const;
1106 1108
1107 template 1109 template
1108 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const; 1110 SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext&, co nst ShadowDOMSiblingTraversalStrategy&, MatchResult*) const;
1109 1111
1110 } 1112 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/shadow/ancestor-first-child-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698