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" |
26 #include "core/css/PseudoStyleRequest.h" | 27 #include "core/css/PseudoStyleRequest.h" |
27 #include "core/css/RuleFeature.h" | 28 #include "core/css/RuleFeature.h" |
28 #include "core/css/RuleSet.h" | 29 #include "core/css/RuleSet.h" |
29 #include "core/css/SelectorChecker.h" | 30 #include "core/css/SelectorChecker.h" |
30 #include "core/css/SelectorFilter.h" | 31 #include "core/css/SelectorFilter.h" |
31 #include "core/css/SiblingTraversalStrategies.h" | 32 #include "core/css/SiblingTraversalStrategies.h" |
32 #include "core/css/TreeBoundaryCrossingRules.h" | 33 #include "core/css/TreeBoundaryCrossingRules.h" |
33 #include "core/css/resolver/MatchedPropertiesCache.h" | 34 #include "core/css/resolver/MatchedPropertiesCache.h" |
34 #include "core/css/resolver/ScopedStyleResolver.h" | 35 #include "core/css/resolver/ScopedStyleResolver.h" |
35 #include "core/css/resolver/ScopedStyleTree.h" | 36 #include "core/css/resolver/ScopedStyleTree.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 struct CSSPropertyValue { | 94 struct CSSPropertyValue { |
94 CSSPropertyValue(CSSPropertyID property, CSSValue* value) | 95 CSSPropertyValue(CSSPropertyID property, CSSValue* value) |
95 : property(property), value(value) { } | 96 : property(property), value(value) { } |
96 // Stores value=propertySet.getPropertyCSSValue(id).get(). | 97 // Stores value=propertySet.getPropertyCSSValue(id).get(). |
97 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); | 98 CSSPropertyValue(CSSPropertyID, const StylePropertySet&); |
98 CSSPropertyID property; | 99 CSSPropertyID property; |
99 CSSValue* value; | 100 CSSValue* value; |
100 }; | 101 }; |
101 | 102 |
102 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 103 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
103 class StyleResolver FINAL : public FontSelectorClient { | 104 class StyleResolver FINAL : public CSSFontSelectorClient { |
104 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; | 105 WTF_MAKE_NONCOPYABLE(StyleResolver); WTF_MAKE_FAST_ALLOCATED; |
105 public: | 106 public: |
106 explicit StyleResolver(Document&); | 107 explicit StyleResolver(Document&); |
107 virtual ~StyleResolver(); | 108 virtual ~StyleResolver(); |
108 | 109 |
109 // FIXME: StyleResolver should not be keeping tree-walk state. | 110 // 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 | 111 // 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. | 112 // 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. | 113 // Using these during tree walk will allow style selector to optimize child
and descendant selector lookups. |
113 void pushParentElement(Element&); | 114 void pushParentElement(Element&); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void enableStats(StatsReportType = ReportDefaultStats); | 223 void enableStats(StatsReportType = ReportDefaultStats); |
223 void disableStats(); | 224 void disableStats(); |
224 void printStats(); | 225 void printStats(); |
225 | 226 |
226 unsigned accessCount() const { return m_accessCount; } | 227 unsigned accessCount() const { return m_accessCount; } |
227 void didAccess() { ++m_accessCount; } | 228 void didAccess() { ++m_accessCount; } |
228 | 229 |
229 PassRefPtr<PseudoElement> createPseudoElementIfNeeded(Element&, PseudoId); | 230 PassRefPtr<PseudoElement> createPseudoElementIfNeeded(Element&, PseudoId); |
230 | 231 |
231 private: | 232 private: |
232 // FontSelectorClient implementation. | 233 // CSSFontSelectorClient implementation. |
233 virtual void fontsNeedUpdate(FontSelector*) OVERRIDE; | 234 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; |
234 | 235 |
235 private: | 236 private: |
236 void initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& watchedSelec
tors); | 237 void initWatchedSelectorRules(const Vector<RefPtr<StyleRule> >& watchedSelec
tors); |
237 | 238 |
238 void addTreeBoundaryCrossingRules(const Vector<MinimalRuleData>&, ContainerN
ode* scope); | 239 void addTreeBoundaryCrossingRules(const Vector<MinimalRuleData>&, ContainerN
ode* scope); |
239 | 240 |
240 // FIXME: This should probably go away, folded into FontBuilder. | 241 // FIXME: This should probably go away, folded into FontBuilder. |
241 void updateFont(StyleResolverState&); | 242 void updateFont(StyleResolverState&); |
242 | 243 |
243 void appendCSSStyleSheet(CSSStyleSheet*); | 244 void appendCSSStyleSheet(CSSStyleSheet*); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 SelectorChecker::SelectorCheckingContext selectorCheckingContext(s, regi
onElement, SelectorChecker::VisitedMatchDisabled); | 343 SelectorChecker::SelectorCheckingContext selectorCheckingContext(s, regi
onElement, SelectorChecker::VisitedMatchDisabled); |
343 if (selectorChecker.match(selectorCheckingContext, DOMSiblingTraversalSt
rategy()) == SelectorChecker::SelectorMatches) | 344 if (selectorChecker.match(selectorCheckingContext, DOMSiblingTraversalSt
rategy()) == SelectorChecker::SelectorMatches) |
344 return true; | 345 return true; |
345 } | 346 } |
346 return false; | 347 return false; |
347 } | 348 } |
348 | 349 |
349 } // namespace WebCore | 350 } // namespace WebCore |
350 | 351 |
351 #endif // StyleResolver_h | 352 #endif // StyleResolver_h |
OLD | NEW |