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. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 105 |
106 PassRefPtr<ComputedStyle> styleForPage(int pageIndex); | 106 PassRefPtr<ComputedStyle> styleForPage(int pageIndex); |
107 PassRefPtr<ComputedStyle> styleForText(Text*); | 107 PassRefPtr<ComputedStyle> styleForText(Text*); |
108 | 108 |
109 static PassRefPtr<ComputedStyle> styleForDocument(Document&); | 109 static PassRefPtr<ComputedStyle> styleForDocument(Document&); |
110 | 110 |
111 // FIXME: It could be better to call appendAuthorStyleSheets() directly after | 111 // FIXME: It could be better to call appendAuthorStyleSheets() directly after |
112 // we factor StyleResolver further. | 112 // we factor StyleResolver further. |
113 // https://bugs.webkit.org/show_bug.cgi?id=108890 | 113 // https://bugs.webkit.org/show_bug.cgi?id=108890 |
114 void appendAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>&); | 114 void appendAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>&); |
115 void resetRuleFeatures(); | |
116 void finishAppendAuthorStyleSheets(); | |
117 | |
118 void lazyAppendAuthorStyleSheets(unsigned firstNew, | 115 void lazyAppendAuthorStyleSheets(unsigned firstNew, |
119 const HeapVector<Member<CSSStyleSheet>>&); | 116 const HeapVector<Member<CSSStyleSheet>>&); |
120 void removePendingAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>&); | 117 void removePendingAuthorStyleSheets(const HeapVector<Member<CSSStyleSheet>>&); |
121 void appendPendingAuthorStyleSheets(); | 118 void appendPendingAuthorStyleSheets(); |
122 bool hasPendingAuthorStyleSheets() const { | 119 bool hasPendingAuthorStyleSheets() const { |
123 return m_pendingStyleSheets.size() > 0 || m_needCollectFeatures; | 120 return m_pendingStyleSheets.size() > 0; |
124 } | 121 } |
125 | 122 |
126 // TODO(esprehn): StyleResolver should probably not contain tree walking | 123 // TODO(esprehn): StyleResolver should probably not contain tree walking |
127 // state, instead we should pass a context object during recalcStyle. | 124 // state, instead we should pass a context object during recalcStyle. |
128 SelectorFilter& selectorFilter() { return m_selectorFilter; } | 125 SelectorFilter& selectorFilter() { return m_selectorFilter; } |
129 | 126 |
130 StyleRuleKeyframes* findKeyframesRule(const Element*, | 127 StyleRuleKeyframes* findKeyframesRule(const Element*, |
131 const AtomicString& animationName); | 128 const AtomicString& animationName); |
132 | 129 |
133 // These methods will give back the set of rules that matched for a given | 130 // These methods will give back the set of rules that matched for a given |
(...skipping 29 matching lines...) Expand all Loading... |
163 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something. | 160 // FIXME: Rename to reflect the purpose, like didChangeFontSize or something. |
164 void invalidateMatchedPropertiesCache(); | 161 void invalidateMatchedPropertiesCache(); |
165 | 162 |
166 void notifyResizeForViewportUnits(); | 163 void notifyResizeForViewportUnits(); |
167 | 164 |
168 // Exposed for ComputedStyle::isStyleAvilable(). | 165 // Exposed for ComputedStyle::isStyleAvilable(). |
169 static ComputedStyle* styleNotYetAvailable() { | 166 static ComputedStyle* styleNotYetAvailable() { |
170 return s_styleNotYetAvailable; | 167 return s_styleNotYetAvailable; |
171 } | 168 } |
172 | 169 |
173 RuleFeatureSet& ensureUpdatedRuleFeatureSet() { | |
174 if (hasPendingAuthorStyleSheets()) | |
175 appendPendingAuthorStyleSheets(); | |
176 RELEASE_ASSERT(m_features.isAlive()); | |
177 return m_features; | |
178 } | |
179 | |
180 StyleSharingList& styleSharingList(); | 170 StyleSharingList& styleSharingList(); |
181 | 171 |
182 bool hasRulesForId(const AtomicString&) const; | |
183 bool hasFullscreenUAStyle() const { return m_hasFullscreenUAStyle; } | |
184 | |
185 void addToStyleSharingList(Element&); | 172 void addToStyleSharingList(Element&); |
186 void clearStyleSharingList(); | 173 void clearStyleSharingList(); |
187 | 174 |
188 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } | 175 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } |
189 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } | 176 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } |
190 | 177 |
191 PseudoElement* createPseudoElementIfNeeded(Element& parent, PseudoId); | 178 PseudoElement* createPseudoElementIfNeeded(Element& parent, PseudoId); |
192 | 179 |
193 DECLARE_TRACE(); | 180 DECLARE_TRACE(); |
194 | 181 |
195 void initWatchedSelectorRules(); | |
196 | |
197 private: | 182 private: |
198 explicit StyleResolver(Document&); | 183 explicit StyleResolver(Document&); |
199 | 184 |
200 PassRefPtr<ComputedStyle> initialStyleForElement(); | 185 PassRefPtr<ComputedStyle> initialStyleForElement(); |
201 | 186 |
202 // FIXME: This should probably go away, folded into FontBuilder. | 187 // FIXME: This should probably go away, folded into FontBuilder. |
203 void updateFont(StyleResolverState&); | 188 void updateFont(StyleResolverState&); |
204 | 189 |
205 void loadPendingResources(StyleResolverState&); | 190 void loadPendingResources(StyleResolverState&); |
206 void adjustComputedStyle(StyleResolverState&, Element*); | 191 void adjustComputedStyle(StyleResolverState&, Element*); |
207 | 192 |
208 void appendCSSStyleSheet(CSSStyleSheet&); | 193 void appendCSSStyleSheet(CSSStyleSheet&); |
209 | 194 |
210 void collectPseudoRulesForElement(const Element&, | 195 void collectPseudoRulesForElement(const Element&, |
211 ElementRuleCollector&, | 196 ElementRuleCollector&, |
212 PseudoId, | 197 PseudoId, |
213 unsigned rulesToInclude); | 198 unsigned rulesToInclude); |
214 void matchRuleSet(ElementRuleCollector&, RuleSet*); | 199 void matchRuleSet(ElementRuleCollector&, RuleSet*); |
215 void matchUARules(ElementRuleCollector&); | 200 void matchUARules(ElementRuleCollector&); |
216 void matchScopedRules(const Element&, ElementRuleCollector&); | 201 void matchScopedRules(const Element&, ElementRuleCollector&); |
217 void matchAuthorRules(const Element&, ElementRuleCollector&); | 202 void matchAuthorRules(const Element&, ElementRuleCollector&); |
218 void matchAuthorRulesV0(const Element&, ElementRuleCollector&); | 203 void matchAuthorRulesV0(const Element&, ElementRuleCollector&); |
219 void matchAllRules(StyleResolverState&, | 204 void matchAllRules(StyleResolverState&, |
220 ElementRuleCollector&, | 205 ElementRuleCollector&, |
221 bool includeSMILProperties); | 206 bool includeSMILProperties); |
222 void collectFeatures(); | |
223 void collectTreeBoundaryCrossingRulesV0CascadeOrder(const Element&, | 207 void collectTreeBoundaryCrossingRulesV0CascadeOrder(const Element&, |
224 ElementRuleCollector&); | 208 ElementRuleCollector&); |
225 | 209 |
226 void applyMatchedProperties(StyleResolverState&, const MatchResult&); | 210 void applyMatchedProperties(StyleResolverState&, const MatchResult&); |
227 bool applyAnimatedProperties(StyleResolverState&, | 211 bool applyAnimatedProperties(StyleResolverState&, |
228 const Element* animatingElement); | 212 const Element* animatingElement); |
229 void applyCallbackSelectors(StyleResolverState&); | 213 void applyCallbackSelectors(StyleResolverState&); |
230 | 214 |
231 template <CSSPropertyPriority priority> | 215 template <CSSPropertyPriority priority> |
232 void applyMatchedProperties(StyleResolverState&, | 216 void applyMatchedProperties(StyleResolverState&, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 254 |
271 Member<MediaQueryEvaluator> m_medium; | 255 Member<MediaQueryEvaluator> m_medium; |
272 MediaQueryResultList m_viewportDependentMediaQueryResults; | 256 MediaQueryResultList m_viewportDependentMediaQueryResults; |
273 MediaQueryResultList m_deviceDependentMediaQueryResults; | 257 MediaQueryResultList m_deviceDependentMediaQueryResults; |
274 | 258 |
275 Member<Document> m_document; | 259 Member<Document> m_document; |
276 SelectorFilter m_selectorFilter; | 260 SelectorFilter m_selectorFilter; |
277 | 261 |
278 HeapListHashSet<Member<CSSStyleSheet>, 16> m_pendingStyleSheets; | 262 HeapListHashSet<Member<CSSStyleSheet>, 16> m_pendingStyleSheets; |
279 | 263 |
280 // FIXME: The entire logic of collecting features on StyleResolver, as well as | |
281 // transferring them between various parts of machinery smells wrong. This | |
282 // needs to be better somehow. | |
283 RuleFeatureSet m_features; | |
284 Member<RuleSet> m_siblingRuleSet; | |
285 Member<RuleSet> m_uncommonAttributeRuleSet; | |
286 Member<RuleSet> m_watchedSelectorsRules; | |
287 | |
288 bool m_needCollectFeatures; | |
289 bool m_printMediaType; | 264 bool m_printMediaType; |
290 bool m_hasFullscreenUAStyle = false; | |
291 | 265 |
292 unsigned m_styleSharingDepth; | 266 unsigned m_styleSharingDepth; |
293 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> | 267 HeapVector<Member<StyleSharingList>, styleSharingMaxDepth> |
294 m_styleSharingLists; | 268 m_styleSharingLists; |
295 }; | 269 }; |
296 | 270 |
297 } // namespace blink | 271 } // namespace blink |
298 | 272 |
299 #endif // StyleResolver_h | 273 #endif // StyleResolver_h |
OLD | NEW |