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 26 matching lines...) Expand all Loading... |
37 #include "wtf/PassOwnPtr.h" | 37 #include "wtf/PassOwnPtr.h" |
38 | 38 |
39 namespace blink { | 39 namespace blink { |
40 | 40 |
41 class MediaQueryEvaluator; | 41 class MediaQueryEvaluator; |
42 class PageRuleCollector; | 42 class PageRuleCollector; |
43 class StyleResolver; | 43 class StyleResolver; |
44 class StyleSheetContents; | 44 class StyleSheetContents; |
45 | 45 |
46 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. | 46 // This class selects a RenderStyle for a given element based on a collection of
stylesheets. |
47 class ScopedStyleResolver { | 47 class ScopedStyleResolver FINAL : public NoBaseWillBeGarbageCollected<ScopedStyl
eResolver> { |
48 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); WTF_MAKE_FAST_ALLOCATED; | 48 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
| 49 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
49 public: | 50 public: |
50 static PassOwnPtr<ScopedStyleResolver> create(TreeScope& scope) | 51 static PassOwnPtrWillBeRawPtr<ScopedStyleResolver> create(TreeScope& scope) |
51 { | 52 { |
52 return adoptPtr(new ScopedStyleResolver(scope)); | 53 return adoptPtrWillBeNoop(new ScopedStyleResolver(scope)); |
53 } | 54 } |
54 | 55 |
55 static ContainerNode* scopingNodeFor(Document&, const CSSStyleSheet*); | 56 static ContainerNode* scopingNodeFor(Document&, const CSSStyleSheet*); |
56 | 57 |
57 const ContainerNode& scopingNode() const { return m_scope.rootNode(); } | 58 const ContainerNode& scopingNode() const { return m_scope->rootNode(); } |
58 const TreeScope& treeScope() const { return m_scope; } | 59 const TreeScope& treeScope() const { return *m_scope; } |
59 ScopedStyleResolver* parent() const; | 60 ScopedStyleResolver* parent() const; |
60 | 61 |
61 public: | 62 public: |
62 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); | 63 const StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* anima
tionName); |
63 void addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyframes>); | 64 void addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyframes>); |
64 | 65 |
65 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, bool applyAuthorStyles, CascadeScope, CascadeOrder = ignoreCascadeOrder); | 66 void collectMatchingAuthorRules(ElementRuleCollector&, bool includeEmptyRule
s, bool applyAuthorStyles, CascadeScope, CascadeOrder = ignoreCascadeOrder); |
66 void matchPageRules(PageRuleCollector&); | 67 void matchPageRules(PageRuleCollector&); |
67 void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, StyleReso
lver*); | 68 void addRulesFromSheet(CSSStyleSheet*, const MediaQueryEvaluator&, StyleReso
lver*); |
68 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents); | 69 void collectFeaturesTo(RuleFeatureSet&, HashSet<const StyleSheetContents*>&
visitedSharedStyleSheetContents); |
69 void resetAuthorStyle(); | 70 void resetAuthorStyle(); |
70 void collectViewportRulesTo(StyleResolver*) const; | 71 void collectViewportRulesTo(StyleResolver*) const; |
71 | 72 |
| 73 void trace(Visitor*); |
| 74 |
72 private: | 75 private: |
73 explicit ScopedStyleResolver(TreeScope& scope) | 76 explicit ScopedStyleResolver(TreeScope& scope) |
74 : m_scope(scope) | 77 : m_scope(scope) |
75 { | 78 { |
76 } | 79 } |
77 | 80 |
78 TreeScope& m_scope; | 81 RawPtrWillBeMember<TreeScope> m_scope; |
79 | 82 |
80 WillBePersistentHeapVector<RawPtrWillBeMember<CSSStyleSheet> > m_authorStyle
Sheets; | 83 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet> > m_authorStyleSheets; |
81 | 84 |
82 typedef WillBePersistentHeapHashMap<const StringImpl*, RefPtrWillBeMember<St
yleRuleKeyframes> > KeyframesRuleMap; | 85 typedef WillBeHeapHashMap<const StringImpl*, RefPtrWillBeMember<StyleRuleKey
frames> > KeyframesRuleMap; |
83 KeyframesRuleMap m_keyframesRuleMap; | 86 KeyframesRuleMap m_keyframesRuleMap; |
84 }; | 87 }; |
85 | 88 |
86 } // namespace blink | 89 } // namespace blink |
87 | 90 |
88 #endif // ScopedStyleResolver_h | 91 #endif // ScopedStyleResolver_h |
OLD | NEW |