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

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

Issue 1523843004: Add support for new CSS ::slotted() pseudo element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tentative fix for crash / querySelector test 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return false; 166 return false;
167 } 167 }
168 } 168 }
169 169
170 bool supportsInvalidationWithSelectorList(CSSSelector::PseudoType pseudo) 170 bool supportsInvalidationWithSelectorList(CSSSelector::PseudoType pseudo)
171 { 171 {
172 return pseudo == CSSSelector::PseudoAny 172 return pseudo == CSSSelector::PseudoAny
173 || pseudo == CSSSelector::PseudoCue 173 || pseudo == CSSSelector::PseudoCue
174 || pseudo == CSSSelector::PseudoHost 174 || pseudo == CSSSelector::PseudoHost
175 || pseudo == CSSSelector::PseudoHostContext 175 || pseudo == CSSSelector::PseudoHostContext
176 || pseudo == CSSSelector::PseudoNot; 176 || pseudo == CSSSelector::PseudoNot
177 || pseudo == CSSSelector::PseudoSlotted;
177 } 178 }
178 179
179 #endif // ENABLE(ASSERT) 180 #endif // ENABLE(ASSERT)
180 181
181 bool requiresSubtreeInvalidation(const CSSSelector& selector) 182 bool requiresSubtreeInvalidation(const CSSSelector& selector)
182 { 183 {
183 if (selector.match() != CSSSelector::PseudoElement && selector.match() != CS SSelector::PseudoClass) { 184 if (selector.match() != CSSSelector::PseudoElement && selector.match() != CS SSelector::PseudoClass) {
184 ASSERT(supportsInvalidation(selector.match())); 185 ASSERT(supportsInvalidation(selector.match()));
185 return false; 186 return false;
186 } 187 }
187 188
188 switch (selector.pseudoType()) { 189 switch (selector.pseudoType()) {
189 case CSSSelector::PseudoFirstLine: 190 case CSSSelector::PseudoFirstLine:
190 case CSSSelector::PseudoFirstLetter: 191 case CSSSelector::PseudoFirstLetter:
191 // FIXME: Most pseudo classes/elements above can be supported and moved 192 // FIXME: Most pseudo classes/elements above can be supported and moved
192 // to assertSupportedPseudo(). Move on a case-by-case basis. If they 193 // to assertSupportedPseudo(). Move on a case-by-case basis. If they
193 // require subtree invalidation, document why. 194 // require subtree invalidation, document why.
194 case CSSSelector::PseudoHostContext: 195 case CSSSelector::PseudoHostContext:
195 // :host-context matches a shadow host, yet the simple selectors inside 196 // :host-context matches a shadow host, yet the simple selectors inside
196 // :host-context matches an ancestor of the shadow host. 197 // :host-context matches an ancestor of the shadow host.
198 case CSSSelector::PseudoSlotted:
199 // TODO(kochi): This recalculates a bit more than necessary. Find out a way
200 // to avoid unnecessary recalculation.
rune 2016/01/09 01:15:36 This shouldn't be necessary as long as we extract
197 return true; 201 return true;
198 default: 202 default:
199 ASSERT(supportsInvalidation(selector.pseudoType())); 203 ASSERT(supportsInvalidation(selector.pseudoType()));
200 return false; 204 return false;
201 } 205 }
202 } 206 }
203 207
204 template<class Map> 208 template<class Map>
205 InvalidationData& ensureInvalidationData(Map& map, const typename Map::KeyType& key) 209 InvalidationData& ensureInvalidationData(Map& map, const typename Map::KeyType& key)
206 { 210 {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 if (siblingFeatures == &descendantFeatures) 469 if (siblingFeatures == &descendantFeatures)
466 siblingInvalidationSet->descendants().setInvalidatesSelf(); 470 siblingInvalidationSet->descendants().setInvalidatesSelf();
467 else 471 else
468 addFeaturesToInvalidationSet(siblingInvalidationSet->descend ants(), descendantFeatures); 472 addFeaturesToInvalidationSet(siblingInvalidationSet->descend ants(), descendantFeatures);
469 } else { 473 } else {
470 addFeaturesToInvalidationSet(*invalidationSet, descendantFeature s); 474 addFeaturesToInvalidationSet(*invalidationSet, descendantFeature s);
471 } 475 }
472 } else { 476 } else {
473 if (current->isHostPseudoClass()) 477 if (current->isHostPseudoClass())
474 descendantFeatures.treeBoundaryCrossing = true; 478 descendantFeatures.treeBoundaryCrossing = true;
475 if (current->isInsertionPointCrossing()) 479 if (current->isInsertionPointCrossing() || current->isSlottedPseudoE lement())
476 descendantFeatures.insertionPointCrossing = true; 480 descendantFeatures.insertionPointCrossing = true;
477 if (const CSSSelectorList* selectorList = current->selectorList()) { 481 if (const CSSSelectorList* selectorList = current->selectorList()) {
478 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( ))); 482 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( )));
479 for (const CSSSelector* subSelector = selectorList->first(); sub Selector; subSelector = CSSSelectorList::next(*subSelector)) 483 for (const CSSSelector* subSelector = selectorList->first(); sub Selector; subSelector = CSSSelectorList::next(*subSelector))
480 addFeaturesToInvalidationSets(subSelector, siblingFeatures, descendantFeatures); 484 addFeaturesToInvalidationSets(subSelector, siblingFeatures, descendantFeatures);
481 } 485 }
482 } 486 }
483 487
484 if (current->relation() == CSSSelector::SubSelector) 488 if (current->relation() == CSSSelector::SubSelector)
485 continue; 489 continue;
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 674
671 DEFINE_TRACE(RuleFeatureSet) 675 DEFINE_TRACE(RuleFeatureSet)
672 { 676 {
673 #if ENABLE(OILPAN) 677 #if ENABLE(OILPAN)
674 visitor->trace(siblingRules); 678 visitor->trace(siblingRules);
675 visitor->trace(uncommonAttributeRules); 679 visitor->trace(uncommonAttributeRules);
676 #endif 680 #endif
677 } 681 }
678 682
679 } // namespace blink 683 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698