| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 CSSPropertyValue(CSSPropertyID property, CSSValue* value) | 97 CSSPropertyValue(CSSPropertyID property, CSSValue* value) |
| 98 : property(property), value(value) { } | 98 : property(property), value(value) { } |
| 99 // Stores value=propertySet.getPropertyCSSValue(id).get(). | 99 // Stores value=propertySet.getPropertyCSSValue(id).get(). |
| 100 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); | 100 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); |
| 101 CSSPropertyID property; | 101 CSSPropertyID property; |
| 102 RawPtrWillBeMember<CSSValue> value; | 102 RawPtrWillBeMember<CSSValue> value; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 105 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
| 106 class StyleResolver FINAL : public CSSFontSelectorClient { | 106 class StyleResolver FINAL : public CSSFontSelectorClient { |
| 107 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; | 107 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED
; |
| 108 public: | 108 public: |
| 109 explicit StyleResolver(Document&); | 109 explicit StyleResolver(Document&); |
| 110 virtual ~StyleResolver(); | 110 virtual ~StyleResolver(); |
| 111 | 111 |
| 112 // FIXME: StyleResolver should not be keeping tree-walk state. | 112 // FIXME: StyleResolver should not be keeping tree-walk state. |
| 113 // These should move to some global tree-walk state, or should be contained
in a | 113 // These should move to some global tree-walk state, or should be contained
in a |
| 114 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. | 114 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. |
| 115 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. | 115 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
| 116 void pushParentElement(Element&); | 116 void pushParentElement(Element&); |
| 117 void popParentElement(Element&); | 117 void popParentElement(Element&); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 enum StatsReportType { ReportDefaultStats, ReportSlowStats }; | 223 enum StatsReportType { ReportDefaultStats, ReportSlowStats }; |
| 224 void enableStats(StatsReportType = ReportDefaultStats); | 224 void enableStats(StatsReportType = ReportDefaultStats); |
| 225 void disableStats(); | 225 void disableStats(); |
| 226 void printStats(); | 226 void printStats(); |
| 227 | 227 |
| 228 unsigned accessCount() const { return m_accessCount; } | 228 unsigned accessCount() const { return m_accessCount; } |
| 229 void didAccess() { ++m_accessCount; } | 229 void didAccess() { ++m_accessCount; } |
| 230 | 230 |
| 231 PassRefPtr<PseudoElement> createPseudoElementIfNeeded(Element& parent, Pseud
oId); | 231 PassRefPtr<PseudoElement> createPseudoElementIfNeeded(Element& parent, Pseud
oId); |
| 232 | 232 |
| 233 virtual void trace(Visitor*) OVERRIDE; |
| 234 |
| 233 private: | 235 private: |
| 234 // CSSFontSelectorClient implementation. | 236 // CSSFontSelectorClient implementation. |
| 235 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; | 237 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; |
| 236 | 238 |
| 237 private: | 239 private: |
| 238 void initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBeMember<Styl
eRule> >& watchedSelectors); | 240 void initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBeMember<Styl
eRule> >& watchedSelectors); |
| 239 | 241 |
| 240 void addTreeBoundaryCrossingRules(const WillBeHeapVector<MinimalRuleData>&,
ContainerNode* scope); | 242 void addTreeBoundaryCrossingRules(const WillBeHeapVector<MinimalRuleData>&,
ContainerNode* scope); |
| 241 | 243 |
| 242 // FIXME: This should probably go away, folded into FontBuilder. | 244 // FIXME: This should probably go away, folded into FontBuilder. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 Settings* documentSettings() { return m_document.settings(); } | 284 Settings* documentSettings() { return m_document.settings(); } |
| 283 | 285 |
| 284 bool isLeftPage(int pageIndex) const; | 286 bool isLeftPage(int pageIndex) const; |
| 285 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } | 287 bool isRightPage(int pageIndex) const { return !isLeftPage(pageIndex); } |
| 286 bool isFirstPage(int pageIndex) const; | 288 bool isFirstPage(int pageIndex) const; |
| 287 String pageName(int pageIndex) const; | 289 String pageName(int pageIndex) const; |
| 288 | 290 |
| 289 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, Rend
erStyle* parentStyle, StyleResolverState&); | 291 bool pseudoStyleForElementInternal(Element&, const PseudoStyleRequest&, Rend
erStyle* parentStyle, StyleResolverState&); |
| 290 | 292 |
| 291 // FIXME: This likely belongs on RuleSet. | 293 // FIXME: This likely belongs on RuleSet. |
| 292 typedef WillBePersistentHeapHashMap<StringImpl*, RefPtrWillBeMember<StyleRul
eKeyframes> > KeyframesRuleMap; | 294 typedef WillBeHeapHashMap<StringImpl*, RefPtrWillBeMember<StyleRuleKeyframes
> > KeyframesRuleMap; |
| 293 KeyframesRuleMap m_keyframesRuleMap; | 295 KeyframesRuleMap m_keyframesRuleMap; |
| 294 | 296 |
| 295 static RenderStyle* s_styleNotYetAvailable; | 297 static RenderStyle* s_styleNotYetAvailable; |
| 296 | 298 |
| 297 void cacheBorderAndBackground(); | 299 void cacheBorderAndBackground(); |
| 298 | 300 |
| 299 MatchedPropertiesCache m_matchedPropertiesCache; | 301 MatchedPropertiesCache m_matchedPropertiesCache; |
| 300 | 302 |
| 301 OwnPtr<MediaQueryEvaluator> m_medium; | 303 OwnPtr<MediaQueryEvaluator> m_medium; |
| 302 WillBePersistentMediaQueryResultList m_viewportDependentMediaQueryResults; | 304 MediaQueryResultList m_viewportDependentMediaQueryResults; |
| 303 | 305 |
| 304 RefPtr<RenderStyle> m_rootDefaultStyle; | 306 RefPtr<RenderStyle> m_rootDefaultStyle; |
| 305 | 307 |
| 306 Document& m_document; | 308 Document& m_document; |
| 307 SelectorFilter m_selectorFilter; | 309 SelectorFilter m_selectorFilter; |
| 308 | 310 |
| 309 RefPtrWillBePersistent<ViewportStyleResolver> m_viewportStyleResolver; | 311 OwnPtrWillBeMember<ViewportStyleResolver> m_viewportStyleResolver; |
| 310 | 312 |
| 311 // FIXME: Oilpan: This should be a WillBePersistentHeapListHashSet. | 313 // FIXME: Oilpan: This should be a WillBeHeapListHashSet. |
| 312 // This is safe for now, but should be updated when we support | 314 // This is safe for now, but should be updated when we support |
| 313 // heap allocated ListHashSets. | 315 // heap allocated ListHashSets. |
| 314 ListHashSet<CSSStyleSheet*, 16> m_pendingStyleSheets; | 316 ListHashSet<CSSStyleSheet*, 16> m_pendingStyleSheets; |
| 315 | 317 |
| 316 ScopedStyleTree m_styleTree; | 318 ScopedStyleTree m_styleTree; |
| 317 | 319 |
| 318 // FIXME: The entire logic of collecting features on StyleResolver, as well
as transferring them | 320 // FIXME: The entire logic of collecting features on StyleResolver, as well
as transferring them |
| 319 // between various parts of machinery smells wrong. This needs to be better
somehow. | 321 // between various parts of machinery smells wrong. This needs to be better
somehow. |
| 320 RuleFeatureSet m_features; | 322 RuleFeatureSet m_features; |
| 321 OwnPtrWillBePersistent<RuleSet> m_siblingRuleSet; | 323 OwnPtrWillBeMember<RuleSet> m_siblingRuleSet; |
| 322 OwnPtrWillBePersistent<RuleSet> m_uncommonAttributeRuleSet; | 324 OwnPtrWillBeMember<RuleSet> m_uncommonAttributeRuleSet; |
| 323 | 325 |
| 324 // FIXME: watched selectors should be implemented using injected author styl
esheets: http://crbug.com/316960 | 326 // FIXME: watched selectors should be implemented using injected author styl
esheets: http://crbug.com/316960 |
| 325 OwnPtrWillBePersistent<RuleSet> m_watchedSelectorsRules; | 327 OwnPtrWillBeMember<RuleSet> m_watchedSelectorsRules; |
| 326 TreeBoundaryCrossingRules m_treeBoundaryCrossingRules; | 328 TreeBoundaryCrossingRules m_treeBoundaryCrossingRules; |
| 327 | 329 |
| 328 bool m_needCollectFeatures; | 330 bool m_needCollectFeatures; |
| 329 | 331 |
| 330 StyleResourceLoader m_styleResourceLoader; | 332 StyleResourceLoader m_styleResourceLoader; |
| 331 | 333 |
| 332 StyleSharingList m_styleSharingList; | 334 StyleSharingList m_styleSharingList; |
| 333 | 335 |
| 334 OwnPtr<StyleResolverStats> m_styleResolverStats; | 336 OwnPtr<StyleResolverStats> m_styleResolverStats; |
| 335 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; | 337 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; |
| 336 unsigned m_styleResolverStatsSequence; | 338 unsigned m_styleResolverStatsSequence; |
| 337 | 339 |
| 338 // Use only for Internals::updateStyleAndReturnAffectedElementCount. | 340 // Use only for Internals::updateStyleAndReturnAffectedElementCount. |
| 339 unsigned m_accessCount; | 341 unsigned m_accessCount; |
| 340 }; | 342 }; |
| 341 | 343 |
| 342 } // namespace WebCore | 344 } // namespace WebCore |
| 343 | 345 |
| 344 #endif // StyleResolver_h | 346 #endif // StyleResolver_h |
| OLD | NEW |