| 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 GarbageCollected<ScopedStyleResolver> { |
| 46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); | 46 WTF_MAKE_NONCOPYABLE(ScopedStyleResolver); |
| 47 USING_FAST_MALLOC_WILL_BE_REMOVED(ScopedStyleResolver); | |
| 48 public: | 47 public: |
| 49 static PassOwnPtrWillBeRawPtr<ScopedStyleResolver> create(TreeScope& scope) | 48 static RawPtr<ScopedStyleResolver> create(TreeScope& scope) |
| 50 { | 49 { |
| 51 return adoptPtrWillBeNoop(new ScopedStyleResolver(scope)); | 50 return new ScopedStyleResolver(scope); |
| 52 } | 51 } |
| 53 | 52 |
| 54 const TreeScope& treeScope() const { return *m_scope; } | 53 const TreeScope& treeScope() const { return *m_scope; } |
| 55 ScopedStyleResolver* parent() const; | 54 ScopedStyleResolver* parent() const; |
| 56 | 55 |
| 57 StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* animationNa
me); | 56 StyleRuleKeyframes* keyframeStylesForAnimation(const StringImpl* animationNa
me); |
| 58 | 57 |
| 59 void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); | 58 void appendCSSStyleSheet(CSSStyleSheet&, const MediaQueryEvaluator&); |
| 60 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore
CascadeOrder); | 59 void collectMatchingAuthorRules(ElementRuleCollector&, CascadeOrder = ignore
CascadeOrder); |
| 61 void collectMatchingShadowHostRules(ElementRuleCollector&, CascadeOrder = ig
noreCascadeOrder); | 60 void collectMatchingShadowHostRules(ElementRuleCollector&, CascadeOrder = ig
noreCascadeOrder); |
| 62 void collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector&, Cascade
Order = ignoreCascadeOrder); | 61 void collectMatchingTreeBoundaryCrossingRules(ElementRuleCollector&, Cascade
Order = ignoreCascadeOrder); |
| 63 void matchPageRules(PageRuleCollector&); | 62 void matchPageRules(PageRuleCollector&); |
| 64 void collectFeaturesTo(RuleFeatureSet&, WillBeHeapHashSet<RawPtrWillBeMember
<const StyleSheetContents>>& visitedSharedStyleSheetContents) const; | 63 void collectFeaturesTo(RuleFeatureSet&, HeapHashSet<Member<const StyleSheetC
ontents>>& visitedSharedStyleSheetContents) const; |
| 65 void resetAuthorStyle(); | 64 void resetAuthorStyle(); |
| 66 void collectViewportRulesTo(ViewportStyleResolver*) const; | 65 void collectViewportRulesTo(ViewportStyleResolver*) const; |
| 67 bool hasDeepOrShadowSelector() const { return m_hasDeepOrShadowSelector; } | 66 bool hasDeepOrShadowSelector() const { return m_hasDeepOrShadowSelector; } |
| 68 | 67 |
| 69 DECLARE_TRACE(); | 68 DECLARE_TRACE(); |
| 70 | 69 |
| 71 private: | 70 private: |
| 72 explicit ScopedStyleResolver(TreeScope& scope) | 71 explicit ScopedStyleResolver(TreeScope& scope) |
| 73 : m_scope(scope) | 72 : m_scope(scope) |
| 74 { | 73 { |
| 75 } | 74 } |
| 76 | 75 |
| 77 void addTreeBoundaryCrossingRules(const RuleSet&, CSSStyleSheet*, unsigned s
heetIndex); | 76 void addTreeBoundaryCrossingRules(const RuleSet&, CSSStyleSheet*, unsigned s
heetIndex); |
| 78 void addKeyframeRules(const RuleSet&); | 77 void addKeyframeRules(const RuleSet&); |
| 79 void addFontFaceRules(const RuleSet&); | 78 void addFontFaceRules(const RuleSet&); |
| 80 void addKeyframeStyle(PassRefPtrWillBeRawPtr<StyleRuleKeyframes>); | 79 void addKeyframeStyle(RawPtr<StyleRuleKeyframes>); |
| 81 | 80 |
| 82 RawPtrWillBeMember<TreeScope> m_scope; | 81 Member<TreeScope> m_scope; |
| 83 | 82 |
| 84 WillBeHeapVector<RawPtrWillBeMember<CSSStyleSheet>> m_authorStyleSheets; | 83 HeapVector<Member<CSSStyleSheet>> m_authorStyleSheets; |
| 85 | 84 |
| 86 using KeyframesRuleMap = WillBeHeapHashMap<const StringImpl*, RefPtrWillBeMe
mber<StyleRuleKeyframes>>; | 85 using KeyframesRuleMap = HeapHashMap<const StringImpl*, Member<StyleRuleKeyf
rames>>; |
| 87 KeyframesRuleMap m_keyframesRuleMap; | 86 KeyframesRuleMap m_keyframesRuleMap; |
| 88 | 87 |
| 89 class RuleSubSet final : public NoBaseWillBeGarbageCollected<RuleSubSet> { | 88 class RuleSubSet final : public GarbageCollected<RuleSubSet> { |
| 90 public: | 89 public: |
| 91 static PassOwnPtrWillBeRawPtr<RuleSubSet> create(CSSStyleSheet* sheet, u
nsigned index, PassOwnPtrWillBeRawPtr<RuleSet> rules) | 90 static RawPtr<RuleSubSet> create(CSSStyleSheet* sheet, unsigned index, R
awPtr<RuleSet> rules) |
| 92 { | 91 { |
| 93 return adoptPtrWillBeNoop(new RuleSubSet(sheet, index, rules)); | 92 return new RuleSubSet(sheet, index, rules); |
| 94 } | 93 } |
| 95 | 94 |
| 96 RawPtrWillBeMember<CSSStyleSheet> m_parentStyleSheet; | 95 Member<CSSStyleSheet> m_parentStyleSheet; |
| 97 unsigned m_parentIndex; | 96 unsigned m_parentIndex; |
| 98 OwnPtrWillBeMember<RuleSet> m_ruleSet; | 97 Member<RuleSet> m_ruleSet; |
| 99 | 98 |
| 100 DECLARE_TRACE(); | 99 DECLARE_TRACE(); |
| 101 | 100 |
| 102 private: | 101 private: |
| 103 RuleSubSet(CSSStyleSheet* sheet, unsigned index, PassOwnPtrWillBeRawPtr<
RuleSet> rules) | 102 RuleSubSet(CSSStyleSheet* sheet, unsigned index, RawPtr<RuleSet> rules) |
| 104 : m_parentStyleSheet(sheet) | 103 : m_parentStyleSheet(sheet) |
| 105 , m_parentIndex(index) | 104 , m_parentIndex(index) |
| 106 , m_ruleSet(rules) | 105 , m_ruleSet(rules) |
| 107 { | 106 { |
| 108 } | 107 } |
| 109 }; | 108 }; |
| 110 using CSSStyleSheetRuleSubSet = WillBeHeapVector<OwnPtrWillBeMember<RuleSubS
et>>; | 109 using CSSStyleSheetRuleSubSet = HeapVector<Member<RuleSubSet>>; |
| 111 | 110 |
| 112 OwnPtrWillBeMember<CSSStyleSheetRuleSubSet> m_treeBoundaryCrossingRuleSet; | 111 Member<CSSStyleSheetRuleSubSet> m_treeBoundaryCrossingRuleSet; |
| 113 bool m_hasDeepOrShadowSelector = false; | 112 bool m_hasDeepOrShadowSelector = false; |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 } // namespace blink | 115 } // namespace blink |
| 117 | 116 |
| 118 #endif // ScopedStyleResolver_h | 117 #endif // ScopedStyleResolver_h |
| OLD | NEW |