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

Unified Diff: third_party/WebKit/Source/core/css/RuleFeature.h

Issue 2683373003: RuleSet invalidations on single feature only, including tags. (Closed)
Patch Set: Trace type ruleset invalidation Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/RuleFeature.h
diff --git a/third_party/WebKit/Source/core/css/RuleFeature.h b/third_party/WebKit/Source/core/css/RuleFeature.h
index 064b86ac78a4c128c95f7b5e1c76c75910b9e170..29c5fd43e0b0cd8ad3796bb63e52dca1d9d2f54f 100644
--- a/third_party/WebKit/Source/core/css/RuleFeature.h
+++ b/third_party/WebKit/Source/core/css/RuleFeature.h
@@ -34,6 +34,7 @@
namespace blink {
+class ContainerNode;
struct InvalidationLists;
class QualifiedName;
class RuleData;
@@ -122,16 +123,27 @@ class CORE_EXPORT RuleFeatureSet {
}
// Collect descendant and sibling invalidation sets.
- void collectInvalidationSetsForClass(InvalidationLists&,
- Element&,
- const AtomicString& className) const;
- void collectInvalidationSetsForId(InvalidationLists&,
- Element&,
- const AtomicString& id) const;
+
+ enum class InvalidationSetFilter {
+ None,
+ RuleSetInvalidation,
+ };
+
+ void collectInvalidationSetsForClass(
+ InvalidationLists&,
+ Element&,
+ const AtomicString& className,
+ InvalidationSetFilter = InvalidationSetFilter::None) const;
+ void collectInvalidationSetsForId(
+ InvalidationLists&,
+ Element&,
+ const AtomicString& id,
+ InvalidationSetFilter = InvalidationSetFilter::None) const;
void collectInvalidationSetsForAttribute(
InvalidationLists&,
Element&,
- const QualifiedName& attributeName) const;
+ const QualifiedName& attributeName,
+ InvalidationSetFilter = InvalidationSetFilter::None) const;
void collectInvalidationSetsForPseudoClass(InvalidationLists&,
Element&,
CSSSelector::PseudoType) const;
@@ -152,6 +164,7 @@ class CORE_EXPORT RuleFeatureSet {
void collectUniversalSiblingInvalidationSet(InvalidationLists&,
unsigned minDirectAdjacent) const;
void collectNthInvalidationSet(InvalidationLists&) const;
+ void collectTypeRuleInvalidationSet(InvalidationLists&, ContainerNode&) const;
bool hasIdsInSelectors() const { return m_idInvalidationSets.size() > 0; }
@@ -200,21 +213,45 @@ class CORE_EXPORT RuleFeatureSet {
InvalidationType);
SiblingInvalidationSet& ensureUniversalSiblingInvalidationSet();
DescendantInvalidationSet& ensureNthInvalidationSet();
+ DescendantInvalidationSet& ensureTypeRuleInvalidationSet();
void updateInvalidationSets(const RuleData&);
void updateInvalidationSetsForContentAttribute(const RuleData&);
struct InvalidationSetFeatures {
+ enum class RuleSetFeatureType {
+ None,
+ Tag,
+ Attribute,
+ Class,
+ Id,
+ };
+
DISALLOW_NEW();
void add(const InvalidationSetFeatures& other);
bool hasFeatures() const;
- bool hasTagIdClassOrAttribute() const;
+ bool hasRuleSetInvalidationFeature() const {
+ return ruleSetInvalidationFeatureType != RuleSetFeatureType::None;
+ }
+ void setRuleSetFeatureFromSimpleSelector(const CSSSelector&);
+ void setRuleSetInvalidationFeature(const AtomicString& feature,
+ RuleSetFeatureType type) {
+ if (type < ruleSetInvalidationFeatureType)
+ return;
+ ruleSetInvalidationFeature = feature;
+ ruleSetInvalidationFeatureType = type;
+ }
+ void clearRuleSetInvalidationFeature() {
+ ruleSetInvalidationFeature = AtomicString();
+ ruleSetInvalidationFeatureType = RuleSetFeatureType::None;
+ }
Vector<AtomicString> classes;
Vector<AtomicString> attributes;
Vector<AtomicString> ids;
Vector<AtomicString> tagNames;
+ AtomicString ruleSetInvalidationFeature;
unsigned maxDirectAdjacentSelectors = 0;
bool customPseudoElement = false;
bool hasBeforeOrAfter = false;
@@ -224,7 +261,8 @@ class CORE_EXPORT RuleFeatureSet {
bool contentPseudoCrossing = false;
bool invalidatesSlotted = false;
bool hasNthPseudo = false;
- bool hasFeaturesForRuleSetInvalidation = false;
+ RuleSetFeatureType ruleSetInvalidationFeatureType =
+ InvalidationSetFeatures::RuleSetFeatureType::None;
};
static void extractInvalidationSetFeature(const CSSSelector&,
@@ -278,6 +316,7 @@ class CORE_EXPORT RuleFeatureSet {
const InvalidationSetFeatures& descendantFeatures);
void addClassToInvalidationSet(const AtomicString& className, Element&);
+ void processRuleSetInvalidationFeature(const InvalidationSetFeatures&);
FeatureMetadata m_metadata;
InvalidationSetMap m_classInvalidationSets;
@@ -286,6 +325,7 @@ class CORE_EXPORT RuleFeatureSet {
PseudoTypeInvalidationSetMap m_pseudoInvalidationSets;
RefPtr<SiblingInvalidationSet> m_universalSiblingInvalidationSet;
RefPtr<DescendantInvalidationSet> m_nthInvalidationSet;
+ RefPtr<DescendantInvalidationSet> m_typeRuleInvalidationSet;
HeapVector<RuleFeature> m_siblingRules;
HeapVector<RuleFeature> m_uncommonAttributeRules;
MediaQueryResultList m_viewportDependentMediaQueryResults;
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698