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

Side by Side Diff: sky/engine/core/css/resolver/StyleResolver.h

Issue 844873002: Simplify the style sharing list code. (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/resolver/StyleResolver.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 class Settings; 58 class Settings;
59 class StyleKeyframe; 59 class StyleKeyframe;
60 class StylePropertySet; 60 class StylePropertySet;
61 class StyleResolverStats; 61 class StyleResolverStats;
62 class StyleRule; 62 class StyleRule;
63 class StyleRuleKeyframes; 63 class StyleRuleKeyframes;
64 64
65 class MatchResult; 65 class MatchResult;
66 66
67 const unsigned styleSharingListSize = 15; 67 const unsigned styleSharingListSize = 15;
68 const unsigned styleSharingMaxDepth = 32; 68 typedef Deque<Element*, styleSharingListSize> StyleSharingList;
69 typedef Deque<RawPtr<Element>, styleSharingListSize> StyleSharingList;
70 69
71 struct CSSPropertyValue { 70 struct CSSPropertyValue {
72 STACK_ALLOCATED(); 71 STACK_ALLOCATED();
73 public: 72 public:
74 CSSPropertyValue(CSSPropertyID property, CSSValue* value) 73 CSSPropertyValue(CSSPropertyID property, CSSValue* value)
75 : property(property), value(value) { } 74 : property(property), value(value) { }
76 // Stores value=propertySet.getPropertyCSSValue(id).get(). 75 // Stores value=propertySet.getPropertyCSSValue(id).get().
77 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); 76 CSSPropertyValue(CSSPropertyID, const StylePropertySet&);
78 CSSPropertyID property; 77 CSSPropertyID property;
79 RawPtr<CSSValue> value; 78 RawPtr<CSSValue> value;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count , RenderStyle*); 118 void applyPropertiesToStyle(const CSSPropertyValue* properties, size_t count , RenderStyle*);
120 119
121 void addMediaQueryResults(const MediaQueryResultList&); 120 void addMediaQueryResults(const MediaQueryResultList&);
122 bool mediaQueryAffectedByViewportChange() const; 121 bool mediaQueryAffectedByViewportChange() const;
123 122
124 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something . 123 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something .
125 void invalidateMatchedPropertiesCache(); 124 void invalidateMatchedPropertiesCache();
126 125
127 void notifyResizeForViewportUnits(); 126 void notifyResizeForViewportUnits();
128 127
129 StyleSharingList& styleSharingList(); 128 StyleSharingList& styleSharingList() { return m_styleSharingList; }
130 129
131 void addToStyleSharingList(Element&); 130 void addToStyleSharingList(Element&);
132 void clearStyleSharingList(); 131 void clearStyleSharingList();
133 132
134 StyleResolverStats* stats() { return m_styleResolverStats.get(); } 133 StyleResolverStats* stats() { return m_styleResolverStats.get(); }
135 StyleResolverStats* statsTotals() { return m_styleResolverStatsTotals.get(); } 134 StyleResolverStats* statsTotals() { return m_styleResolverStatsTotals.get(); }
136 enum StatsReportType { ReportDefaultStats, ReportSlowStats }; 135 enum StatsReportType { ReportDefaultStats, ReportSlowStats };
137 void enableStats(StatsReportType = ReportDefaultStats); 136 void enableStats(StatsReportType = ReportDefaultStats);
138 void disableStats(); 137 void disableStats();
139 void printStats(); 138 void printStats();
140 139
141 unsigned accessCount() const { return m_accessCount; } 140 unsigned accessCount() const { return m_accessCount; }
142 void didAccess() { ++m_accessCount; } 141 void didAccess() { ++m_accessCount; }
143 142
144 void increaseStyleSharingDepth() { ++m_styleSharingDepth; }
145 void decreaseStyleSharingDepth() { --m_styleSharingDepth; }
146
147 private: 143 private:
148 // FIXME: This should probably go away, folded into FontBuilder. 144 // FIXME: This should probably go away, folded into FontBuilder.
149 void updateFont(StyleResolverState&); 145 void updateFont(StyleResolverState&);
150 146
151 void loadPendingResources(StyleResolverState&); 147 void loadPendingResources(StyleResolverState&);
152 148
153 void appendCSSStyleSheet(CSSStyleSheet*); 149 void appendCSSStyleSheet(CSSStyleSheet*);
154 150
155 void matchAuthorRules(Element*, ElementRuleCollector&); 151 void matchAuthorRules(Element*, ElementRuleCollector&);
156 void matchAllRules(StyleResolverState&, ElementRuleCollector&); 152 void matchAllRules(StyleResolverState&, ElementRuleCollector&);
(...skipping 27 matching lines...) Expand all
184 MediaQueryResultList m_viewportDependentMediaQueryResults; 180 MediaQueryResultList m_viewportDependentMediaQueryResults;
185 181
186 RawPtr<Document> m_document; 182 RawPtr<Document> m_document;
187 183
188 ListHashSet<RawPtr<CSSStyleSheet>, 16> m_pendingStyleSheets; 184 ListHashSet<RawPtr<CSSStyleSheet>, 16> m_pendingStyleSheets;
189 185
190 bool m_printMediaType; 186 bool m_printMediaType;
191 187
192 StyleResourceLoader m_styleResourceLoader; 188 StyleResourceLoader m_styleResourceLoader;
193 189
194 unsigned m_styleSharingDepth; 190 StyleSharingList m_styleSharingList;
195 Vector<OwnPtr<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLists;
196 191
197 OwnPtr<StyleResolverStats> m_styleResolverStats; 192 OwnPtr<StyleResolverStats> m_styleResolverStats;
198 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; 193 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals;
199 unsigned m_styleResolverStatsSequence; 194 unsigned m_styleResolverStatsSequence;
200 195
201 // Use only for Internals::updateStyleAndReturnAffectedElementCount. 196 // Use only for Internals::updateStyleAndReturnAffectedElementCount.
202 unsigned m_accessCount; 197 unsigned m_accessCount;
203 }; 198 };
204 199
205 } // namespace blink 200 } // namespace blink
206 201
207 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_ 202 #endif // SKY_ENGINE_CORE_CSS_RESOLVER_STYLERESOLVER_H_
OLDNEW
« no previous file with comments | « no previous file | sky/engine/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698