| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) | 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2002, 2006, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2002, 2006, 2012 Apple Computer, Inc. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #if !ENABLE(OILPAN) | 43 #if !ENABLE(OILPAN) |
| 44 virtual void ref() = 0; | 44 virtual void ref() = 0; |
| 45 virtual void deref() = 0; | 45 virtual void deref() = 0; |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 virtual unsigned length() const = 0; | 48 virtual unsigned length() const = 0; |
| 49 virtual CSSRule* item(unsigned index) const = 0; | 49 virtual CSSRule* item(unsigned index) const = 0; |
| 50 | 50 |
| 51 virtual CSSStyleSheet* styleSheet() const = 0; | 51 virtual CSSStyleSheet* styleSheet() const = 0; |
| 52 | 52 |
| 53 virtual void trace(Visitor*) { } | |
| 54 | |
| 55 protected: | 53 protected: |
| 56 CSSRuleList(); | 54 CSSRuleList(); |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 class StaticCSSRuleList final : public CSSRuleList { | 57 class StaticCSSRuleList final : public CSSRuleList { |
| 60 public: | 58 public: |
| 61 static PassRefPtr<StaticCSSRuleList> create() | 59 static PassRefPtr<StaticCSSRuleList> create() |
| 62 { | 60 { |
| 63 return adoptRef(new StaticCSSRuleList()); | 61 return adoptRef(new StaticCSSRuleList()); |
| 64 } | 62 } |
| 65 | 63 |
| 66 #if !ENABLE(OILPAN) | 64 #if !ENABLE(OILPAN) |
| 67 virtual void ref() override { ++m_refCount; } | 65 virtual void ref() override { ++m_refCount; } |
| 68 virtual void deref() override; | 66 virtual void deref() override; |
| 69 #endif | 67 #endif |
| 70 | 68 |
| 71 Vector<RefPtr<CSSRule> >& rules() { return m_rules; } | 69 Vector<RefPtr<CSSRule> >& rules() { return m_rules; } |
| 72 | 70 |
| 73 virtual CSSStyleSheet* styleSheet() const override { return 0; } | 71 virtual CSSStyleSheet* styleSheet() const override { return 0; } |
| 74 | 72 |
| 75 virtual void trace(Visitor*) override; | |
| 76 | |
| 77 private: | 73 private: |
| 78 StaticCSSRuleList(); | 74 StaticCSSRuleList(); |
| 79 virtual ~StaticCSSRuleList(); | 75 virtual ~StaticCSSRuleList(); |
| 80 | 76 |
| 81 virtual unsigned length() const override { return m_rules.size(); } | 77 virtual unsigned length() const override { return m_rules.size(); } |
| 82 virtual CSSRule* item(unsigned index) const override { return index < m_rule
s.size() ? m_rules[index].get() : 0; } | 78 virtual CSSRule* item(unsigned index) const override { return index < m_rule
s.size() ? m_rules[index].get() : 0; } |
| 83 | 79 |
| 84 Vector<RefPtr<CSSRule> > m_rules; | 80 Vector<RefPtr<CSSRule> > m_rules; |
| 85 #if !ENABLE(OILPAN) | 81 #if !ENABLE(OILPAN) |
| 86 unsigned m_refCount; | 82 unsigned m_refCount; |
| 87 #endif | 83 #endif |
| 88 }; | 84 }; |
| 89 | 85 |
| 90 template <class Rule> | 86 template <class Rule> |
| 91 class LiveCSSRuleList final : public CSSRuleList { | 87 class LiveCSSRuleList final : public CSSRuleList { |
| 92 public: | 88 public: |
| 93 static PassOwnPtr<LiveCSSRuleList> create(Rule* rule) | 89 static PassOwnPtr<LiveCSSRuleList> create(Rule* rule) |
| 94 { | 90 { |
| 95 return adoptPtr(new LiveCSSRuleList(rule)); | 91 return adoptPtr(new LiveCSSRuleList(rule)); |
| 96 } | 92 } |
| 97 | 93 |
| 98 #if !ENABLE(OILPAN) | 94 #if !ENABLE(OILPAN) |
| 99 virtual void ref() override { m_rule->ref(); } | 95 virtual void ref() override { m_rule->ref(); } |
| 100 virtual void deref() override { m_rule->deref(); } | 96 virtual void deref() override { m_rule->deref(); } |
| 101 #endif | 97 #endif |
| 102 | 98 |
| 103 virtual void trace(Visitor* visitor) override | |
| 104 { | |
| 105 visitor->trace(m_rule); | |
| 106 CSSRuleList::trace(visitor); | |
| 107 } | |
| 108 | |
| 109 private: | 99 private: |
| 110 LiveCSSRuleList(Rule* rule) : m_rule(rule) { } | 100 LiveCSSRuleList(Rule* rule) : m_rule(rule) { } |
| 111 | 101 |
| 112 virtual unsigned length() const override { return m_rule->length(); } | 102 virtual unsigned length() const override { return m_rule->length(); } |
| 113 virtual CSSRule* item(unsigned index) const override { return m_rule->item(i
ndex); } | 103 virtual CSSRule* item(unsigned index) const override { return m_rule->item(i
ndex); } |
| 114 virtual CSSStyleSheet* styleSheet() const override { return m_rule->parentSt
yleSheet(); } | 104 virtual CSSStyleSheet* styleSheet() const override { return m_rule->parentSt
yleSheet(); } |
| 115 | 105 |
| 116 RawPtr<Rule> m_rule; | 106 RawPtr<Rule> m_rule; |
| 117 }; | 107 }; |
| 118 | 108 |
| 119 } // namespace blink | 109 } // namespace blink |
| 120 | 110 |
| 121 #endif // CSSRuleList_h | 111 #endif // CSSRuleList_h |
| OLD | NEW |