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

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

Issue 652223002: Support style invalidation for ::content. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Missing removal of PseudoContent case when moving. Created 6 years, 2 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
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/css/invalidation/DescendantInvalidationSet.h » ('j') | 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 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 case CSSSelector::PseudoBefore: 106 case CSSSelector::PseudoBefore:
107 case CSSSelector::PseudoAfter: 107 case CSSSelector::PseudoAfter:
108 case CSSSelector::PseudoBackdrop: 108 case CSSSelector::PseudoBackdrop:
109 case CSSSelector::PseudoLang: 109 case CSSSelector::PseudoLang:
110 case CSSSelector::PseudoNot: 110 case CSSSelector::PseudoNot:
111 case CSSSelector::PseudoRoot: 111 case CSSSelector::PseudoRoot:
112 case CSSSelector::PseudoScope: 112 case CSSSelector::PseudoScope:
113 case CSSSelector::PseudoInRange: 113 case CSSSelector::PseudoInRange:
114 case CSSSelector::PseudoOutOfRange: 114 case CSSSelector::PseudoOutOfRange:
115 case CSSSelector::PseudoUnresolved: 115 case CSSSelector::PseudoUnresolved:
116 case CSSSelector::PseudoContent:
116 case CSSSelector::PseudoHost: 117 case CSSSelector::PseudoHost:
117 case CSSSelector::PseudoShadow: 118 case CSSSelector::PseudoShadow:
118 case CSSSelector::PseudoListBox: 119 case CSSSelector::PseudoListBox:
119 return true; 120 return true;
120 case CSSSelector::PseudoNotParsed: 121 case CSSSelector::PseudoNotParsed:
121 case CSSSelector::PseudoUnknown: 122 case CSSSelector::PseudoUnknown:
122 case CSSSelector::PseudoLeftPage: 123 case CSSSelector::PseudoLeftPage:
123 case CSSSelector::PseudoRightPage: 124 case CSSSelector::PseudoRightPage:
124 case CSSSelector::PseudoFirstPage: 125 case CSSSelector::PseudoFirstPage:
125 // These should not appear in StyleRule selectors. 126 // These should not appear in StyleRule selectors.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 case CSSSelector::PseudoNoButton: 169 case CSSSelector::PseudoNoButton:
169 case CSSSelector::PseudoSelection: 170 case CSSSelector::PseudoSelection:
170 case CSSSelector::PseudoFullScreen: 171 case CSSSelector::PseudoFullScreen:
171 case CSSSelector::PseudoFullScreenDocument: 172 case CSSSelector::PseudoFullScreenDocument:
172 case CSSSelector::PseudoFullScreenAncestor: 173 case CSSSelector::PseudoFullScreenAncestor:
173 case CSSSelector::PseudoUserAgentCustomElement: 174 case CSSSelector::PseudoUserAgentCustomElement:
174 case CSSSelector::PseudoWebKitCustomElement: 175 case CSSSelector::PseudoWebKitCustomElement:
175 case CSSSelector::PseudoCue: 176 case CSSSelector::PseudoCue:
176 case CSSSelector::PseudoFutureCue: 177 case CSSSelector::PseudoFutureCue:
177 case CSSSelector::PseudoPastCue: 178 case CSSSelector::PseudoPastCue:
178 case CSSSelector::PseudoContent:
179 case CSSSelector::PseudoSpatialNavigationFocus: 179 case CSSSelector::PseudoSpatialNavigationFocus:
180 // FIXME: Most pseudo classes/elements above can be supported and moved 180 // FIXME: Most pseudo classes/elements above can be supported and moved
181 // to assertSupportedPseudo(). Move on a case-by-case basis. If they 181 // to assertSupportedPseudo(). Move on a case-by-case basis. If they
182 // require subtree invalidation, document why. 182 // require subtree invalidation, document why.
183 case CSSSelector::PseudoHostContext: 183 case CSSSelector::PseudoHostContext:
184 // :host-context matches a shadow host, yet the simple selectors inside 184 // :host-context matches a shadow host, yet the simple selectors inside
185 // :host-context matches an ancestor of the shadow host. 185 // :host-context matches an ancestor of the shadow host.
186 return true; 186 return true;
187 default: 187 default:
188 ASSERT(supportsInvalidation(selector.pseudoType())); 188 ASSERT(supportsInvalidation(selector.pseudoType()));
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // ContainerNode::checkForChildrenAdjacentRuleChanges. 366 // ContainerNode::checkForChildrenAdjacentRuleChanges.
367 // 367 //
368 // As we encounter a descendant type of combinator, the features only need to be checked 368 // As we encounter a descendant type of combinator, the features only need to be checked
369 // against descendants in the same subtree only. features.adjacent is set to fal se, and 369 // against descendants in the same subtree only. features.adjacent is set to fal se, and
370 // we start adding features instead of calling setWholeSubtreeInvalid. 370 // we start adding features instead of calling setWholeSubtreeInvalid.
371 371
372 void RuleFeatureSet::addFeaturesToInvalidationSet(DescendantInvalidationSet& inv alidationSet, const InvalidationSetFeatures& features) 372 void RuleFeatureSet::addFeaturesToInvalidationSet(DescendantInvalidationSet& inv alidationSet, const InvalidationSetFeatures& features)
373 { 373 {
374 if (features.treeBoundaryCrossing) 374 if (features.treeBoundaryCrossing)
375 invalidationSet.setTreeBoundaryCrossing(); 375 invalidationSet.setTreeBoundaryCrossing();
376 if (features.insertionPointCrossing)
377 invalidationSet.setInsertionPointCrossing();
376 if (features.adjacent) { 378 if (features.adjacent) {
377 invalidationSet.setWholeSubtreeInvalid(); 379 invalidationSet.setWholeSubtreeInvalid();
378 return; 380 return;
379 } 381 }
380 if (!features.id.isEmpty()) 382 if (!features.id.isEmpty())
381 invalidationSet.addId(features.id); 383 invalidationSet.addId(features.id);
382 if (!features.tagName.isEmpty()) 384 if (!features.tagName.isEmpty())
383 invalidationSet.addTagName(features.tagName); 385 invalidationSet.addTagName(features.tagName);
384 for (const auto& className : features.classes) 386 for (const auto& className : features.classes)
385 invalidationSet.addClass(className); 387 invalidationSet.addClass(className);
386 for (const auto& attribute : features.attributes) 388 for (const auto& attribute : features.attributes)
387 invalidationSet.addAttribute(attribute); 389 invalidationSet.addAttribute(attribute);
388 if (features.customPseudoElement) 390 if (features.customPseudoElement)
389 invalidationSet.setCustomPseudoInvalid(); 391 invalidationSet.setCustomPseudoInvalid();
390 } 392 }
391 393
392 void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, InvalidationSetFeatures& features) 394 void RuleFeatureSet::addFeaturesToInvalidationSets(const CSSSelector& selector, InvalidationSetFeatures& features)
393 { 395 {
394 for (const CSSSelector* current = &selector; current; current = current->tag History()) { 396 for (const CSSSelector* current = &selector; current; current = current->tag History()) {
395 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec tor(*current)) { 397 if (DescendantInvalidationSet* invalidationSet = invalidationSetForSelec tor(*current)) {
396 addFeaturesToInvalidationSet(*invalidationSet, features); 398 addFeaturesToInvalidationSet(*invalidationSet, features);
397 } else { 399 } else {
398 if (current->pseudoType() == CSSSelector::PseudoHost) 400 if (current->isTreeBoundaryCrossing())
399 features.treeBoundaryCrossing = true; 401 features.treeBoundaryCrossing = true;
402 if (current->isInsertionPointCrossing())
403 features.insertionPointCrossing = true;
400 if (const CSSSelectorList* selectorList = current->selectorList()) { 404 if (const CSSSelectorList* selectorList = current->selectorList()) {
401 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect or::PseudoNot); 405 ASSERT(current->pseudoType() == CSSSelector::PseudoHost || curre nt->pseudoType() == CSSSelector::PseudoAny || current->pseudoType() == CSSSelect or::PseudoNot);
402 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector)) 406 for (const CSSSelector* selector = selectorList->first(); select or; selector = CSSSelectorList::next(*selector))
403 addFeaturesToInvalidationSets(*selector, features); 407 addFeaturesToInvalidationSets(*selector, features);
404 } 408 }
405 } 409 }
406 410
407 if (current->relation() == CSSSelector::SubSelector) 411 if (current->relation() == CSSSelector::SubSelector)
408 continue; 412 continue;
409 413
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 visitor->trace(uncommonAttributeRules); 640 visitor->trace(uncommonAttributeRules);
637 visitor->trace(m_classInvalidationSets); 641 visitor->trace(m_classInvalidationSets);
638 visitor->trace(m_attributeInvalidationSets); 642 visitor->trace(m_attributeInvalidationSets);
639 visitor->trace(m_idInvalidationSets); 643 visitor->trace(m_idInvalidationSets);
640 visitor->trace(m_pseudoInvalidationSets); 644 visitor->trace(m_pseudoInvalidationSets);
641 visitor->trace(m_styleInvalidator); 645 visitor->trace(m_styleInvalidator);
642 #endif 646 #endif
643 } 647 }
644 648
645 } // namespace blink 649 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/css/invalidation/DescendantInvalidationSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698