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

Side by Side Diff: sky/engine/core/css/RuleFeature.h

Issue 796583002: Use the HashSet of attribute names in SharedStyleFinder. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Use C++11 loops. Created 6 years 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 | « sky/engine/core/css/ElementRuleCollector.cpp ('k') | sky/engine/core/css/RuleFeature.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 16 matching lines...) Expand all
27 #include "sky/engine/wtf/HashSet.h" 27 #include "sky/engine/wtf/HashSet.h"
28 #include "sky/engine/wtf/text/AtomicStringHash.h" 28 #include "sky/engine/wtf/text/AtomicStringHash.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 class CSSSelectorList; 32 class CSSSelectorList;
33 class Element; 33 class Element;
34 class QualifiedName; 34 class QualifiedName;
35 class RuleData; 35 class RuleData;
36 class SpaceSplitString; 36 class SpaceSplitString;
37 class StyleRule;
38
39 struct RuleFeature {
40 RuleFeature(StyleRule* rule, unsigned selectorIndex)
41 : rule(rule)
42 , selectorIndex(selectorIndex)
43 {
44 }
45
46 StyleRule* rule;
47 unsigned selectorIndex;
48 };
49 37
50 class RuleFeatureSet { 38 class RuleFeatureSet {
51 public: 39 public:
52 RuleFeatureSet(); 40 RuleFeatureSet();
53 ~RuleFeatureSet(); 41 ~RuleFeatureSet();
54 42
55 void add(const RuleFeatureSet&); 43 void add(const RuleFeatureSet&);
56 void clear(); 44 void clear();
57 45
58 void collectFeaturesFromSelector(const CSSSelector&); 46 void collectFeaturesFromSelector(const CSSSelector&);
59 void collectFeaturesFromRuleData(const RuleData&);
60 47
61 inline bool hasSelectorForAttribute(const AtomicString& attributeName) const 48 inline bool hasSelectorForAttribute(const AtomicString& attributeName) const
62 { 49 {
63 ASSERT(!attributeName.isEmpty()); 50 ASSERT(!attributeName.isEmpty());
64 return m_attributeNames.contains(attributeName); 51 return m_attributeNames.contains(attributeName);
65 } 52 }
66 53
67 inline bool hasSelectorForClass(const AtomicString& classValue) const 54 inline bool hasSelectorForClass(const AtomicString& classValue) const
68 { 55 {
69 ASSERT(!classValue.isEmpty()); 56 ASSERT(!classValue.isEmpty());
70 return m_classNames.contains(classValue); 57 return m_classNames.contains(classValue);
71 } 58 }
72 59
73 inline bool hasSelectorForId(const AtomicString& idValue) const 60 inline bool hasSelectorForId(const AtomicString& idValue) const
74 { 61 {
75 ASSERT(!idValue.isEmpty()); 62 ASSERT(!idValue.isEmpty());
76 return m_idNames.contains(idValue); 63 return m_idNames.contains(idValue);
77 } 64 }
78 65
79 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& changed Classes, Element&); 66 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& changed Classes, Element&);
80 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClas ses, const SpaceSplitString& newClasses, Element&); 67 void scheduleStyleInvalidationForClassChange(const SpaceSplitString& oldClas ses, const SpaceSplitString& newClasses, Element&);
81 68
82 void scheduleStyleInvalidationForClassChange(const AtomicString& className, Element& element); 69 void scheduleStyleInvalidationForClassChange(const AtomicString& className, Element& element);
83 void scheduleStyleInvalidationForAttributeChange(const QualifiedName& attrib uteName, Element&); 70 void scheduleStyleInvalidationForAttributeChange(const QualifiedName& attrib uteName, Element&);
84 void scheduleStyleInvalidationForIdChange(const AtomicString& oldId, const A tomicString& newId, Element&); 71 void scheduleStyleInvalidationForIdChange(const AtomicString& oldId, const A tomicString& newId, Element&);
85 72
86 Vector<RuleFeature> attributeRules;
87
88 private: 73 private:
89 void addSelectorFeatures(const CSSSelector&); 74 void addSelectorFeatures(const CSSSelector&);
90 void collectFeaturesFromSelectorList(const CSSSelectorList*); 75 void collectFeaturesFromSelectorList(const CSSSelectorList*);
91 76
92 HashSet<AtomicString> m_classNames; 77 HashSet<AtomicString> m_classNames;
93 HashSet<AtomicString> m_attributeNames; 78 HashSet<AtomicString> m_attributeNames;
94 HashSet<AtomicString> m_idNames; 79 HashSet<AtomicString> m_idNames;
95 }; 80 };
96 81
97
98 } // namespace blink 82 } // namespace blink
99 83
100 namespace WTF {
101
102 template <> struct VectorTraits<blink::RuleFeature> : VectorTraitsBase<blink::Ru leFeature> {
103 static const bool needsDestruction = false;
104 static const bool canInitializeWithMemset = true;
105 static const bool canMoveWithMemcpy = true;
106 };
107
108 } // namespace WTF
109
110 #endif // SKY_ENGINE_CORE_CSS_RULEFEATURE_H_ 84 #endif // SKY_ENGINE_CORE_CSS_RULEFEATURE_H_
OLDNEW
« no previous file with comments | « sky/engine/core/css/ElementRuleCollector.cpp ('k') | sky/engine/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698