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

Side by Side Diff: Source/core/dom/shadow/SelectRuleFeatureSet.h

Issue 143873016: Implement style invalidation tree walk for targeted style recalc upon class change. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/shadow/SelectRuleFeatureSet.cpp » ('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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #ifndef SelectRuleFeatureSet_h 31 #ifndef SelectRuleFeatureSet_h
32 #define SelectRuleFeatureSet_h 32 #define SelectRuleFeatureSet_h
33 33
34 #include "core/css/RuleFeature.h" 34 #include "core/css/RuleFeature.h"
35 #include "core/dom/Element.h" 35 #include "core/dom/Element.h"
36 36
37 namespace WebCore { 37 namespace WebCore {
38 38
39 class Element;
40 class SpaceSplitString;
41
39 class SelectRuleFeatureSet { 42 class SelectRuleFeatureSet {
40 public: 43 public:
41 SelectRuleFeatureSet(); 44 SelectRuleFeatureSet();
42 45
43 void add(const SelectRuleFeatureSet&); 46 void add(const SelectRuleFeatureSet&);
44 void clear(); 47 void clear();
45 void collectFeaturesFromSelector(const CSSSelector&); 48 void collectFeaturesFromSelector(const CSSSelector&);
46 49
47 bool hasSelectorForId(const AtomicString&) const; 50 bool hasSelectorForId(const AtomicString&) const;
48 bool hasSelectorForClass(const AtomicString&) const; 51 bool hasSelectorForClass(const AtomicString&) const;
49 bool hasSelectorForAttribute(const AtomicString&) const; 52 bool hasSelectorForAttribute(const AtomicString&) const;
50 53
51 bool hasSelectorForChecked() const { return hasSelectorFor(AffectedSelectorC hecked); } 54 bool hasSelectorForChecked() const { return hasSelectorFor(AffectedSelectorC hecked); }
52 bool hasSelectorForEnabled() const { return hasSelectorFor(AffectedSelectorE nabled); } 55 bool hasSelectorForEnabled() const { return hasSelectorFor(AffectedSelectorE nabled); }
53 bool hasSelectorForDisabled() const { return hasSelectorFor(AffectedSelector Disabled); } 56 bool hasSelectorForDisabled() const { return hasSelectorFor(AffectedSelector Disabled); }
54 bool hasSelectorForIndeterminate() const { return hasSelectorFor(AffectedSel ectorIndeterminate); } 57 bool hasSelectorForIndeterminate() const { return hasSelectorFor(AffectedSel ectorIndeterminate); }
55 bool hasSelectorForLink() const { return hasSelectorFor(AffectedSelectorLink ); } 58 bool hasSelectorForLink() const { return hasSelectorFor(AffectedSelectorLink ); }
56 bool hasSelectorForTarget() const { return hasSelectorFor(AffectedSelectorTa rget); } 59 bool hasSelectorForTarget() const { return hasSelectorFor(AffectedSelectorTa rget); }
57 bool hasSelectorForVisited() const { return hasSelectorFor(AffectedSelectorV isited); } 60 bool hasSelectorForVisited() const { return hasSelectorFor(AffectedSelectorV isited); }
58 61
59 bool hasSelectorFor(AffectedSelectorMask features) const { return m_featureF lags & features; } 62 bool hasSelectorFor(AffectedSelectorMask features) const { return m_featureF lags & features; }
60 63
64 bool checkSelectorsForClassChange(const SpaceSplitString& changedClasses) co nst;
65 bool checkSelectorsForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses) const;
66
61 private: 67 private:
62 void setSelectRuleFeature(AffectedSelectorType feature) { m_featureFlags |= feature; } 68 void setSelectRuleFeature(AffectedSelectorType feature) { m_featureFlags |= feature; }
63 69
64 RuleFeatureSet m_cssRuleFeatureSet; 70 RuleFeatureSet m_cssRuleFeatureSet;
65 int m_featureFlags; 71 int m_featureFlags;
66 }; 72 };
67 73
68 inline bool SelectRuleFeatureSet::hasSelectorForId(const AtomicString& idValue) const 74 inline bool SelectRuleFeatureSet::hasSelectorForId(const AtomicString& idValue) const
69 { 75 {
70 ASSERT(!idValue.isEmpty()); 76 ASSERT(!idValue.isEmpty());
71 return m_cssRuleFeatureSet.hasSelectorForId(idValue); 77 return m_cssRuleFeatureSet.hasSelectorForId(idValue);
72 } 78 }
73 79
74 inline bool SelectRuleFeatureSet::hasSelectorForClass(const AtomicString& classV alue) const 80 inline bool SelectRuleFeatureSet::hasSelectorForClass(const AtomicString& classV alue) const
75 { 81 {
76 ASSERT(!classValue.isEmpty()); 82 ASSERT(!classValue.isEmpty());
77 return m_cssRuleFeatureSet.hasSelectorForClass(classValue); 83 return m_cssRuleFeatureSet.hasSelectorForClass(classValue);
78 } 84 }
79 85
80 inline bool SelectRuleFeatureSet::hasSelectorForAttribute(const AtomicString& at tributeName) const 86 inline bool SelectRuleFeatureSet::hasSelectorForAttribute(const AtomicString& at tributeName) const
81 { 87 {
82 ASSERT(!attributeName.isEmpty()); 88 ASSERT(!attributeName.isEmpty());
83 return m_cssRuleFeatureSet.hasSelectorForAttribute(attributeName); 89 return m_cssRuleFeatureSet.hasSelectorForAttribute(attributeName);
84 } 90 }
85 91
86 } 92 }
87 93
88 #endif 94 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/shadow/SelectRuleFeatureSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698