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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 * | 19 * |
20 */ | 20 */ |
21 | 21 |
22 #ifndef StyleResolver_h | 22 #ifndef StyleResolver_h |
23 #define StyleResolver_h | 23 #define StyleResolver_h |
24 | 24 |
25 #include "core/animation/KeyframeEffectModel.h" | 25 #include "core/animation/KeyframeEffectModel.h" |
26 #include "core/css/CSSFontSelectorClient.h" | |
27 #include "core/css/PseudoStyleRequest.h" | 26 #include "core/css/PseudoStyleRequest.h" |
28 #include "core/css/RuleFeature.h" | 27 #include "core/css/RuleFeature.h" |
29 #include "core/css/RuleSet.h" | 28 #include "core/css/RuleSet.h" |
30 #include "core/css/SelectorChecker.h" | 29 #include "core/css/SelectorChecker.h" |
31 #include "core/css/SelectorFilter.h" | 30 #include "core/css/SelectorFilter.h" |
32 #include "core/css/SiblingTraversalStrategies.h" | 31 #include "core/css/SiblingTraversalStrategies.h" |
33 #include "core/css/TreeBoundaryCrossingRules.h" | 32 #include "core/css/TreeBoundaryCrossingRules.h" |
34 #include "core/css/resolver/MatchedPropertiesCache.h" | 33 #include "core/css/resolver/MatchedPropertiesCache.h" |
35 #include "core/css/resolver/ScopedStyleResolver.h" | 34 #include "core/css/resolver/ScopedStyleResolver.h" |
36 #include "core/css/resolver/ScopedStyleTree.h" | 35 #include "core/css/resolver/ScopedStyleTree.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 public: | 92 public: |
94 CSSPropertyValue(CSSPropertyID property, CSSValue* value) | 93 CSSPropertyValue(CSSPropertyID property, CSSValue* value) |
95 : property(property), value(value) { } | 94 : property(property), value(value) { } |
96 // Stores value=propertySet.getPropertyCSSValue(id).get(). | 95 // Stores value=propertySet.getPropertyCSSValue(id).get(). |
97 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); | 96 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); |
98 CSSPropertyID property; | 97 CSSPropertyID property; |
99 RawPtrWillBeMember<CSSValue> value; | 98 RawPtrWillBeMember<CSSValue> value; |
100 }; | 99 }; |
101 | 100 |
102 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 101 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
103 class StyleResolver FINAL : public CSSFontSelectorClient { | 102 class StyleResolver FINAL : public NoBaseWillBeGarbageCollectedFinalized<StyleRe
solver> { |
104 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED
; | 103 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED
; |
105 public: | 104 public: |
106 explicit StyleResolver(Document&); | 105 explicit StyleResolver(Document&); |
107 virtual ~StyleResolver(); | 106 virtual ~StyleResolver(); |
108 | 107 |
109 // FIXME: StyleResolver should not be keeping tree-walk state. | 108 // FIXME: StyleResolver should not be keeping tree-walk state. |
110 // These should move to some global tree-walk state, or should be contained
in a | 109 // These should move to some global tree-walk state, or should be contained
in a |
111 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. | 110 // TreeWalkContext or similar which is passed in to StyleResolver methods wh
en available. |
112 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. | 111 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
113 void pushParentElement(Element&); | 112 void pushParentElement(Element&); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 void printStats(); | 222 void printStats(); |
224 | 223 |
225 unsigned accessCount() const { return m_accessCount; } | 224 unsigned accessCount() const { return m_accessCount; } |
226 void didAccess() { ++m_accessCount; } | 225 void didAccess() { ++m_accessCount; } |
227 | 226 |
228 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } | 227 void increaseStyleSharingDepth() { ++m_styleSharingDepth; } |
229 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } | 228 void decreaseStyleSharingDepth() { --m_styleSharingDepth; } |
230 | 229 |
231 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p
arent, PseudoId); | 230 PassRefPtrWillBeRawPtr<PseudoElement> createPseudoElementIfNeeded(Element& p
arent, PseudoId); |
232 | 231 |
233 virtual void trace(Visitor*) OVERRIDE; | 232 void trace(Visitor*); |
234 | |
235 private: | |
236 // CSSFontSelectorClient implementation. | |
237 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; | |
238 | 233 |
239 private: | 234 private: |
240 void initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBeMember<Styl
eRule> >& watchedSelectors); | 235 void initWatchedSelectorRules(const WillBeHeapVector<RefPtrWillBeMember<Styl
eRule> >& watchedSelectors); |
241 | 236 |
242 // FIXME: This should probably go away, folded into FontBuilder. | 237 // FIXME: This should probably go away, folded into FontBuilder. |
243 void updateFont(StyleResolverState&); | 238 void updateFont(StyleResolverState&); |
244 | 239 |
245 void loadPendingResources(StyleResolverState&); | 240 void loadPendingResources(StyleResolverState&); |
246 void adjustRenderStyle(StyleResolverState&, Element*); | 241 void adjustRenderStyle(StyleResolverState&, Element*); |
247 | 242 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; | 326 OwnPtr<StyleResolverStats> m_styleResolverStatsTotals; |
332 unsigned m_styleResolverStatsSequence; | 327 unsigned m_styleResolverStatsSequence; |
333 | 328 |
334 // Use only for Internals::updateStyleAndReturnAffectedElementCount. | 329 // Use only for Internals::updateStyleAndReturnAffectedElementCount. |
335 unsigned m_accessCount; | 330 unsigned m_accessCount; |
336 }; | 331 }; |
337 | 332 |
338 } // namespace WebCore | 333 } // namespace WebCore |
339 | 334 |
340 #endif // StyleResolver_h | 335 #endif // StyleResolver_h |
OLD | NEW |