OLD | NEW |
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 11 matching lines...) Expand all Loading... |
22 #ifndef StyleResolver_h | 22 #ifndef StyleResolver_h |
23 #define StyleResolver_h | 23 #define StyleResolver_h |
24 | 24 |
25 #include "core/animation/PropertyHandle.h" | 25 #include "core/animation/PropertyHandle.h" |
26 #include "core/css/ElementRuleCollector.h" | 26 #include "core/css/ElementRuleCollector.h" |
27 #include "core/css/PseudoStyleRequest.h" | 27 #include "core/css/PseudoStyleRequest.h" |
28 #include "core/css/RuleFeature.h" | 28 #include "core/css/RuleFeature.h" |
29 #include "core/css/RuleSet.h" | 29 #include "core/css/RuleSet.h" |
30 #include "core/css/SelectorChecker.h" | 30 #include "core/css/SelectorChecker.h" |
31 #include "core/css/SelectorFilter.h" | 31 #include "core/css/SelectorFilter.h" |
32 #include "core/css/TreeBoundaryCrossingRules.h" | |
33 #include "core/css/resolver/CSSPropertyPriority.h" | 32 #include "core/css/resolver/CSSPropertyPriority.h" |
34 #include "core/css/resolver/MatchedPropertiesCache.h" | 33 #include "core/css/resolver/MatchedPropertiesCache.h" |
35 #include "core/css/resolver/StyleBuilder.h" | 34 #include "core/css/resolver/StyleBuilder.h" |
36 #include "core/css/resolver/StyleResolverStats.h" | 35 #include "core/css/resolver/StyleResolverStats.h" |
37 #include "core/css/resolver/StyleResourceLoader.h" | 36 #include "core/css/resolver/StyleResourceLoader.h" |
38 #include "core/style/AuthorStyleInfo.h" | 37 #include "core/style/AuthorStyleInfo.h" |
39 #include "core/style/CachedUAStyle.h" | 38 #include "core/style/CachedUAStyle.h" |
40 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
41 #include "wtf/Deque.h" | 40 #include "wtf/Deque.h" |
42 #include "wtf/HashMap.h" | 41 #include "wtf/HashMap.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 unsigned accessCount() const { return m_accessCount; } | 177 unsigned accessCount() const { return m_accessCount; } |
179 void didAccess() { ++m_accessCount; } | 178 void didAccess() { ++m_accessCount; } |
180 | 179 |
181 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } | 180 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } |
182 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } | 181 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } |
183 | 182 |
184 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p
arent, PseudoId); | 183 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p
arent, PseudoId); |
185 | 184 |
186 DECLARE_TRACE(); | 185 DECLARE_TRACE(); |
187 | 186 |
188 void addTreeBoundaryCrossingScope(ContainerNode& scope); | |
189 | |
190 private: | 187 private: |
191 PassRefPtr<ComputedStyle> initialStyleForElement(); | 188 PassRefPtr<ComputedStyle> initialStyleForElement(); |
192 | 189 |
193 void initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBeMember<Styl
eRule>>& watchedSelectors); | 190 void initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBeMember<Styl
eRule>>& watchedSelectors); |
194 | 191 |
195 // FIXME: This should probably go away, folded into FontBuilder. | 192 // FIXME: This should probably go away, folded into FontBuilder. |
196 void updateFont(StyleResolverState&); | 193 void updateFont(StyleResolverState&); |
197 | 194 |
198 static AuthorStyleInfo authorStyleInfo(StyleResolverState&); | 195 static AuthorStyleInfo authorStyleInfo(StyleResolverState&); |
199 | 196 |
200 void loadPendingResources(StyleResolverState&); | 197 void loadPendingResources(StyleResolverState&); |
201 void adjustComputedStyle(StyleResolverState&, Element*); | 198 void adjustComputedStyle(StyleResolverState&, Element*); |
202 | 199 |
203 void appendCSSStyleSheet(CSSStyleSheet&); | 200 void appendCSSStyleSheet(CSSStyleSheet&); |
204 void addRulesFromSheet(CSSStyleSheet&, TreeScope*, unsigned); | 201 void addRulesFromSheet(CSSStyleSheet&, TreeScope*, unsigned); |
205 | 202 |
206 void collectPseudoRulesForElement(Element*, ElementRuleCollector&, PseudoId,
unsigned rulesToInclude); | 203 void collectPseudoRulesForElement(Element*, ElementRuleCollector&, PseudoId,
unsigned rulesToInclude); |
207 void matchRuleSet(ElementRuleCollector&, RuleSet*); | 204 void matchRuleSet(ElementRuleCollector&, RuleSet*); |
208 void matchUARules(ElementRuleCollector&); | 205 void matchUARules(ElementRuleCollector&); |
209 void matchAuthorRules(Element*, ElementRuleCollector&, bool includeEmptyRule
s); | 206 void matchAuthorRules(const Element&, ElementRuleCollector&, bool includeEmp
tyRules); |
| 207 void matchHostRules(const Element&, ElementRuleCollector&, bool includeEmpty
Rules); |
| 208 void matchScopedRules(const Element&, ElementRuleCollector&, bool includeEmp
tyRules); |
210 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool includeS
MILProperties); | 209 void matchAllRules(StyleResolverState&, ElementRuleCollector&, bool includeS
MILProperties); |
211 void collectFeatures(); | 210 void collectFeatures(); |
212 void resetRuleFeatures(); | 211 void resetRuleFeatures(); |
213 | 212 |
214 bool fastRejectSelector(const RuleData&) const; | 213 bool fastRejectSelector(const RuleData&) const; |
215 | 214 |
216 void applyMatchedProperties(StyleResolverState&, const MatchResult&); | 215 void applyMatchedProperties(StyleResolverState&, const MatchResult&); |
217 bool applyAnimatedProperties(StyleResolverState&, const Element* animatingEl
ement); | 216 bool applyAnimatedProperties(StyleResolverState&, const Element* animatingEl
ement); |
218 void applyCallbackSelectors(StyleResolverState&); | 217 void applyCallbackSelectors(StyleResolverState&); |
219 | 218 |
220 template <CSSPropertyPriority priority> | 219 template <CSSPropertyPriority priority> |
221 void applyMatchedProperties(StyleResolverState&, const MatchResult&, bool im
portant, unsigned startIndex, unsigned endIndex, bool inheritedOnly); | 220 void applyMatchedProperties(StyleResolverState&, const MatchedPropertiesRang
e&, bool important, bool inheritedOnly); |
222 template <CSSPropertyPriority priority> | 221 template <CSSPropertyPriority priority> |
223 void applyProperties(StyleResolverState&, const StylePropertySet* properties
, bool isImportant, bool inheritedOnly, PropertyWhitelistType = PropertyWhitelis
tNone); | 222 void applyProperties(StyleResolverState&, const StylePropertySet* properties
, bool isImportant, bool inheritedOnly, PropertyWhitelistType = PropertyWhitelis
tNone); |
224 template <CSSPropertyPriority priority> | 223 template <CSSPropertyPriority priority> |
225 void applyAnimatedProperties(StyleResolverState&, const WillBeHeapHashMap<Pr
opertyHandle, RefPtrWillBeMember<Interpolation>>&); | 224 void applyAnimatedProperties(StyleResolverState&, const WillBeHeapHashMap<Pr
opertyHandle, RefPtrWillBeMember<Interpolation>>&); |
226 template <CSSPropertyPriority priority> | 225 template <CSSPropertyPriority priority> |
227 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly); | 226 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly); |
228 | 227 |
229 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag
e, const String& pageName); | 228 void matchPageRules(MatchResult&, RuleSet*, bool isLeftPage, bool isFirstPag
e, const String& pageName); |
230 void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage
>>& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage>>&, bo
ol isLeftPage, bool isFirstPage, const String& pageName); | 229 void matchPageRulesForList(WillBeHeapVector<RawPtrWillBeMember<StyleRulePage
>>& matchedRules, const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage>>&, bo
ol isLeftPage, bool isFirstPage, const String& pageName); |
231 void collectViewportRules(); | 230 void collectViewportRules(); |
(...skipping 24 matching lines...) Expand all Loading... |
256 OwnPtrWillBeMember<ViewportStyleResolver> m_viewportStyleResolver; | 255 OwnPtrWillBeMember<ViewportStyleResolver> m_viewportStyleResolver; |
257 | 256 |
258 WillBeHeapListHashSet<RawPtrWillBeMember<CSSStyleSheet>, 16> m_pendingStyleS
heets; | 257 WillBeHeapListHashSet<RawPtrWillBeMember<CSSStyleSheet>, 16> m_pendingStyleS
heets; |
259 | 258 |
260 // FIXME: The entire logic of collecting features on StyleResolver, as well
as transferring them | 259 // FIXME: The entire logic of collecting features on StyleResolver, as well
as transferring them |
261 // between various parts of machinery smells wrong. This needs to be better
somehow. | 260 // between various parts of machinery smells wrong. This needs to be better
somehow. |
262 RuleFeatureSet m_features; | 261 RuleFeatureSet m_features; |
263 OwnPtrWillBeMember<RuleSet> m_siblingRuleSet; | 262 OwnPtrWillBeMember<RuleSet> m_siblingRuleSet; |
264 OwnPtrWillBeMember<RuleSet> m_uncommonAttributeRuleSet; | 263 OwnPtrWillBeMember<RuleSet> m_uncommonAttributeRuleSet; |
265 OwnPtrWillBeMember<RuleSet> m_watchedSelectorsRules; | 264 OwnPtrWillBeMember<RuleSet> m_watchedSelectorsRules; |
266 TreeBoundaryCrossingRules m_treeBoundaryCrossingRules; | |
267 | 265 |
268 bool m_needCollectFeatures; | 266 bool m_needCollectFeatures; |
269 bool m_printMediaType; | 267 bool m_printMediaType; |
270 | 268 |
271 StyleResourceLoader m_styleResourceLoader; | 269 StyleResourceLoader m_styleResourceLoader; |
272 | 270 |
273 unsigned m_styleSharingDepth; | 271 unsigned m_styleSharingDepth; |
274 WillBeHeapVector<OwnPtrWillBeMember<StyleSharingList>, styleSharingMaxDepth>
m_styleSharingLists; | 272 WillBeHeapVector<OwnPtrWillBeMember<StyleSharingList>, styleSharingMaxDepth>
m_styleSharingLists; |
275 | 273 |
276 OwnPtr<StyleResolverStats> m_styleResolverStats; | 274 OwnPtr<StyleResolverStats> m_styleResolverStats; |
277 | 275 |
278 // Use only for Internals::updateStyleAndReturnAffectedElementCount. | 276 // Use only for Internals::updateStyleAndReturnAffectedElementCount. |
279 unsigned m_accessCount; | 277 unsigned m_accessCount; |
280 }; | 278 }; |
281 | 279 |
282 } // namespace blink | 280 } // namespace blink |
283 | 281 |
284 #endif // StyleResolver_h | 282 #endif // StyleResolver_h |
OLD | NEW |