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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorStyleSheet.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
index 7d306bfe5bbeb3771388d430a3c56a62ff8c5bb9..7db037567ee3aa2f01ef06c6c4f2d6967e562e27 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
@@ -1601,6 +1601,28 @@ InspectorStyleSheet::buildObjectForRuleWithoutMedia(CSSStyleRule* rule) {
return result;
}
+std::unique_ptr<protocol::CSS::RuleUsage>
+InspectorStyleSheet::buildObjectForRuleUsage(CSSRule* rule,
+ String ruleType,
+ bool enable) {
+ CSSStyleSheet* styleSheet = pageStyleSheet();
+ if (!styleSheet)
+ return nullptr;
+
+ CSSRuleSourceData* sourceData = sourceDataForRule(rule);
+
+ std::unique_ptr<protocol::CSS::RuleUsage> result =
+ protocol::CSS::RuleUsage::create()
+ .setStyleSheetId(id())
+ .setRange(buildSourceRangeObject(sourceData->ruleBodyRange))
+ .setStatus(enable)
+ .build();
+
+ result->setRuleType(ruleType);
+
+ return result;
+}
+
std::unique_ptr<protocol::CSS::CSSKeyframeRule>
InspectorStyleSheet::buildObjectForKeyframeRule(CSSKeyframeRule* keyframeRule) {
CSSStyleSheet* styleSheet = pageStyleSheet();

Powered by Google App Engine
This is Rietveld 408576698