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 24 matching lines...) Expand all Loading... |
35 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
36 #include "wtf/PassOwnPtr.h" | 36 #include "wtf/PassOwnPtr.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class PageRuleCollector; | 40 class PageRuleCollector; |
41 class StyleSheetContents; | 41 class StyleSheetContents; |
42 class ViewportStyleResolver; | 42 class ViewportStyleResolver; |
43 | 43 |
44 // 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. |
45 class ScopedStyleResolver final : public NoBaseWillBeGarbageCollected<ScopedStyl
eResolver> { | 45 class ScopedStyleResolver final : public NoBaseWillBeGarbageCollectedFinalized<S
copedStyleResolver> { |
46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
47 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(ScopedStyleResolver); | 47 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(ScopedStyleResolver); |
48 public: | 48 public: |
| 49 ~ScopedStyleResolver(); |
| 50 |
49 static PassOwnPtrWillBeRawPtr<ScopedStyleResolver> create(TreeScope& scope) | 51 static PassOwnPtrWillBeRawPtr<ScopedStyleResolver> create(TreeScope& scope) |
50 { | 52 { |
51 return adoptPtrWillBeNoop(new ScopedStyleResolver(scope)); | 53 return adoptPtrWillBeNoop(new ScopedStyleResolver(scope)); |
52 } | 54 } |
53 | 55 |
54 static TreeScope* treeScopeFor(Document&, const CSSStyleSheet*); | 56 static TreeScope* treeScopeFor(Document&, const CSSStyleSheet*); |
55 | 57 |
56 const TreeScope& treeScope() const { return *m_scope; } | 58 const TreeScope& treeScope() const { return *m_scope; } |
57 ScopedStyleResolver* parent() const; | 59 ScopedStyleResolver* parent() const; |
58 | 60 |
59 StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* animationNa
me); | 61 StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* animationNa
me); |
60 | 62 |
61 void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); | 63 void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); |
62 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, CascadeOrder = ignoreCascadeOrder); | 64 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s); |
63 void collectMatchingShadowHostRules(ElementRuleCollector&, bool includeEmpty
Rules, CascadeOrder = ignoreCascadeOrder); | 65 void collectMatchingShadowHostRules(ElementRuleCollector&, bool includeEmpty
Rules); |
64 void collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector&, bool in
cludeEmptyRules, CascadeOrder); | 66 void collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector&, bool in
cludeEmptyRules); |
65 void matchPageRules(PageRuleCollector&); | 67 void matchPageRules(PageRuleCollector&); |
66 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents) const; | 68 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents) const; |
67 void resetAuthorStyle(); | 69 void resetAuthorStyle(); |
68 void collectViewportRulesTo(ViewportStyleResolver*) const; | 70 void collectViewportRulesTo(ViewportStyleResolver*) const; |
69 | 71 |
| 72 bool hasTreeBoundaryCrossingRules() const { return m_treeBoundaryCrossingRul
eSet; } |
| 73 |
70 DECLARE_TRACE(); | 74 DECLARE_TRACE(); |
71 | 75 |
72 private: | 76 private: |
73 explicit ScopedStyleResolver(TreeScope& scope) | 77 explicit ScopedStyleResolver(TreeScope& scope) |
74 : m_scope(scope) | 78 : m_scope(scope) |
75 { | 79 { |
76 } | 80 } |
77 | 81 |
78 void addTreeBoundaryCrossingRules(const RuleSet&, CSSStyleSheet*, unsigned s
heetIndex); | 82 void addTreeBoundaryCrossingRules(const RuleSet&, CSSStyleSheet*, unsigned s
heetIndex); |
79 void addKeyframeRules(const RuleSet&); | 83 void addKeyframeRules(const RuleSet&); |
(...skipping 29 matching lines...) Expand all Loading... |
109 } | 113 } |
110 }; | 114 }; |
111 typedef WillBeHeapVector<OwnPtrWillBeMember<RuleSubSet>> CSSStyleSheetRuleSu
bSet; | 115 typedef WillBeHeapVector<OwnPtrWillBeMember<RuleSubSet>> CSSStyleSheetRuleSu
bSet; |
112 | 116 |
113 OwnPtrWillBeMember<CSSStyleSheetRuleSubSet> m_treeBoundaryCrossingRuleSet; | 117 OwnPtrWillBeMember<CSSStyleSheetRuleSubSet> m_treeBoundaryCrossingRuleSet; |
114 }; | 118 }; |
115 | 119 |
116 } // namespace blink | 120 } // namespace blink |
117 | 121 |
118 #endif // ScopedStyleResolver_h | 122 #endif // ScopedStyleResolver_h |
OLD | NEW |