| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 } | 237 } |
| 238 | 238 |
| 239 void StyleEngine::addPendingSheet() | 239 void StyleEngine::addPendingSheet() |
| 240 { | 240 { |
| 241 master()->styleEngine()->notifyPendingStyleSheetAdded(); | 241 master()->styleEngine()->notifyPendingStyleSheetAdded(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // This method is called whenever a top-level stylesheet has finished loading. | 244 // This method is called whenever a top-level stylesheet has finished loading. |
| 245 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, RemovePendin
gSheetNotificationType notification) | 245 void StyleEngine::removePendingSheet(Node* styleSheetCandidateNode, RemovePendin
gSheetNotificationType notification) |
| 246 { | 246 { |
| 247 TreeScope* treeScope = styleSheetCandidateNode->hasTagName(styleTag) ? &styl
eSheetCandidateNode->treeScope() : &m_document; | 247 ASSERT(styleSheetCandidateNode); |
| 248 TreeScope* treeScope = isHTMLStyleElement(*styleSheetCandidateNode) ? &style
SheetCandidateNode->treeScope() : &m_document; |
| 248 markTreeScopeDirty(*treeScope); | 249 markTreeScopeDirty(*treeScope); |
| 249 master()->styleEngine()->notifyPendingStyleSheetRemoved(notification); | 250 master()->styleEngine()->notifyPendingStyleSheetRemoved(notification); |
| 250 } | 251 } |
| 251 | 252 |
| 252 void StyleEngine::notifyPendingStyleSheetAdded() | 253 void StyleEngine::notifyPendingStyleSheetAdded() |
| 253 { | 254 { |
| 254 ASSERT(isMaster()); | 255 ASSERT(isMaster()); |
| 255 m_pendingStylesheets++; | 256 m_pendingStylesheets++; |
| 256 } | 257 } |
| 257 | 258 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 277 | 278 |
| 278 void StyleEngine::modifiedStyleSheet(StyleSheet* sheet) | 279 void StyleEngine::modifiedStyleSheet(StyleSheet* sheet) |
| 279 { | 280 { |
| 280 if (!sheet) | 281 if (!sheet) |
| 281 return; | 282 return; |
| 282 | 283 |
| 283 Node* node = sheet->ownerNode(); | 284 Node* node = sheet->ownerNode(); |
| 284 if (!node || !node->inDocument()) | 285 if (!node || !node->inDocument()) |
| 285 return; | 286 return; |
| 286 | 287 |
| 287 TreeScope& treeScope = node->hasTagName(styleTag) ? node->treeScope() : m_do
cument; | 288 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : m_doc
ument; |
| 288 ASSERT(node->hasTagName(styleTag) || treeScope == m_document); | 289 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); |
| 289 | 290 |
| 290 markTreeScopeDirty(treeScope); | 291 markTreeScopeDirty(treeScope); |
| 291 } | 292 } |
| 292 | 293 |
| 293 void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser) | 294 void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser) |
| 294 { | 295 { |
| 295 if (!node->inDocument()) | 296 if (!node->inDocument()) |
| 296 return; | 297 return; |
| 297 | 298 |
| 298 TreeScope& treeScope = node->hasTagName(styleTag) ? node->treeScope() : m_do
cument; | 299 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : m_doc
ument; |
| 299 ASSERT(node->hasTagName(styleTag) || treeScope == m_document); | 300 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); |
| 300 | 301 |
| 301 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr
eeScope); | 302 TreeScopeStyleSheetCollection* collection = ensureStyleSheetCollectionFor(tr
eeScope); |
| 302 ASSERT(collection); | 303 ASSERT(collection); |
| 303 collection->addStyleSheetCandidateNode(node, createdByParser); | 304 collection->addStyleSheetCandidateNode(node, createdByParser); |
| 304 | 305 |
| 305 markTreeScopeDirty(treeScope); | 306 markTreeScopeDirty(treeScope); |
| 306 if (treeScope != m_document) | 307 if (treeScope != m_document) |
| 307 insertTreeScopeInDocumentOrder(m_activeTreeScopes, &treeScope); | 308 insertTreeScopeInDocumentOrder(m_activeTreeScopes, &treeScope); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopi
ngNode) | 311 void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopi
ngNode) |
| 311 { | 312 { |
| 312 TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : m_document; | 313 TreeScope& treeScope = scopingNode ? scopingNode->treeScope() : m_document; |
| 313 ASSERT(node->hasTagName(styleTag) || treeScope == m_document); | 314 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); |
| 314 | 315 |
| 315 TreeScopeStyleSheetCollection* collection = styleSheetCollectionFor(treeScop
e); | 316 TreeScopeStyleSheetCollection* collection = styleSheetCollectionFor(treeScop
e); |
| 316 ASSERT(collection); | 317 ASSERT(collection); |
| 317 collection->removeStyleSheetCandidateNode(node, scopingNode); | 318 collection->removeStyleSheetCandidateNode(node, scopingNode); |
| 318 | 319 |
| 319 markTreeScopeDirty(treeScope); | 320 markTreeScopeDirty(treeScope); |
| 320 m_activeTreeScopes.remove(&treeScope); | 321 m_activeTreeScopes.remove(&treeScope); |
| 321 } | 322 } |
| 322 | 323 |
| 323 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node) | 324 void StyleEngine::modifiedStyleSheetCandidateNode(Node* node) |
| 324 { | 325 { |
| 325 if (!node->inDocument()) | 326 if (!node->inDocument()) |
| 326 return; | 327 return; |
| 327 | 328 |
| 328 TreeScope& treeScope = node->hasTagName(styleTag) ? node->treeScope() : m_do
cument; | 329 TreeScope& treeScope = isHTMLStyleElement(*node) ? node->treeScope() : m_doc
ument; |
| 329 ASSERT(node->hasTagName(styleTag) || treeScope == m_document); | 330 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); |
| 330 markTreeScopeDirty(treeScope); | 331 markTreeScopeDirty(treeScope); |
| 331 } | 332 } |
| 332 | 333 |
| 333 bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdate
Mode updateMode) | 334 bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdate
Mode updateMode) |
| 334 { | 335 { |
| 335 return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate; | 336 return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate; |
| 336 } | 337 } |
| 337 | 338 |
| 338 void StyleEngine::clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet tree
Scopes) | 339 void StyleEngine::clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet tree
Scopes) |
| 339 { | 340 { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 { | 613 { |
| 613 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache()
.find(contents); | 614 HashMap<StyleSheetContents*, AtomicString>::iterator it = sheetToTextCache()
.find(contents); |
| 614 if (it == sheetToTextCache().end()) | 615 if (it == sheetToTextCache().end()) |
| 615 return; | 616 return; |
| 616 | 617 |
| 617 textToSheetCache().remove(it->value); | 618 textToSheetCache().remove(it->value); |
| 618 sheetToTextCache().remove(contents); | 619 sheetToTextCache().remove(contents); |
| 619 } | 620 } |
| 620 | 621 |
| 621 } | 622 } |
| OLD | NEW |