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

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

Issue 2455943003: Backend for css rule tracking (Closed)
Patch Set: Backend for CSS Rule tracking. Created 4 years, 1 month 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 10 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
(...skipping 20 matching lines...) Expand all
31 31
32 #include "core/HTMLNames.h" 32 #include "core/HTMLNames.h"
33 #include "core/css/CSSDefaultStyleSheets.h" 33 #include "core/css/CSSDefaultStyleSheets.h"
34 #include "core/css/CSSFontSelector.h" 34 #include "core/css/CSSFontSelector.h"
35 #include "core/css/CSSStyleSheet.h" 35 #include "core/css/CSSStyleSheet.h"
36 #include "core/css/FontFaceCache.h" 36 #include "core/css/FontFaceCache.h"
37 #include "core/css/StyleSheetContents.h" 37 #include "core/css/StyleSheetContents.h"
38 #include "core/css/invalidation/InvalidationSet.h" 38 #include "core/css/invalidation/InvalidationSet.h"
39 #include "core/css/resolver/ScopedStyleResolver.h" 39 #include "core/css/resolver/ScopedStyleResolver.h"
40 #include "core/css/resolver/SharedStyleFinder.h" 40 #include "core/css/resolver/SharedStyleFinder.h"
41 #include "core/css/resolver/StyleRuleUsageTracker.h"
41 #include "core/css/resolver/ViewportStyleResolver.h" 42 #include "core/css/resolver/ViewportStyleResolver.h"
42 #include "core/dom/DocumentStyleSheetCollector.h" 43 #include "core/dom/DocumentStyleSheetCollector.h"
43 #include "core/dom/Element.h" 44 #include "core/dom/Element.h"
44 #include "core/dom/ElementTraversal.h" 45 #include "core/dom/ElementTraversal.h"
45 #include "core/dom/ProcessingInstruction.h" 46 #include "core/dom/ProcessingInstruction.h"
46 #include "core/dom/ShadowTreeStyleSheetCollection.h" 47 #include "core/dom/ShadowTreeStyleSheetCollection.h"
47 #include "core/dom/StyleChangeReason.h" 48 #include "core/dom/StyleChangeReason.h"
48 #include "core/dom/shadow/ShadowRoot.h" 49 #include "core/dom/shadow/ShadowRoot.h"
49 #include "core/frame/Settings.h" 50 #include "core/frame/Settings.h"
50 #include "core/html/HTMLIFrameElement.h" 51 #include "core/html/HTMLIFrameElement.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 m_resolver->appendAuthorStyleSheets( 418 m_resolver->appendAuthorStyleSheets(
418 documentStyleSheetCollection().activeAuthorStyleSheets()); 419 documentStyleSheetCollection().activeAuthorStyleSheets());
419 for (TreeScope* treeScope : m_activeTreeScopes) { 420 for (TreeScope* treeScope : m_activeTreeScopes) {
420 if (TreeScopeStyleSheetCollection* collection = 421 if (TreeScopeStyleSheetCollection* collection =
421 m_styleSheetCollectionMap.get(treeScope)) 422 m_styleSheetCollectionMap.get(treeScope))
422 m_resolver->appendAuthorStyleSheets( 423 m_resolver->appendAuthorStyleSheets(
423 collection->activeAuthorStyleSheets()); 424 collection->activeAuthorStyleSheets());
424 } 425 }
425 } 426 }
426 427
428 void StyleEngine::setRuleUsageTracker(StyleRuleUsageTracker* tracker) {
429 m_tracker = tracker;
430
431 if (m_resolver)
432 m_resolver->setRuleUsageTracker(m_tracker);
433 }
434
427 void StyleEngine::createResolver() { 435 void StyleEngine::createResolver() {
428 m_resolver = StyleResolver::create(*m_document); 436 m_resolver = StyleResolver::create(*m_document);
429 437
438 m_resolver->setRuleUsageTracker(m_tracker);
439
430 // A scoped style resolver for document will be created during 440 // A scoped style resolver for document will be created during
431 // appendActiveAuthorStyleSheets if needed. 441 // appendActiveAuthorStyleSheets if needed.
432 appendActiveAuthorStyleSheets(); 442 appendActiveAuthorStyleSheets();
433 finishAppendAuthorStyleSheets(); 443 finishAppendAuthorStyleSheets();
434 } 444 }
435 445
436 void StyleEngine::clearResolver() { 446 void StyleEngine::clearResolver() {
437 DCHECK(!document().inStyleRecalc()); 447 DCHECK(!document().inStyleRecalc());
438 DCHECK(isMaster() || !m_resolver); 448 DCHECK(isMaster() || !m_resolver);
439 449
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 visitor->trace(m_dirtyTreeScopes); 1053 visitor->trace(m_dirtyTreeScopes);
1044 visitor->trace(m_activeTreeScopes); 1054 visitor->trace(m_activeTreeScopes);
1045 visitor->trace(m_treeBoundaryCrossingScopes); 1055 visitor->trace(m_treeBoundaryCrossingScopes);
1046 visitor->trace(m_globalRuleSet); 1056 visitor->trace(m_globalRuleSet);
1047 visitor->trace(m_resolver); 1057 visitor->trace(m_resolver);
1048 visitor->trace(m_viewportResolver); 1058 visitor->trace(m_viewportResolver);
1049 visitor->trace(m_styleInvalidator); 1059 visitor->trace(m_styleInvalidator);
1050 visitor->trace(m_fontSelector); 1060 visitor->trace(m_fontSelector);
1051 visitor->trace(m_textToSheetCache); 1061 visitor->trace(m_textToSheetCache);
1052 visitor->trace(m_sheetToTextCache); 1062 visitor->trace(m_sheetToTextCache);
1063 visitor->trace(m_tracker);
1053 CSSFontSelectorClient::trace(visitor); 1064 CSSFontSelectorClient::trace(visitor);
1054 } 1065 }
1055 1066
1056 DEFINE_TRACE_WRAPPERS(StyleEngine) { 1067 DEFINE_TRACE_WRAPPERS(StyleEngine) {
1057 for (auto sheet : m_injectedAuthorStyleSheets) { 1068 for (auto sheet : m_injectedAuthorStyleSheets) {
1058 visitor->traceWrappers(sheet); 1069 visitor->traceWrappers(sheet);
1059 } 1070 }
1060 visitor->traceWrappers(m_documentStyleSheetCollection); 1071 visitor->traceWrappers(m_documentStyleSheetCollection);
1061 } 1072 }
1062 1073
1063 } // namespace blink 1074 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.h ('k') | third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698