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

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

Issue 838313002: Move StyleResolver code out of ScopedStyleResolver. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | sky/engine/core/css/RuleSet.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/core/css/StyleRule.h" 27 #include "sky/engine/core/css/StyleRule.h"
28 #include "sky/engine/core/css/StyleRuleKeyframes.h" 28 #include "sky/engine/core/css/StyleRuleKeyframes.h"
29 #include "sky/engine/core/css/resolver/MediaQueryResult.h" 29 #include "sky/engine/core/css/resolver/MediaQueryResult.h"
30 #include "sky/engine/wtf/Forward.h" 30 #include "sky/engine/wtf/Forward.h"
31 #include "sky/engine/wtf/HashMap.h" 31 #include "sky/engine/wtf/HashMap.h"
32 #include "sky/engine/wtf/LinkedStack.h" 32 #include "sky/engine/wtf/LinkedStack.h"
33 #include "sky/engine/wtf/TerminatedArray.h" 33 #include "sky/engine/wtf/TerminatedArray.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 enum AddRuleFlags {
38 RuleHasNoSpecialState = 0,
39 RuleCanUseFastCheckSelector = 1,
40 };
41
42 class CSSSelector; 37 class CSSSelector;
43 class StyleSheetContents; 38 class StyleSheetContents;
44 39
45 class RuleData { 40 class RuleData {
46 ALLOW_ONLY_INLINE_ALLOCATION(); 41 ALLOW_ONLY_INLINE_ALLOCATION();
47 public: 42 public:
48 RuleData(StyleRule*, unsigned selectorIndex, unsigned position, AddRuleFlags ); 43 RuleData(StyleRule*, unsigned selectorIndex, unsigned position);
49 44
50 unsigned position() const { return m_position; } 45 unsigned position() const { return m_position; }
51 StyleRule* rule() const { return m_rule; } 46 StyleRule* rule() const { return m_rule; }
52 const CSSSelector& selector() const { return m_rule->selectorList().selector At(m_selectorIndex); } 47 const CSSSelector& selector() const { return m_rule->selectorList().selector At(m_selectorIndex); }
53 unsigned selectorIndex() const { return m_selectorIndex; } 48 unsigned selectorIndex() const { return m_selectorIndex; }
54 49
55 bool isLastInArray() const { return m_isLastInArray; } 50 bool isLastInArray() const { return m_isLastInArray; }
56 void setLastInArray(bool flag) { m_isLastInArray = flag; } 51 void setLastInArray(bool flag) { m_isLastInArray = flag; }
57 52
58 private: 53 private:
(...skipping 11 matching lines...) Expand all
70 }; 65 };
71 66
72 COMPILE_ASSERT(sizeof(RuleData) == sizeof(SameSizeAsRuleData), RuleData_should_s tay_small); 67 COMPILE_ASSERT(sizeof(RuleData) == sizeof(SameSizeAsRuleData), RuleData_should_s tay_small);
73 68
74 class RuleSet { 69 class RuleSet {
75 WTF_MAKE_NONCOPYABLE(RuleSet); 70 WTF_MAKE_NONCOPYABLE(RuleSet);
76 WTF_MAKE_FAST_ALLOCATED; 71 WTF_MAKE_FAST_ALLOCATED;
77 public: 72 public:
78 static PassOwnPtr<RuleSet> create() { return adoptPtr(new RuleSet); } 73 static PassOwnPtr<RuleSet> create() { return adoptPtr(new RuleSet); }
79 74
80 void addRulesFromSheet(StyleSheetContents*, AddRuleFlags = RuleHasNoSpecialS tate); 75 void addRulesFromSheet(StyleSheetContents*);
81 void addStyleRule(StyleRule*, AddRuleFlags); 76 void addStyleRule(StyleRule*);
82 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags); 77 void addRule(StyleRule*, unsigned selectorIndex);
83 78
84 const RuleFeatureSet& features() const { return m_features; } 79 const RuleFeatureSet& features() const { return m_features; }
85 80
86 const TerminatedArray<RuleData>* idRules(const AtomicString& key) const { AS SERT(!m_pendingRules); return m_idRules.get(key); } 81 const TerminatedArray<RuleData>* idRules(const AtomicString& key) const { AS SERT(!m_pendingRules); return m_idRules.get(key); }
87 const TerminatedArray<RuleData>* classRules(const AtomicString& key) const { ASSERT(!m_pendingRules); return m_classRules.get(key); } 82 const TerminatedArray<RuleData>* classRules(const AtomicString& key) const { ASSERT(!m_pendingRules); return m_classRules.get(key); }
88 const TerminatedArray<RuleData>* tagRules(const AtomicString& key) const { A SSERT(!m_pendingRules); return m_tagRules.get(key); } 83 const TerminatedArray<RuleData>* tagRules(const AtomicString& key) const { A SSERT(!m_pendingRules); return m_tagRules.get(key); }
89 const TerminatedArray<RuleData>* shadowPseudoElementRules(const AtomicString & key) const { ASSERT(!m_pendingRules); return m_shadowPseudoElementRules.get(ke y); } 84 const TerminatedArray<RuleData>* shadowPseudoElementRules(const AtomicString & key) const { ASSERT(!m_pendingRules); return m_shadowPseudoElementRules.get(ke y); }
90 const Vector<RuleData>* universalRules() const { ASSERT(!m_pendingRules); re turn &m_universalRules; } 85 const Vector<RuleData>* universalRules() const { ASSERT(!m_pendingRules); re turn &m_universalRules; }
91 const Vector<RawPtr<StyleRuleFontFace> >& fontFaceRules() const { return m_f ontFaceRules; } 86 const Vector<RawPtr<StyleRuleFontFace> >& fontFaceRules() const { return m_f ontFaceRules; }
92 const Vector<RawPtr<StyleRuleKeyframes> >& keyframesRules() const { return m _keyframesRules; } 87 const Vector<RawPtr<StyleRuleKeyframes> >& keyframesRules() const { return m _keyframesRules; }
(...skipping 16 matching lines...) Expand all
109 104
110 RuleSet() 105 RuleSet()
111 : m_ruleCount(0) 106 : m_ruleCount(0)
112 { 107 {
113 } 108 }
114 109
115 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&) ; 110 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&) ;
116 void addFontFaceRule(StyleRuleFontFace*); 111 void addFontFaceRule(StyleRuleFontFace*);
117 void addKeyframesRule(StyleRuleKeyframes*); 112 void addKeyframesRule(StyleRuleKeyframes*);
118 113
119 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, AddRuleFlags); 114 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&);
120 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); 115 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&);
121 116
122 void compactRules(); 117 void compactRules();
123 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); 118 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&);
124 119
125 class PendingRuleMaps { 120 class PendingRuleMaps {
126 public: 121 public:
127 static PassOwnPtr<PendingRuleMaps> create() { return adoptPtr(new Pendin gRuleMaps); } 122 static PassOwnPtr<PendingRuleMaps> create() { return adoptPtr(new Pendin gRuleMaps); }
128 123
129 PendingRuleMap idRules; 124 PendingRuleMap idRules;
(...skipping 29 matching lines...) Expand all
159 #ifndef NDEBUG 154 #ifndef NDEBUG
160 Vector<RuleData> m_allRules; 155 Vector<RuleData> m_allRules;
161 #endif 156 #endif
162 }; 157 };
163 158
164 } // namespace blink 159 } // namespace blink
165 160
166 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); 161 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData);
167 162
168 #endif // SKY_ENGINE_CORE_CSS_RULESET_H_ 163 #endif // SKY_ENGINE_CORE_CSS_RULESET_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/RuleSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698