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 10 matching lines...) Expand all Loading... |
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
25 * DAMAGE. | 25 * DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #ifndef ScopedStyleResolver_h | 28 #ifndef ScopedStyleResolver_h |
29 #define ScopedStyleResolver_h | 29 #define ScopedStyleResolver_h |
30 | 30 |
| 31 #include "core/css/ActiveStyleSheets.h" |
31 #include "core/css/ElementRuleCollector.h" | 32 #include "core/css/ElementRuleCollector.h" |
32 #include "core/css/RuleSet.h" | 33 #include "core/css/RuleSet.h" |
33 #include "core/dom/TreeScope.h" | 34 #include "core/dom/TreeScope.h" |
34 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
35 #include "wtf/HashSet.h" | 36 #include "wtf/HashSet.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class PageRuleCollector; | 40 class PageRuleCollector; |
40 class StyleSheetContents; | 41 class StyleSheetContents; |
41 class ViewportStyleResolver; | 42 class ViewportStyleResolver; |
42 | 43 |
43 // This class selects a ComputedStyle for a given element based on a collection
of stylesheets. | 44 // This class selects a ComputedStyle for a given element based on a collection
of stylesheets. |
44 class ScopedStyleResolver final : public GarbageCollected<ScopedStyleResolver> { | 45 class ScopedStyleResolver final : public GarbageCollected<ScopedStyleResolver> { |
45 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
46 | 47 |
47 public: | 48 public: |
48 static ScopedStyleResolver* create(TreeScope& scope) { | 49 static ScopedStyleResolver* create(TreeScope& scope) { |
49 return new ScopedStyleResolver(scope); | 50 return new ScopedStyleResolver(scope); |
50 } | 51 } |
51 | 52 |
52 const TreeScope& treeScope() const { return *m_scope; } | 53 const TreeScope& treeScope() const { return *m_scope; } |
53 ScopedStyleResolver* parent() const; | 54 ScopedStyleResolver* parent() const; |
54 | 55 |
55 StyleRuleKeyframes* keyframeStylesForAnimation( | 56 StyleRuleKeyframes* keyframeStylesForAnimation( |
56 const StringImpl* animationName); | 57 const StringImpl* animationName); |
57 | 58 |
58 void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); | 59 void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); |
| 60 void appendActiveStyleSheets(unsigned index, const ActiveStyleSheetVector&); |
59 void collectMatchingAuthorRules(ElementRuleCollector&, | 61 void collectMatchingAuthorRules(ElementRuleCollector&, |
60 CascadeOrder = ignoreCascadeOrder); | 62 CascadeOrder = ignoreCascadeOrder); |
61 void collectMatchingShadowHostRules(ElementRuleCollector&, | 63 void collectMatchingShadowHostRules(ElementRuleCollector&, |
62 CascadeOrder = ignoreCascadeOrder); | 64 CascadeOrder = ignoreCascadeOrder); |
63 void collectMatchingTreeBoundaryCrossingRules( | 65 void collectMatchingTreeBoundaryCrossingRules( |
64 ElementRuleCollector&, | 66 ElementRuleCollector&, |
65 CascadeOrder = ignoreCascadeOrder); | 67 CascadeOrder = ignoreCascadeOrder); |
66 void matchPageRules(PageRuleCollector&); | 68 void matchPageRules(PageRuleCollector&); |
67 void collectFeaturesTo(RuleFeatureSet&, | 69 void collectFeaturesTo(RuleFeatureSet&, |
68 HeapHashSet<Member<const StyleSheetContents>>& | 70 HeapHashSet<Member<const StyleSheetContents>>& |
69 visitedSharedStyleSheetContents) const; | 71 visitedSharedStyleSheetContents) const; |
70 void resetAuthorStyle(); | 72 void resetAuthorStyle(); |
71 void collectViewportRulesTo(ViewportStyleResolver*) const; | 73 void collectViewportRulesTo(ViewportStyleResolver*) const; |
72 bool hasDeepOrShadowSelector() const { return m_hasDeepOrShadowSelector; } | 74 bool hasDeepOrShadowSelector() const { return m_hasDeepOrShadowSelector; } |
73 void setHasUnresolvedKeyframesRule() { m_hasUnresolvedKeyframesRule = true; } | 75 void setHasUnresolvedKeyframesRule() { m_hasUnresolvedKeyframesRule = true; } |
74 static void keyframesRulesAdded(const TreeScope&); | 76 static void keyframesRulesAdded(const TreeScope&); |
| 77 static ContainerNode& invalidationRootForTreeScope(const TreeScope&); |
75 | 78 |
76 DECLARE_TRACE(); | 79 DECLARE_TRACE(); |
77 | 80 |
78 private: | 81 private: |
79 explicit ScopedStyleResolver(TreeScope& scope) : m_scope(scope) {} | 82 explicit ScopedStyleResolver(TreeScope& scope) : m_scope(scope) {} |
80 | 83 |
81 void addTreeBoundaryCrossingRules(const RuleSet&, | 84 void addTreeBoundaryCrossingRules(const RuleSet&, |
82 CSSStyleSheet*, | 85 CSSStyleSheet*, |
83 unsigned sheetIndex); | 86 unsigned sheetIndex); |
84 void addKeyframeRules(const RuleSet&); | 87 void addKeyframeRules(const RuleSet&); |
(...skipping 29 matching lines...) Expand all Loading... |
114 using CSSStyleSheetRuleSubSet = HeapVector<Member<RuleSubSet>>; | 117 using CSSStyleSheetRuleSubSet = HeapVector<Member<RuleSubSet>>; |
115 | 118 |
116 Member<CSSStyleSheetRuleSubSet> m_treeBoundaryCrossingRuleSet; | 119 Member<CSSStyleSheetRuleSubSet> m_treeBoundaryCrossingRuleSet; |
117 bool m_hasDeepOrShadowSelector = false; | 120 bool m_hasDeepOrShadowSelector = false; |
118 bool m_hasUnresolvedKeyframesRule = false; | 121 bool m_hasUnresolvedKeyframesRule = false; |
119 }; | 122 }; |
120 | 123 |
121 } // namespace blink | 124 } // namespace blink |
122 | 125 |
123 #endif // ScopedStyleResolver_h | 126 #endif // ScopedStyleResolver_h |
OLD | NEW |