Chromium Code Reviews| Index: Source/core/css/CSSStyleSheet.cpp |
| diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp |
| index 9e636689260befb131878841f749a37fd93dcfdb..3c33fc81af6a608303ba30df55fec75560e4a03a 100644 |
| --- a/Source/core/css/CSSStyleSheet.cpp |
| +++ b/Source/core/css/CSSStyleSheet.cpp |
| @@ -44,18 +44,30 @@ namespace WebCore { |
| class StyleSheetCSSRuleList FINAL : public CSSRuleList { |
| public: |
| - StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } |
| + static PassOwnPtrWillBeRawPtr<StyleSheetCSSRuleList> create(CSSStyleSheet* sheet) |
| + { |
| + return adoptPtrWillBeNoop(new StyleSheetCSSRuleList(sheet)); |
| + } |
| + |
| + virtual void trace(Visitor* visitor) OVERRIDE |
| + { |
| + visitor->trace(m_styleSheet); |
|
Mads Ager (chromium)
2014/03/10 12:32:57
If you do not make CSSRuleList::trace pure virtual
Erik Corry
2014/03/12 10:36:41
Done.
|
| + } |
| private: |
| + StyleSheetCSSRuleList(CSSStyleSheet* sheet) : m_styleSheet(sheet) { } |
| + |
| +#if !ENABLE(OILPAN) |
| virtual void ref() OVERRIDE { m_styleSheet->ref(); } |
| virtual void deref() OVERRIDE { m_styleSheet->deref(); } |
| +#endif |
| virtual unsigned length() const OVERRIDE { return m_styleSheet->length(); } |
| virtual CSSRule* item(unsigned index) const OVERRIDE { return m_styleSheet->item(index); } |
| virtual CSSStyleSheet* styleSheet() const OVERRIDE { return m_styleSheet; } |
| - CSSStyleSheet* m_styleSheet; |
| + RawPtrWillBeMember<CSSStyleSheet> m_styleSheet; |
| }; |
| #if !ASSERT_DISABLED |
| @@ -256,12 +268,12 @@ bool CSSStyleSheet::canAccessRules() const |
| return false; |
| } |
| -PassRefPtr<CSSRuleList> CSSStyleSheet::rules() |
| +PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::rules() |
| { |
| if (!canAccessRules()) |
| return nullptr; |
| // IE behavior. |
| - RefPtr<StaticCSSRuleList> nonCharsetRules = StaticCSSRuleList::create(); |
| + RefPtrWillBeRawPtr<StaticCSSRuleList> nonCharsetRules(StaticCSSRuleList::create()); |
| unsigned ruleCount = length(); |
| for (unsigned i = 0; i < ruleCount; ++i) { |
| CSSRule* rule = item(i); |
| @@ -347,12 +359,12 @@ int CSSStyleSheet::addRule(const String& selector, const String& style, Exceptio |
| } |
| -PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules() |
| +PassRefPtrWillBeRawPtr<CSSRuleList> CSSStyleSheet::cssRules() |
| { |
| if (!canAccessRules()) |
| return nullptr; |
| if (!m_ruleListCSSOMWrapper) |
| - m_ruleListCSSOMWrapper = adoptPtr(new StyleSheetCSSRuleList(this)); |
| + m_ruleListCSSOMWrapper = StyleSheetCSSRuleList::create(this); |
| return m_ruleListCSSOMWrapper.get(); |
| } |
| @@ -419,6 +431,7 @@ void CSSStyleSheet::trace(Visitor* visitor) |
| visitor->trace(m_ownerRule); |
| visitor->trace(m_mediaCSSOMWrapper); |
| visitor->trace(m_childRuleCSSOMWrappers); |
| + visitor->trace(m_ruleListCSSOMWrapper); |
| } |
| } |