Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: Source/core/dom/StyleEngine.cpp

Issue 27537009: Avoid always style recalc when removing stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 if (notification == RemovePendingSheetNotifyLater) { 281 if (notification == RemovePendingSheetNotifyLater) {
282 m_document.setNeedsNotifyRemoveAllPendingStylesheet(); 282 m_document.setNeedsNotifyRemoveAllPendingStylesheet();
283 return; 283 return;
284 } 284 }
285 285
286 // FIXME: We can't call addedStyleSheet or removedStyleSheet here because we don't know 286 // FIXME: We can't call addedStyleSheet or removedStyleSheet here because we don't know
287 // what's new. We should track that to tell the style system what changed. 287 // what's new. We should track that to tell the style system what changed.
288 m_document.didRemoveAllPendingStylesheet(); 288 m_document.didRemoveAllPendingStylesheet();
289 } 289 }
290 290
291 void StyleEngine::modifiedStyleSheet(StyleSheet* sheet)
292 {
293 if (!sheet)
294 return;
295
296 Node* node = sheet->ownerNode();
297 if (!node || !node->inDocument())
298 return;
299
300 TreeScope& treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_docu ment;
301 ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
302
303 if (treeScope == m_document) {
304 m_needsDocumentStyleSheetsUpdate = true;
305 return;
306 }
307 m_dirtyTreeScopes.add(&treeScope);
308 }
309
291 void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser) 310 void StyleEngine::addStyleSheetCandidateNode(Node* node, bool createdByParser)
292 { 311 {
293 if (!node->inDocument()) 312 if (!node->inDocument())
294 return; 313 return;
295 314
296 TreeScope& treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_docu ment; 315 TreeScope& treeScope = isHTMLStyleElement(node) ? node->treeScope() : m_docu ment;
297 ASSERT(isHTMLStyleElement(node) || treeScope == m_document); 316 ASSERT(isHTMLStyleElement(node) || treeScope == m_document);
298 317
299 StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope); 318 StyleSheetCollection* collection = ensureStyleSheetCollectionFor(treeScope);
300 ASSERT(collection); 319 ASSERT(collection);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (StyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it )) { 458 if (StyleSheetCollection* collection = m_styleSheetCollectionMap.get(*it )) {
440 styleResolver->setBuildScopedStyleTreeInDocumentOrder(!collection->s copingNodesForStyleScoped()); 459 styleResolver->setBuildScopedStyleTreeInDocumentOrder(!collection->s copingNodesForStyleScoped());
441 styleResolver->appendAuthorStyleSheets(0, collection->activeAuthorSt yleSheets()); 460 styleResolver->appendAuthorStyleSheets(0, collection->activeAuthorSt yleSheets());
442 } 461 }
443 } 462 }
444 styleResolver->finishAppendAuthorStyleSheets(); 463 styleResolver->finishAppendAuthorStyleSheets();
445 styleResolver->setBuildScopedStyleTreeInDocumentOrder(false); 464 styleResolver->setBuildScopedStyleTreeInDocumentOrder(false);
446 } 465 }
447 466
448 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698