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 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const ContainerNode* scopingNode() const { return m_scopingNode; } | 56 const ContainerNode* scopingNode() const { return m_scopingNode; } |
57 const TreeScope* treeScope() const { return m_scopingNode->treeScope(); } | 57 const TreeScope* treeScope() const { return m_scopingNode->treeScope(); } |
58 void prepareEmptyRuleSet() { m_authorStyle = RuleSet::create(); } | 58 void prepareEmptyRuleSet() { m_authorStyle = RuleSet::create(); } |
59 void setParent(ScopedStyleResolver* newParent) { m_parent = newParent; } | 59 void setParent(ScopedStyleResolver* newParent) { m_parent = newParent; } |
60 ScopedStyleResolver* parent() { return m_parent; } | 60 ScopedStyleResolver* parent() { return m_parent; } |
61 | 61 |
62 bool hasOnlyEmptyRuleSets() const { return !m_authorStyle->ruleCount() && m_
atHostRules.isEmpty(); } | 62 bool hasOnlyEmptyRuleSets() const { return !m_authorStyle->ruleCount() && m_
atHostRules.isEmpty(); } |
63 | 63 |
64 public: | 64 public: |
65 bool checkRegionStyle(Element*); | 65 bool checkRegionStyle(Element*); |
66 const StyleRuleKeyframes* keyframeStylesForAnimation(const AtomicStringImpl*
animationName); | 66 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); |
67 void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>); | 67 void addKeyframeStyle(PassRefPtr<StyleRuleKeyframes>); |
68 | 68 |
69 void matchHostRules(ElementRuleCollector&, bool includeEmptyRules); | 69 void matchHostRules(ElementRuleCollector&, bool includeEmptyRules); |
70 void matchAuthorRules(ElementRuleCollector&, bool includeEmptyRules, bool ap
plyAuthorStyles); | 70 void matchAuthorRules(ElementRuleCollector&, bool includeEmptyRules, bool ap
plyAuthorStyles); |
71 void matchPageRules(PageRuleCollector&); | 71 void matchPageRules(PageRuleCollector&); |
72 void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, Styl
eResolver*); | 72 void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, Styl
eResolver*); |
73 void addHostRule(StyleRuleHost*, bool hasDocumentSecurityOrigin, const Conta
inerNode* scopingNode); | 73 void addHostRule(StyleRuleHost*, bool hasDocumentSecurityOrigin, const Conta
inerNode* scopingNode); |
74 void collectFeaturesTo(RuleFeatureSet&); | 74 void collectFeaturesTo(RuleFeatureSet&); |
75 void resetAuthorStyle(); | 75 void resetAuthorStyle(); |
76 void resetAtHostRules(const ShadowRoot*); | 76 void resetAtHostRules(const ShadowRoot*); |
77 void collectViewportRulesTo(StyleResolver*) const; | 77 void collectViewportRulesTo(StyleResolver*) const; |
78 | 78 |
79 private: | 79 private: |
80 ScopedStyleResolver() : m_scopingNode(0), m_parent(0) { } | 80 ScopedStyleResolver() : m_scopingNode(0), m_parent(0) { } |
81 ScopedStyleResolver(const ContainerNode* scopingNode) : m_scopingNode(scopin
gNode), m_parent(0) { } | 81 ScopedStyleResolver(const ContainerNode* scopingNode) : m_scopingNode(scopin
gNode), m_parent(0) { } |
82 | 82 |
83 RuleSet* ensureAtHostRuleSetFor(const ShadowRoot*); | 83 RuleSet* ensureAtHostRuleSetFor(const ShadowRoot*); |
84 RuleSet* atHostRuleSetFor(const ShadowRoot*) const; | 84 RuleSet* atHostRuleSetFor(const ShadowRoot*) const; |
85 | 85 |
86 const ContainerNode* m_scopingNode; | 86 const ContainerNode* m_scopingNode; |
87 ScopedStyleResolver* m_parent; | 87 ScopedStyleResolver* m_parent; |
88 | 88 |
89 OwnPtr<RuleSet> m_authorStyle; | 89 OwnPtr<RuleSet> m_authorStyle; |
90 HashMap<const ShadowRoot*, OwnPtr<RuleSet> > m_atHostRules; | 90 HashMap<const ShadowRoot*, OwnPtr<RuleSet> > m_atHostRules; |
91 | 91 |
92 typedef HashMap<const AtomicStringImpl*, RefPtr<StyleRuleKeyframes> > Keyfra
mesRuleMap; | 92 typedef HashMap<const StringImpl*, RefPtr<StyleRuleKeyframes> > KeyframesRul
eMap; |
93 KeyframesRuleMap m_keyframesRuleMap; | 93 KeyframesRuleMap m_keyframesRuleMap; |
94 }; | 94 }; |
95 | 95 |
96 class ScopedStyleTree { | 96 class ScopedStyleTree { |
97 WTF_MAKE_NONCOPYABLE(ScopedStyleTree); WTF_MAKE_FAST_ALLOCATED; | 97 WTF_MAKE_NONCOPYABLE(ScopedStyleTree); WTF_MAKE_FAST_ALLOCATED; |
98 public: | 98 public: |
99 ScopedStyleTree() : m_scopedResolverForDocument(0), m_buildInDocumentOrder(t
rue) { } | 99 ScopedStyleTree() : m_scopedResolverForDocument(0), m_buildInDocumentOrder(t
rue) { } |
100 | 100 |
101 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scopingN
ode); | 101 ScopedStyleResolver* ensureScopedStyleResolver(const ContainerNode* scopingN
ode); |
102 ScopedStyleResolver* scopedStyleResolverFor(const ContainerNode* scopingNode
); | 102 ScopedStyleResolver* scopedStyleResolverFor(const ContainerNode* scopingNode
); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 { | 151 { |
152 if (!cacheIsValid(element)) | 152 if (!cacheIsValid(element)) |
153 resolveStyleCache(element); | 153 resolveStyleCache(element); |
154 | 154 |
155 return m_cache.scopedResolver; | 155 return m_cache.scopedResolver; |
156 } | 156 } |
157 | 157 |
158 } // namespace WebCore | 158 } // namespace WebCore |
159 | 159 |
160 #endif // ScopedStyleResolver_h | 160 #endif // ScopedStyleResolver_h |
OLD | NEW |