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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 const unsigned styleSharingListSize = 15; | 73 const unsigned styleSharingListSize = 15; |
74 const unsigned styleSharingMaxDepth = 32; | 74 const unsigned styleSharingMaxDepth = 32; |
75 using StyleSharingList = HeapDeque<Member<Element>, styleSharingListSize>; | 75 using StyleSharingList = HeapDeque<Member<Element>, styleSharingListSize>; |
76 using ActiveInterpolationsMap = HashMap<PropertyHandle, Vector<RefPtr<Interpolat
ion>, 1>>; | 76 using ActiveInterpolationsMap = HashMap<PropertyHandle, Vector<RefPtr<Interpolat
ion>, 1>>; |
77 | 77 |
78 // This class selects a ComputedStyle for a given element based on a collection
of stylesheets. | 78 // This class selects a ComputedStyle for a given element based on a collection
of stylesheets. |
79 class CORE_EXPORT StyleResolver final : public GarbageCollectedFinalized<StyleRe
solver> { | 79 class CORE_EXPORT StyleResolver final : public GarbageCollectedFinalized<StyleRe
solver> { |
80 WTF_MAKE_NONCOPYABLE(StyleResolver); | 80 WTF_MAKE_NONCOPYABLE(StyleResolver); |
81 public: | 81 public: |
82 static RawPtr<StyleResolver> create(Document& document) | 82 static StyleResolver* create(Document& document) |
83 { | 83 { |
84 return new StyleResolver(document); | 84 return new StyleResolver(document); |
85 } | 85 } |
86 ~StyleResolver(); | 86 ~StyleResolver(); |
87 void dispose(); | 87 void dispose(); |
88 | 88 |
89 PassRefPtr<ComputedStyle> styleForElement(Element*, const ComputedStyle* par
entStyle = 0, StyleSharingBehavior = AllowStyleSharing, | 89 PassRefPtr<ComputedStyle> styleForElement(Element*, const ComputedStyle* par
entStyle = 0, StyleSharingBehavior = AllowStyleSharing, |
90 RuleMatchingBehavior = MatchAllRules); | 90 RuleMatchingBehavior = MatchAllRules); |
91 | 91 |
92 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, c
onst ComputedStyle* baseStyle, CSSPropertyID, CSSValue*); | 92 static PassRefPtr<AnimatableValue> createAnimatableValueSnapshot(Element&, c
onst ComputedStyle* baseStyle, CSSPropertyID, CSSValue*); |
(...skipping 26 matching lines...) Expand all Loading... |
119 | 119 |
120 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). | 120 // These methods will give back the set of rules that matched for a given el
ement (or a pseudo-element). |
121 enum CSSRuleFilter { | 121 enum CSSRuleFilter { |
122 UAAndUserCSSRules = 1 << 1, | 122 UAAndUserCSSRules = 1 << 1, |
123 AuthorCSSRules = 1 << 2, | 123 AuthorCSSRules = 1 << 2, |
124 EmptyCSSRules = 1 << 3, | 124 EmptyCSSRules = 1 << 3, |
125 CrossOriginCSSRules = 1 << 4, | 125 CrossOriginCSSRules = 1 << 4, |
126 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS
SRules, | 126 AllButEmptyCSSRules = UAAndUserCSSRules | AuthorCSSRules | CrossOriginCS
SRules, |
127 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, | 127 AllCSSRules = AllButEmptyCSSRules | EmptyCSSRules, |
128 }; | 128 }; |
129 RawPtr<CSSRuleList> cssRulesForElement(Element*, unsigned rulesToInclude = A
llButEmptyCSSRules); | 129 CSSRuleList* cssRulesForElement(Element*, unsigned rulesToInclude = AllButEm
ptyCSSRules); |
130 RawPtr<CSSRuleList> pseudoCSSRulesForElement(Element*, PseudoId, unsigned ru
lesToInclude = AllButEmptyCSSRules); | 130 CSSRuleList* pseudoCSSRulesForElement(Element*, PseudoId, unsigned rulesToIn
clude = AllButEmptyCSSRules); |
131 RawPtr<StyleRuleList> styleRulesForElement(Element*, unsigned rulesToInclude
); | 131 StyleRuleList* styleRulesForElement(Element*, unsigned rulesToInclude); |
132 | 132 |
133 void computeFont(ComputedStyle*, const StylePropertySet&); | 133 void computeFont(ComputedStyle*, const StylePropertySet&); |
134 | 134 |
135 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol
ver.get(); } | 135 ViewportStyleResolver* viewportStyleResolver() { return m_viewportStyleResol
ver.get(); } |
136 | 136 |
137 void addViewportDependentMediaQueries(const MediaQueryResultList&); | 137 void addViewportDependentMediaQueries(const MediaQueryResultList&); |
138 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM
ediaQueryResults.isEmpty(); } | 138 bool hasViewportDependentMediaQueries() const { return !m_viewportDependentM
ediaQueryResults.isEmpty(); } |
139 bool mediaQueryAffectedByViewportChange() const; | 139 bool mediaQueryAffectedByViewportChange() const; |
140 void addDeviceDependentMediaQueries(const MediaQueryResultList&); | 140 void addDeviceDependentMediaQueries(const MediaQueryResultList&); |
141 bool mediaQueryAffectedByDeviceChange() const; | 141 bool mediaQueryAffectedByDeviceChange() const; |
(...skipping 22 matching lines...) Expand all Loading... |
164 | 164 |
165 bool hasRulesForId(const AtomicString&) const; | 165 bool hasRulesForId(const AtomicString&) const; |
166 bool hasFullscreenUAStyle() const { return m_hasFullscreenUAStyle; } | 166 bool hasFullscreenUAStyle() const { return m_hasFullscreenUAStyle; } |
167 | 167 |
168 void addToStyleSharingList(Element&); | 168 void addToStyleSharingList(Element&); |
169 void clearStyleSharingList(); | 169 void clearStyleSharingList(); |
170 | 170 |
171 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } | 171 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } |
172 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } | 172 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } |
173 | 173 |
174 RawPtr<PseudoElement> createPseudoElementIfNeeded(Element& parent, PseudoId)
; | 174 PseudoElement* createPseudoElementIfNeeded(Element& parent, PseudoId); |
175 | 175 |
176 DECLARE_TRACE(); | 176 DECLARE_TRACE(); |
177 | 177 |
178 void addTreeBoundaryCrossingScope(ContainerNode& scope); | 178 void addTreeBoundaryCrossingScope(ContainerNode& scope); |
179 void initWatchedSelectorRules(); | 179 void initWatchedSelectorRules(); |
180 | 180 |
181 private: | 181 private: |
182 explicit StyleResolver(Document&); | 182 explicit StyleResolver(Document&); |
183 | 183 |
184 PassRefPtr<ComputedStyle> initialStyleForElement(); | 184 PassRefPtr<ComputedStyle> initialStyleForElement(); |
(...skipping 28 matching lines...) Expand all Loading... |
213 void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolations
Map&); | 213 void applyAnimatedProperties(StyleResolverState&, const ActiveInterpolations
Map&); |
214 template <CSSPropertyPriority priority> | 214 template <CSSPropertyPriority priority> |
215 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, Pr
opertyWhitelistType); | 215 void applyAllProperty(StyleResolverState&, CSSValue*, bool inheritedOnly, Pr
opertyWhitelistType); |
216 template <CSSPropertyPriority priority> | 216 template <CSSPropertyPriority priority> |
217 void applyPropertiesForApplyAtRule(StyleResolverState&, const CSSValue*, boo
l isImportant, bool inheritedOnly, PropertyWhitelistType); | 217 void applyPropertiesForApplyAtRule(StyleResolverState&, const CSSValue*, boo
l isImportant, bool inheritedOnly, PropertyWhitelistType); |
218 | 218 |
219 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, cons
t ComputedStyle* parentStyle, StyleResolverState&); | 219 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, cons
t ComputedStyle* parentStyle, StyleResolverState&); |
220 bool hasAuthorBackground(const StyleResolverState&); | 220 bool hasAuthorBackground(const StyleResolverState&); |
221 bool hasAuthorBorder(const StyleResolverState&); | 221 bool hasAuthorBorder(const StyleResolverState&); |
222 | 222 |
223 RawPtr<PseudoElement> createPseudoElement(Element* parent, PseudoId); | 223 PseudoElement* createPseudoElement(Element* parent, PseudoId); |
224 | 224 |
225 Document& document() { return *m_document; } | 225 Document& document() { return *m_document; } |
226 | 226 |
227 static ComputedStyle* s_styleNotYetAvailable; | 227 static ComputedStyle* s_styleNotYetAvailable; |
228 | 228 |
229 MatchedPropertiesCache m_matchedPropertiesCache; | 229 MatchedPropertiesCache m_matchedPropertiesCache; |
230 | 230 |
231 Member<MediaQueryEvaluator> m_medium; | 231 Member<MediaQueryEvaluator> m_medium; |
232 MediaQueryResultList m_viewportDependentMediaQueryResults; | 232 MediaQueryResultList m_viewportDependentMediaQueryResults; |
233 MediaQueryResultList m_deviceDependentMediaQueryResults; | 233 MediaQueryResultList m_deviceDependentMediaQueryResults; |
(...skipping 18 matching lines...) Expand all Loading... |
252 bool m_printMediaType; | 252 bool m_printMediaType; |
253 bool m_hasFullscreenUAStyle = false; | 253 bool m_hasFullscreenUAStyle = false; |
254 | 254 |
255 unsigned m_styleSharingDepth; | 255 unsigned m_styleSharingDepth; |
256 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLis
ts; | 256 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> m_styleSharingLis
ts; |
257 }; | 257 }; |
258 | 258 |
259 } // namespace blink | 259 } // namespace blink |
260 | 260 |
261 #endif // StyleResolver_h | 261 #endif // StyleResolver_h |
OLD | NEW |