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, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2002, 2005, 2006, 2008, 2009, 2010, 2012 Apple Inc. All rights
reserved. |
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 23 matching lines...) Expand all Loading... |
34 { | 34 { |
35 return adoptRefWillBeNoop(new StyleRuleImport(href, media)); | 35 return adoptRefWillBeNoop(new StyleRuleImport(href, media)); |
36 } | 36 } |
37 | 37 |
38 StyleRuleImport::StyleRuleImport(const String& href, PassRefPtrWillBeRawPtr<Medi
aQuerySet> media) | 38 StyleRuleImport::StyleRuleImport(const String& href, PassRefPtrWillBeRawPtr<Medi
aQuerySet> media) |
39 : StyleRuleBase(Import) | 39 : StyleRuleBase(Import) |
40 , m_parentStyleSheet(nullptr) | 40 , m_parentStyleSheet(nullptr) |
41 , m_styleSheetClient(this) | 41 , m_styleSheetClient(this) |
42 , m_strHref(href) | 42 , m_strHref(href) |
43 , m_mediaQueries(media) | 43 , m_mediaQueries(media) |
44 , m_resource(nullptr) | |
45 , m_loading(false) | 44 , m_loading(false) |
46 { | 45 { |
47 if (!m_mediaQueries) | 46 if (!m_mediaQueries) |
48 m_mediaQueries = MediaQuerySet::create(String()); | 47 m_mediaQueries = MediaQuerySet::create(String()); |
| 48 |
| 49 #if ENABLE(OILPAN) |
| 50 ThreadState::current()->registerPreFinalizer(this); |
| 51 #endif |
49 } | 52 } |
50 | 53 |
51 StyleRuleImport::~StyleRuleImport() | 54 StyleRuleImport::~StyleRuleImport() |
52 { | 55 { |
53 #if !ENABLE(OILPAN) | 56 #if !ENABLE(OILPAN) |
54 if (m_styleSheet) | 57 if (m_styleSheet) |
55 m_styleSheet->clearOwnerRule(); | 58 m_styleSheet->clearOwnerRule(); |
| 59 dispose(); |
56 #endif | 60 #endif |
| 61 } |
| 62 |
| 63 void StyleRuleImport::dispose() |
| 64 { |
57 if (m_resource) | 65 if (m_resource) |
58 m_resource->removeClient(&m_styleSheetClient); | 66 m_resource->removeClient(&m_styleSheetClient); |
| 67 m_resource = nullptr; |
59 } | 68 } |
60 | 69 |
61 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport) | 70 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleImport) |
62 { | 71 { |
63 visitor->trace(m_styleSheetClient); | 72 visitor->trace(m_styleSheetClient); |
64 visitor->trace(m_parentStyleSheet); | 73 visitor->trace(m_parentStyleSheet); |
65 visitor->trace(m_mediaQueries); | 74 visitor->trace(m_mediaQueries); |
66 visitor->trace(m_styleSheet); | 75 visitor->trace(m_styleSheet); |
| 76 visitor->trace(m_resource); |
67 StyleRuleBase::traceAfterDispatch(visitor); | 77 StyleRuleBase::traceAfterDispatch(visitor); |
68 } | 78 } |
69 | 79 |
70 void StyleRuleImport::setCSSStyleSheet(const String& href, const KURL& baseURL,
const String& charset, const CSSStyleSheetResource* cachedStyleSheet) | 80 void StyleRuleImport::setCSSStyleSheet(const String& href, const KURL& baseURL,
const String& charset, const CSSStyleSheetResource* cachedStyleSheet) |
71 { | 81 { |
72 if (m_styleSheet) | 82 if (m_styleSheet) |
73 m_styleSheet->clearOwnerRule(); | 83 m_styleSheet->clearOwnerRule(); |
74 | 84 |
75 CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserCo
ntext() : strictCSSParserContext(); | 85 CSSParserContext context = m_parentStyleSheet ? m_parentStyleSheet->parserCo
ntext() : strictCSSParserContext(); |
76 context.setCharset(charset); | 86 context.setCharset(charset); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // removed from the pending sheet count, so let the doc know | 145 // removed from the pending sheet count, so let the doc know |
136 // the sheet being imported is pending. | 146 // the sheet being imported is pending. |
137 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootShe
et == m_parentStyleSheet) | 147 if (m_parentStyleSheet && m_parentStyleSheet->loadCompleted() && rootShe
et == m_parentStyleSheet) |
138 m_parentStyleSheet->startLoadingDynamicSheet(); | 148 m_parentStyleSheet->startLoadingDynamicSheet(); |
139 m_loading = true; | 149 m_loading = true; |
140 m_resource->addClient(&m_styleSheetClient); | 150 m_resource->addClient(&m_styleSheetClient); |
141 } | 151 } |
142 } | 152 } |
143 | 153 |
144 } // namespace blink | 154 } // namespace blink |
OLD | NEW |