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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h

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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h
diff --git a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h
index 2a8f4031c13a932bd6854d557263817e802cc817..b18a9750b6a228c960bb664e8998d51bc0e8e550 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorCSSAgent.h
@@ -57,6 +57,7 @@ class InspectorResourceContentLoader;
class MediaList;
class Node;
class LayoutObject;
+class StyleRuleUsageTracker;
class CORE_EXPORT InspectorCSSAgent final
: public InspectorBaseAgent<protocol::CSS::Metainfo>,
@@ -124,6 +125,9 @@ class CORE_EXPORT InspectorCSSAgent final
void activeStyleSheetsUpdated(Document*);
void documentDetached(Document*);
void fontsUpdated();
+ void getUnusedRules(
+ std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>*);
+ void setUsageTrackerStatus(bool enable);
void enable(std::unique_ptr<EnableCallback>) override;
void disable(ErrorString*) override;
@@ -208,6 +212,13 @@ class CORE_EXPORT InspectorCSSAgent final
int nodeId,
Maybe<protocol::Array<String>>* backgroundColors) override;
+ void startRuleUsageTracking(ErrorString*) override;
+
+ void stopRuleUsageTracking(
+ ErrorString*,
+ std::unique_ptr<protocol::Array<protocol::CSS::RuleUsage>>* result)
+ override;
+
void collectMediaQueriesFromRule(CSSRule*,
protocol::Array<protocol::CSS::CSSMedia>*);
void collectMediaQueriesFromStyleSheet(
@@ -303,12 +314,15 @@ class CORE_EXPORT InspectorCSSAgent final
String detectOrigin(CSSStyleSheet* pageStyleSheet, Document* ownerDocument);
std::unique_ptr<protocol::CSS::CSSRule> buildObjectForRule(CSSStyleRule*);
+ std::unique_ptr<protocol::CSS::RuleUsage> buildObjectForRuleUsage(CSSRule*,
+ bool);
std::unique_ptr<protocol::Array<protocol::CSS::RuleMatch>>
buildArrayForMatchedRuleList(CSSRuleList*, Element*, PseudoId);
std::unique_ptr<protocol::CSS::CSSStyle> buildObjectForAttributesStyle(
Element*);
// InspectorDOMAgent::DOMListener implementation
+ void didAddDocument(Document*) override;
void didRemoveDocument(Document*) override;
void didRemoveDOMNode(Node*) override;
void didModifyDOMAttr(Element*) override;
@@ -358,6 +372,8 @@ class CORE_EXPORT InspectorCSSAgent final
NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet;
NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState;
+ Member<StyleRuleUsageTracker> m_tracker;
+
Member<CSSStyleSheet> m_inspectorUserAgentStyleSheet;
int m_resourceContentLoaderClientId;

Powered by Google App Engine
This is Rietveld 408576698