| 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 | 155 |
| 156 if (m_mediaCSSOMWrapper) | 156 if (m_mediaCSSOMWrapper) |
| 157 m_mediaCSSOMWrapper->clearParentStyleSheet(); | 157 m_mediaCSSOMWrapper->clearParentStyleSheet(); |
| 158 | 158 |
| 159 m_contents->unregisterClient(this); | 159 m_contents->unregisterClient(this); |
| 160 #endif | 160 #endif |
| 161 } | 161 } |
| 162 | 162 |
| 163 void CSSStyleSheet::willMutateRules() | 163 void CSSStyleSheet::willMutateRules() |
| 164 { | 164 { |
| 165 InspectorInstrumentation::willMutateRules(this); | |
| 166 | |
| 167 // If we are the only client it is safe to mutate. | 165 // If we are the only client it is safe to mutate. |
| 168 if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) { | 166 if (m_contents->clientSize() <= 1 && !m_contents->isInMemoryCache()) { |
| 169 m_contents->clearRuleSet(); | 167 m_contents->clearRuleSet(); |
| 170 if (Document* document = ownerDocument()) | 168 if (Document* document = ownerDocument()) |
| 171 m_contents->removeSheetFromCache(document); | 169 m_contents->removeSheetFromCache(document); |
| 172 m_contents->setMutable(); | 170 m_contents->setMutable(); |
| 173 return; | 171 return; |
| 174 } | 172 } |
| 175 // Only cacheable stylesheets should have multiple clients. | 173 // Only cacheable stylesheets should have multiple clients. |
| 176 ASSERT(m_contents->isCacheable()); | 174 ASSERT(m_contents->isCacheable()); |
| 177 | 175 |
| 178 // Copy-on-write. | 176 // Copy-on-write. |
| 179 m_contents->unregisterClient(this); | 177 m_contents->unregisterClient(this); |
| 180 m_contents = m_contents->copy(); | 178 m_contents = m_contents->copy(); |
| 181 m_contents->registerClient(this); | 179 m_contents->registerClient(this); |
| 182 | 180 |
| 183 m_contents->setMutable(); | 181 m_contents->setMutable(); |
| 184 | 182 |
| 185 // Any existing CSSOM wrappers need to be connected to the copied child rule
s. | 183 // Any existing CSSOM wrappers need to be connected to the copied child rule
s. |
| 186 reattachChildRuleCSSOMWrappers(); | 184 reattachChildRuleCSSOMWrappers(); |
| 187 } | 185 } |
| 188 | 186 |
| 189 void CSSStyleSheet::didMutateRules() | 187 void CSSStyleSheet::didMutateRules() |
| 190 { | 188 { |
| 191 ASSERT(m_contents->isMutable()); | 189 ASSERT(m_contents->isMutable()); |
| 192 ASSERT(m_contents->clientSize() <= 1); | 190 ASSERT(m_contents->clientSize() <= 1); |
| 193 | 191 |
| 194 InspectorInstrumentation::didMutateRules(this); | |
| 195 didMutate(PartialRuleUpdate); | 192 didMutate(PartialRuleUpdate); |
| 196 } | 193 } |
| 197 | 194 |
| 198 void CSSStyleSheet::didMutate(StyleSheetUpdateType updateType) | 195 void CSSStyleSheet::didMutate(StyleSheetUpdateType updateType) |
| 199 { | 196 { |
| 200 Document* owner = ownerDocument(); | 197 Document* owner = ownerDocument(); |
| 201 if (!owner) | 198 if (!owner) |
| 202 return; | 199 return; |
| 203 | 200 |
| 204 // Need FullStyleUpdate when insertRule or deleteRule, | 201 // Need FullStyleUpdate when insertRule or deleteRule, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 visitor->trace(m_mediaQueries); | 446 visitor->trace(m_mediaQueries); |
| 450 visitor->trace(m_ownerNode); | 447 visitor->trace(m_ownerNode); |
| 451 visitor->trace(m_ownerRule); | 448 visitor->trace(m_ownerRule); |
| 452 visitor->trace(m_mediaCSSOMWrapper); | 449 visitor->trace(m_mediaCSSOMWrapper); |
| 453 visitor->trace(m_childRuleCSSOMWrappers); | 450 visitor->trace(m_childRuleCSSOMWrappers); |
| 454 visitor->trace(m_ruleListCSSOMWrapper); | 451 visitor->trace(m_ruleListCSSOMWrapper); |
| 455 StyleSheet::trace(visitor); | 452 StyleSheet::trace(visitor); |
| 456 } | 453 } |
| 457 | 454 |
| 458 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |