| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 void StyleEngine::addPendingSheet() | 157 void StyleEngine::addPendingSheet() |
| 158 { | 158 { |
| 159 m_pendingStylesheets++; | 159 m_pendingStylesheets++; |
| 160 } | 160 } |
| 161 | 161 |
| 162 // This method is called whenever a top-level stylesheet has finished loading. | 162 // This method is called whenever a top-level stylesheet has finished loading. |
| 163 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode) | 163 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode) |
| 164 { | 164 { |
| 165 DCHECK(styleSheetCandidateNode); | 165 DCHECK(styleSheetCandidateNode); |
| 166 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee
tCandidateNode->treeScope() : m_document.get(); | 166 TreeScope* treeScope = isStyleElement(*styleSheetCandidateNode) ? &styleShee
tCandidateNode->treeScopeOrDocument() : m_document.get(); |
| 167 if (styleSheetCandidateNode->inShadowIncludingDocument()) | 167 if (styleSheetCandidateNode->inShadowIncludingDocument()) |
| 168 markTreeScopeDirty(*treeScope); | 168 markTreeScopeDirty(*treeScope); |
| 169 | 169 |
| 170 // Make sure we knew this sheet was pending, and that our count isn't out of
sync. | 170 // Make sure we knew this sheet was pending, and that our count isn't out of
sync. |
| 171 DCHECK_GT(m_pendingStylesheets, 0); | 171 DCHECK_GT(m_pendingStylesheets, 0); |
| 172 | 172 |
| 173 m_pendingStylesheets--; | 173 m_pendingStylesheets--; |
| 174 if (m_pendingStylesheets) | 174 if (m_pendingStylesheets) |
| 175 return; | 175 return; |
| 176 | 176 |
| 177 document().didRemoveAllPendingStylesheet(); | 177 document().didRemoveAllPendingStylesheet(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda
teMode updateMode) | 180 void StyleEngine::setNeedsActiveStyleUpdate(StyleSheet* sheet, StyleResolverUpda
teMode updateMode) |
| 181 { | 181 { |
| 182 // resolverChanged() is called for inactive non-master documents because | 182 // resolverChanged() is called for inactive non-master documents because |
| 183 // import documents are inactive documents. resolverChanged() for imports | 183 // import documents are inactive documents. resolverChanged() for imports |
| 184 // will call resolverChanged() for the master document and update the active | 184 // will call resolverChanged() for the master document and update the active |
| 185 // stylesheets including the ones from the import. | 185 // stylesheets including the ones from the import. |
| 186 if (!document().isActive() && isMaster()) | 186 if (!document().isActive() && isMaster()) |
| 187 return; | 187 return; |
| 188 | 188 |
| 189 if (sheet && document().isActive()) { | 189 if (sheet && document().isActive()) { |
| 190 Node* node = sheet->ownerNode(); | 190 Node* node = sheet->ownerNode(); |
| 191 if (node && node->inShadowIncludingDocument()) { | 191 if (node && node->inShadowIncludingDocument()) { |
| 192 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *
m_document; | 192 TreeScope& treeScope = isStyleElement(*node) ? node->treeScopeOrDocu
ment() : *m_document; |
| 193 DCHECK(isStyleElement(*node) || node->treeScope() == m_document); | 193 DCHECK(isStyleElement(*node) || node->treeScopeOrDocument() == m_doc
ument); |
| 194 markTreeScopeDirty(treeScope); | 194 markTreeScopeDirty(treeScope); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 resolverChanged(updateMode); | 198 resolverChanged(updateMode); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void StyleEngine::addStyleSheetCandidateNode(Node* node) | 201 void StyleEngine::addStyleSheetCandidateNode(Node* node) |
| 202 { | 202 { |
| 203 if (!node->inShadowIncludingDocument() || document().isDetached()) | 203 if (!node->inShadowIncludingDocument() || document().isDetached()) |
| 204 return; | 204 return; |
| 205 | 205 |
| 206 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume
nt; | 206 TreeScope& treeScope = isStyleElement(*node) ? node->treeScopeOrDocument() :
*m_document; |
| 207 DCHECK(isStyleElement(*node) || treeScope == m_document); | 207 DCHECK(isStyleElement(*node) || treeScope == m_document); |
| 208 DCHECK(!isXSLStyleSheet(*node)); | 208 DCHECK(!isXSLStyleSheet(*node)); |
| 209 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr
eeScope); | 209 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr
eeScope); |
| 210 DCHECK(collection); | 210 DCHECK(collection); |
| 211 collection->addStyleSheetCandidateNode(node); | 211 collection->addStyleSheetCandidateNode(node); |
| 212 | 212 |
| 213 markTreeScopeDirty(treeScope); | 213 markTreeScopeDirty(treeScope); |
| 214 if (treeScope != m_document) | 214 if (treeScope != m_document) |
| 215 m_activeTreeScopes.add(&treeScope); | 215 m_activeTreeScopes.add(&treeScope); |
| 216 } | 216 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 233 collection->removeStyleSheetCandidateNode(node); | 233 collection->removeStyleSheetCandidateNode(node); |
| 234 | 234 |
| 235 markTreeScopeDirty(treeScope); | 235 markTreeScopeDirty(treeScope); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node) | 238 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node) |
| 239 { | 239 { |
| 240 if (!node->inShadowIncludingDocument()) | 240 if (!node->inShadowIncludingDocument()) |
| 241 return; | 241 return; |
| 242 | 242 |
| 243 TreeScope& treeScope = isStyleElement(*node) ? node->treeScope() : *m_docume
nt; | 243 TreeScope& treeScope = isStyleElement(*node) ? node->treeScopeOrDocument() :
*m_document; |
| 244 DCHECK(isStyleElement(*node) || treeScope == m_document); | 244 DCHECK(isStyleElement(*node) || treeScope == m_document); |
| 245 markTreeScopeDirty(treeScope); | 245 markTreeScopeDirty(treeScope); |
| 246 resolverChanged(FullStyleUpdate); | 246 resolverChanged(FullStyleUpdate); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void StyleEngine::watchedSelectorsChanged() | 249 void StyleEngine::watchedSelectorsChanged() |
| 250 { | 250 { |
| 251 if (m_resolver) { | 251 if (m_resolver) { |
| 252 m_resolver->initWatchedSelectorRules(); | 252 m_resolver->initWatchedSelectorRules(); |
| 253 m_resolver->resetRuleFeatures(); | 253 m_resolver->resetRuleFeatures(); |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 visitor->trace(m_styleInvalidator); | 784 visitor->trace(m_styleInvalidator); |
| 785 visitor->trace(m_dirtyTreeScopes); | 785 visitor->trace(m_dirtyTreeScopes); |
| 786 visitor->trace(m_activeTreeScopes); | 786 visitor->trace(m_activeTreeScopes); |
| 787 visitor->trace(m_fontSelector); | 787 visitor->trace(m_fontSelector); |
| 788 visitor->trace(m_textToSheetCache); | 788 visitor->trace(m_textToSheetCache); |
| 789 visitor->trace(m_sheetToTextCache); | 789 visitor->trace(m_sheetToTextCache); |
| 790 CSSFontSelectorClient::trace(visitor); | 790 CSSFontSelectorClient::trace(visitor); |
| 791 } | 791 } |
| 792 | 792 |
| 793 } // namespace blink | 793 } // namespace blink |
| OLD | NEW |