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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 static bool isStyleElement(const Node* node) | 140 static bool isStyleElement(const Node* node) |
141 { | 141 { |
142 return node && (isHTMLStyleElement(node) || isSVGStyleElement(node)); | 142 return node && (isHTMLStyleElement(node) || isSVGStyleElement(node)); |
143 } | 143 } |
144 | 144 |
145 #endif // ENABLE(ASSERT) | 145 #endif // ENABLE(ASSERT) |
146 | 146 |
147 void CSSStyleSheet::willMutateRules() | 147 void CSSStyleSheet::willMutateRules() |
148 { | 148 { |
149 // If we are the only client it is safe to mutate. | 149 // If we are the only client it is safe to mutate. |
150 if (m_contents->clientSize() <= 1 && !m_contents->isReferencedFromResource()
) { | 150 if (!m_contents->isUsedFromTextCache() && !m_contents->isReferencedFromResou
rce()) { |
151 m_contents->clearRuleSet(); | 151 m_contents->clearRuleSet(); |
152 if (Document* document = ownerDocument()) | |
153 m_contents->removeSheetFromCache(document); | |
154 m_contents->setMutable(); | 152 m_contents->setMutable(); |
155 return; | 153 return; |
156 } | 154 } |
157 // Only cacheable stylesheets should have multiple clients. | 155 // Only cacheable stylesheets should have multiple clients. |
158 ASSERT((isStyleElement(ownerNode()) && m_contents->isCacheableForStyleElemen
t()) | 156 ASSERT((isStyleElement(ownerNode()) && m_contents->isCacheableForStyleElemen
t()) |
159 || m_contents->isCacheableForResource()); | 157 || m_contents->isCacheableForResource()); |
160 | 158 |
161 // Copy-on-write. | 159 // Copy-on-write. |
162 m_contents->unregisterClient(this); | 160 m_contents->unregisterClient(this); |
163 m_contents = m_contents->copy(); | 161 m_contents = m_contents->copy(); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 visitor->trace(m_mediaQueries); | 438 visitor->trace(m_mediaQueries); |
441 visitor->trace(m_ownerNode); | 439 visitor->trace(m_ownerNode); |
442 visitor->trace(m_ownerRule); | 440 visitor->trace(m_ownerRule); |
443 visitor->trace(m_mediaCSSOMWrapper); | 441 visitor->trace(m_mediaCSSOMWrapper); |
444 visitor->trace(m_childRuleCSSOMWrappers); | 442 visitor->trace(m_childRuleCSSOMWrappers); |
445 visitor->trace(m_ruleListCSSOMWrapper); | 443 visitor->trace(m_ruleListCSSOMWrapper); |
446 StyleSheet::trace(visitor); | 444 StyleSheet::trace(visitor); |
447 } | 445 } |
448 | 446 |
449 } // namespace blink | 447 } // namespace blink |
OLD | NEW |