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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sdk/CSSModel.js

Issue 2472213005: DevTools: introduce "Track CSS Usage" experiment (Closed)
Patch Set: Unused CSS highlight in sources panel 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 return this._ensureOriginalStyleSheetText(styleSheetId) 438 return this._ensureOriginalStyleSheetText(styleSheetId)
439 .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callba ck.bind(this))) 439 .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callba ck.bind(this)))
440 .catchException(false); 440 .catchException(false);
441 } 441 }
442 442
443 startRuleUsageTracking() { 443 startRuleUsageTracking() {
444 this._agent.startRuleUsageTracking(); 444 this._agent.startRuleUsageTracking();
445 } 445 }
446 446
447 /** 447 /**
448 * @return {!Promise<?Array<!WebInspector.CSSModel.RuleUsage>>} 448 * @return {!Promise<!Array<!WebInspector.CSSModel.RuleUsage>>}
449 */ 449 */
450 ruleListPromise() { 450 ruleListPromise() {
451 /** 451 /**
452 * @param {?string} error 452 * @param {?string} error
453 * @param {!Array<!Protocol.CSS.RuleUsage>=} ruleUsage 453 * @param {!Array<!Protocol.CSS.RuleUsage>=} ruleUsage
454 * @return {?Array<!WebInspector.CSSModel.RuleUsage>} 454 * @return {!Array<!WebInspector.CSSModel.RuleUsage>}
455 */ 455 */
456 function usedRulesCallback(error, ruleUsage) { 456 function usedRulesCallback(error, ruleUsage) {
457 if (error || !ruleUsage) 457 if (error || !ruleUsage)
458 return null; 458 return [];
459 459
460 return ruleUsage.map(rule => ({range: rule.range, styleSheetId: rule.style SheetId, wasUsed: rule.used})); 460 return ruleUsage.map(rule => ({range: rule.range, styleSheetId: rule.style SheetId, wasUsed: rule.used}));
461 } 461 }
462 462
463 return this._agent.stopRuleUsageTracking(usedRulesCallback); 463 return this._agent.stopRuleUsageTracking(usedRulesCallback);
464 } 464 }
465 465
466 /** 466 /**
467 * @return {!Promise.<!Array.<!WebInspector.CSSMedia>>} 467 * @return {!Promise.<!Array.<!WebInspector.CSSMedia>>}
468 */ 468 */
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 WebInspector.CSSModel.InlineStyleResult = class { 1206 WebInspector.CSSModel.InlineStyleResult = class {
1207 /** 1207 /**
1208 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle 1208 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle
1209 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle 1209 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle
1210 */ 1210 */
1211 constructor(inlineStyle, attributesStyle) { 1211 constructor(inlineStyle, attributesStyle) {
1212 this.inlineStyle = inlineStyle; 1212 this.inlineStyle = inlineStyle;
1213 this.attributesStyle = attributesStyle; 1213 this.attributesStyle = attributesStyle;
1214 } 1214 }
1215 }; 1215 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698