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

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

Issue 1575363006: Implement matching part of ::slotted() pseudo element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blink_slotted_parser
Patch Set: ready for review Created 4 years, 11 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 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 case CSSSelector::PseudoWebKitCustomElement: 145 case CSSSelector::PseudoWebKitCustomElement:
146 case CSSSelector::PseudoCue: 146 case CSSSelector::PseudoCue:
147 case CSSSelector::PseudoFutureCue: 147 case CSSSelector::PseudoFutureCue:
148 case CSSSelector::PseudoPastCue: 148 case CSSSelector::PseudoPastCue:
149 case CSSSelector::PseudoUnresolved: 149 case CSSSelector::PseudoUnresolved:
150 case CSSSelector::PseudoContent: 150 case CSSSelector::PseudoContent:
151 case CSSSelector::PseudoHost: 151 case CSSSelector::PseudoHost:
152 case CSSSelector::PseudoShadow: 152 case CSSSelector::PseudoShadow:
153 case CSSSelector::PseudoSpatialNavigationFocus: 153 case CSSSelector::PseudoSpatialNavigationFocus:
154 case CSSSelector::PseudoListBox: 154 case CSSSelector::PseudoListBox:
155 case CSSSelector::PseudoSlotted:
155 return true; 156 return true;
156 case CSSSelector::PseudoUnknown: 157 case CSSSelector::PseudoUnknown:
157 case CSSSelector::PseudoLeftPage: 158 case CSSSelector::PseudoLeftPage:
158 case CSSSelector::PseudoRightPage: 159 case CSSSelector::PseudoRightPage:
159 case CSSSelector::PseudoFirstPage: 160 case CSSSelector::PseudoFirstPage:
160 // These should not appear in StyleRule selectors. 161 // These should not appear in StyleRule selectors.
161 ASSERT_NOT_REACHED(); 162 ASSERT_NOT_REACHED();
162 return false; 163 return false;
163 default: 164 default:
164 // New pseudo type added. Figure out if it needs a subtree invalidation or not. 165 // New pseudo type added. Figure out if it needs a subtree invalidation or not.
165 ASSERT_NOT_REACHED(); 166 ASSERT_NOT_REACHED();
166 return false; 167 return false;
167 } 168 }
168 } 169 }
169 170
170 bool supportsInvalidationWithSelectorList(CSSSelector::PseudoType pseudo) 171 bool supportsInvalidationWithSelectorList(CSSSelector::PseudoType pseudo)
171 { 172 {
172 return pseudo == CSSSelector::PseudoAny 173 return pseudo == CSSSelector::PseudoAny
173 || pseudo == CSSSelector::PseudoCue 174 || pseudo == CSSSelector::PseudoCue
174 || pseudo == CSSSelector::PseudoHost 175 || pseudo == CSSSelector::PseudoHost
175 || pseudo == CSSSelector::PseudoHostContext 176 || pseudo == CSSSelector::PseudoHostContext
176 || pseudo == CSSSelector::PseudoNot; 177 || pseudo == CSSSelector::PseudoNot
178 || pseudo == CSSSelector::PseudoSlotted;
177 } 179 }
178 180
179 #endif // ENABLE(ASSERT) 181 #endif // ENABLE(ASSERT)
180 182
181 bool requiresSubtreeInvalidation(const CSSSelector& selector) 183 bool requiresSubtreeInvalidation(const CSSSelector& selector)
182 { 184 {
183 if (selector.match() != CSSSelector::PseudoElement && selector.match() != CS SSelector::PseudoClass) { 185 if (selector.match() != CSSSelector::PseudoElement && selector.match() != CS SSelector::PseudoClass) {
184 ASSERT(supportsInvalidation(selector.match())); 186 ASSERT(supportsInvalidation(selector.match()));
185 return false; 187 return false;
186 } 188 }
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 if (const CSSSelectorList* selectorList = current->selectorList()) { 510 if (const CSSSelectorList* selectorList = current->selectorList()) {
509 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( ))); 511 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( )));
510 for (const CSSSelector* subSelector = selectorList->first(); sub Selector; subSelector = CSSSelectorList::next(*subSelector)) 512 for (const CSSSelector* subSelector = selectorList->first(); sub Selector; subSelector = CSSSelectorList::next(*subSelector))
511 addFeaturesToInvalidationSets(subSelector, siblingFeatures, descendantFeatures); 513 addFeaturesToInvalidationSets(subSelector, siblingFeatures, descendantFeatures);
512 } 514 }
513 } 515 }
514 516
515 if (current->relation() == CSSSelector::SubSelector) 517 if (current->relation() == CSSSelector::SubSelector)
516 continue; 518 continue;
517 519
518 if (current->relationIsAffectedByPseudoContent()) { 520 if (current->relationIsAffectedByPseudoContent() || current->pseudoType( ) == CSSSelector::PseudoSlotted) {
rune 2016/01/20 12:53:32 It would possibly be more consistent if you checke
kochi 2016/01/21 05:09:37 Good suggestion. Done.
519 descendantFeatures.insertionPointCrossing = true; 521 descendantFeatures.insertionPointCrossing = true;
520 descendantFeatures.contentPseudoCrossing = true; 522 descendantFeatures.contentPseudoCrossing = true;
521 } 523 }
522 if (current->isShadowSelector()) 524 if (current->isShadowSelector())
523 descendantFeatures.treeBoundaryCrossing = true; 525 descendantFeatures.treeBoundaryCrossing = true;
524 if (!current->isAdjacentSelector()) { 526 if (!current->isAdjacentSelector()) {
525 lastCompoundSelectorInAdjacentChain = current->tagHistory(); 527 lastCompoundSelectorInAdjacentChain = current->tagHistory();
526 siblingFeatures = nullptr; 528 siblingFeatures = nullptr;
527 continue; 529 continue;
528 } 530 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 722
721 DEFINE_TRACE(RuleFeatureSet) 723 DEFINE_TRACE(RuleFeatureSet)
722 { 724 {
723 #if ENABLE(OILPAN) 725 #if ENABLE(OILPAN)
724 visitor->trace(siblingRules); 726 visitor->trace(siblingRules);
725 visitor->trace(uncommonAttributeRules); 727 visitor->trace(uncommonAttributeRules);
726 #endif 728 #endif
727 } 729 }
728 730
729 } // namespace blink 731 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698