OLD | NEW |
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 #endif | 155 #endif |
156 } | 156 } |
157 | 157 |
158 void CSSStyleSheet::willMutateRules() | 158 void CSSStyleSheet::willMutateRules() |
159 { | 159 { |
160 InspectorInstrumentation::willMutateRules(this); | 160 InspectorInstrumentation::willMutateRules(this); |
161 | 161 |
162 // If we are the only client it is safe to mutate. | 162 // If we are the only client it is safe to mutate. |
163 if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) { | 163 if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) { |
164 m_contents->clearRuleSet(); | 164 m_contents->clearRuleSet(); |
165 m_contents->removeSheetFromCache(ownerDocument()); | 165 if (Document* document = ownerDocument()) |
| 166 m_contents->removeSheetFromCache(document); |
166 m_contents->setMutable(); | 167 m_contents->setMutable(); |
167 return; | 168 return; |
168 } | 169 } |
169 // Only cacheable stylesheets should have multiple clients. | 170 // Only cacheable stylesheets should have multiple clients. |
170 ASSERT(m_contents->isCacheable()); | 171 ASSERT(m_contents->isCacheable()); |
171 | 172 |
172 // Copy-on-write. | 173 // Copy-on-write. |
173 m_contents->unregisterClient(this); | 174 m_contents->unregisterClient(this); |
174 m_contents = m_contents->copy(); | 175 m_contents = m_contents->copy(); |
175 m_contents->registerClient(this); | 176 m_contents->registerClient(this); |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 { | 452 { |
452 visitor->trace(m_contents); | 453 visitor->trace(m_contents); |
453 visitor->trace(m_mediaQueries); | 454 visitor->trace(m_mediaQueries); |
454 visitor->trace(m_ownerRule); | 455 visitor->trace(m_ownerRule); |
455 visitor->trace(m_mediaCSSOMWrapper); | 456 visitor->trace(m_mediaCSSOMWrapper); |
456 visitor->trace(m_childRuleCSSOMWrappers); | 457 visitor->trace(m_childRuleCSSOMWrappers); |
457 visitor->trace(m_ruleListCSSOMWrapper); | 458 visitor->trace(m_ruleListCSSOMWrapper); |
458 } | 459 } |
459 | 460 |
460 } | 461 } |
OLD | NEW |