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

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: rebase / fix comments for tests (FYI) 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.
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 if (siblingFeatures == &descendantFeatures) 470 if (siblingFeatures == &descendantFeatures)
467 siblingInvalidationSet->descendants().setInvalidatesSelf(); 471 siblingInvalidationSet->descendants().setInvalidatesSelf();
468 else 472 else
469 addFeaturesToInvalidationSet(siblingInvalidationSet->descend ants(), descendantFeatures); 473 addFeaturesToInvalidationSet(siblingInvalidationSet->descend ants(), descendantFeatures);
470 } else { 474 } else {
471 addFeaturesToInvalidationSet(*invalidationSet, descendantFeature s); 475 addFeaturesToInvalidationSet(*invalidationSet, descendantFeature s);
472 } 476 }
473 } else { 477 } else {
474 if (current->isHostPseudoClass()) 478 if (current->isHostPseudoClass())
475 descendantFeatures.treeBoundaryCrossing = true; 479 descendantFeatures.treeBoundaryCrossing = true;
476 if (current->isInsertionPointCrossing()) { 480 if (current->isInsertionPointCrossing() || current->isSlottedPseudoE lement()) {
477 descendantFeatures.insertionPointCrossing = true; 481 descendantFeatures.insertionPointCrossing = true;
478 if (current->pseudoType() == CSSSelector::PseudoContent) 482 if (current->pseudoType() == CSSSelector::PseudoContent)
479 descendantFeatures.contentPseudoCrossing = true; 483 descendantFeatures.contentPseudoCrossing = true;
480 } 484 }
481 if (const CSSSelectorList* selectorList = current->selectorList()) { 485 if (const CSSSelectorList* selectorList = current->selectorList()) {
482 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( ))); 486 ASSERT(supportsInvalidationWithSelectorList(current->pseudoType( )));
483 for (const CSSSelector* subSelector = selectorList->first(); sub Selector; subSelector = CSSSelectorList::next(*subSelector)) 487 for (const CSSSelector* subSelector = selectorList->first(); sub Selector; subSelector = CSSSelectorList::next(*subSelector))
484 addFeaturesToInvalidationSets(subSelector, siblingFeatures, descendantFeatures); 488 addFeaturesToInvalidationSets(subSelector, siblingFeatures, descendantFeatures);
485 } 489 }
486 } 490 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 678
675 DEFINE_TRACE(RuleFeatureSet) 679 DEFINE_TRACE(RuleFeatureSet)
676 { 680 {
677 #if ENABLE(OILPAN) 681 #if ENABLE(OILPAN)
678 visitor->trace(siblingRules); 682 visitor->trace(siblingRules);
679 visitor->trace(uncommonAttributeRules); 683 visitor->trace(uncommonAttributeRules);
680 #endif 684 #endif
681 } 685 }
682 686
683 } // namespace blink 687 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelectorList.cpp ('k') | third_party/WebKit/Source/core/css/RuleSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698