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

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

Issue 2284633002: Allow multiple type and id selectors in invalidation set features. (Closed)
Patch Set: Unit tests Created 4 years, 3 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensurePseudoInvalidationSet(CSSSe lector::PseudoType pseudoType, InvalidationType type) 292 ALWAYS_INLINE InvalidationSet& RuleFeatureSet::ensurePseudoInvalidationSet(CSSSe lector::PseudoType pseudoType, InvalidationType type)
293 { 293 {
294 return ensureInvalidationSet(m_pseudoInvalidationSets, pseudoType, type); 294 return ensureInvalidationSet(m_pseudoInvalidationSets, pseudoType, type);
295 } 295 }
296 296
297 bool RuleFeatureSet::extractInvalidationSetFeature(const CSSSelector& selector, InvalidationSetFeatures& features) 297 bool RuleFeatureSet::extractInvalidationSetFeature(const CSSSelector& selector, InvalidationSetFeatures& features)
298 { 298 {
299 if (selector.match() == CSSSelector::Tag && selector.tagQName().localName() != starAtom) { 299 if (selector.match() == CSSSelector::Tag && selector.tagQName().localName() != starAtom) {
300 features.tagName = selector.tagQName().localName(); 300 features.tagNames.append(selector.tagQName().localName());
301 return true; 301 return true;
302 } 302 }
303 if (selector.match() == CSSSelector::Id) { 303 if (selector.match() == CSSSelector::Id) {
304 features.id = selector.value(); 304 features.ids.append(selector.value());
305 return true; 305 return true;
306 } 306 }
307 if (selector.match() == CSSSelector::Class) { 307 if (selector.match() == CSSSelector::Class) {
308 features.classes.append(selector.value()); 308 features.classes.append(selector.value());
309 return true; 309 return true;
310 } 310 }
311 if (selector.isAttributeSelector()) { 311 if (selector.isAttributeSelector()) {
312 features.attributes.append(selector.attribute().localName()); 312 features.attributes.append(selector.attribute().localName());
313 return true; 313 return true;
314 } 314 }
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 invalidationSet.setTreeBoundaryCrossing(); 519 invalidationSet.setTreeBoundaryCrossing();
520 if (features.insertionPointCrossing) 520 if (features.insertionPointCrossing)
521 invalidationSet.setInsertionPointCrossing(); 521 invalidationSet.setInsertionPointCrossing();
522 if (features.invalidatesSlotted) 522 if (features.invalidatesSlotted)
523 invalidationSet.setInvalidatesSlotted(); 523 invalidationSet.setInvalidatesSlotted();
524 if (features.forceSubtree) 524 if (features.forceSubtree)
525 invalidationSet.setWholeSubtreeInvalid(); 525 invalidationSet.setWholeSubtreeInvalid();
526 if (features.contentPseudoCrossing || features.forceSubtree) 526 if (features.contentPseudoCrossing || features.forceSubtree)
527 return; 527 return;
528 528
529 if (!features.id.isEmpty()) 529 for (const auto& id : features.ids)
530 invalidationSet.addId(features.id); 530 invalidationSet.addId(id);
531 if (!features.tagName.isEmpty()) 531 for (const auto& tagName : features.tagNames)
532 invalidationSet.addTagName(features.tagName); 532 invalidationSet.addTagName(tagName);
533 for (const auto& className : features.classes) 533 for (const auto& className : features.classes)
534 invalidationSet.addClass(className); 534 invalidationSet.addClass(className);
535 for (const auto& attribute : features.attributes) 535 for (const auto& attribute : features.attributes)
536 invalidationSet.addAttribute(attribute); 536 invalidationSet.addAttribute(attribute);
537 if (features.customPseudoElement) 537 if (features.customPseudoElement)
538 invalidationSet.setCustomPseudoInvalid(); 538 invalidationSet.setCustomPseudoInvalid();
539 } 539 }
540 540
541 // selector is the selector immediately to the left of the rightmost combinator. 541 // selector is the selector immediately to the left of the rightmost combinator.
542 // siblingFeatures is null if selector is not immediately to the left of a sibli ng combinator. 542 // siblingFeatures is null if selector is not immediately to the left of a sibli ng combinator.
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 addFeaturesToInvalidationSet(universalSet.ensureSiblingDescendants(), de scendantFeatures); 939 addFeaturesToInvalidationSet(universalSet.ensureSiblingDescendants(), de scendantFeatures);
940 } 940 }
941 941
942 DEFINE_TRACE(RuleFeatureSet) 942 DEFINE_TRACE(RuleFeatureSet)
943 { 943 {
944 visitor->trace(siblingRules); 944 visitor->trace(siblingRules);
945 visitor->trace(uncommonAttributeRules); 945 visitor->trace(uncommonAttributeRules);
946 } 946 }
947 947
948 } // namespace blink 948 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.h ('k') | third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698