Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 this._fireStyleSheetChanged(styleSheetId, edit); | 432 this._fireStyleSheetChanged(styleSheetId, edit); |
| 433 return true; | 433 return true; |
| 434 } | 434 } |
| 435 | 435 |
| 436 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.StyleRu leEdited); | 436 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.StyleRu leEdited); |
| 437 return this._ensureOriginalStyleSheetText(styleSheetId) | 437 return this._ensureOriginalStyleSheetText(styleSheetId) |
| 438 .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callba ck.bind(this))) | 438 .then(() => this._agent.setKeyframeKey(styleSheetId, range, text, callba ck.bind(this))) |
| 439 .catchException(false); | 439 .catchException(false); |
| 440 } | 440 } |
| 441 | 441 |
| 442 startRuleUsageTracking() { | |
| 443 this._agent.startRuleUsageTracking(); | |
| 444 } | |
| 445 | |
| 446 /** | |
| 447 * @return {!Promise<?Array<!WebInspector.CSSModel.RuleTextRange>>} | |
| 448 */ | |
| 449 ruleListPromise() { | |
| 450 /** | |
| 451 * @param {?string} error | |
| 452 * @param {!Array<!CSSAgent.RuleUsage>=} CSSRules | |
| 453 * @return {?Array<!WebInspector.CSSModel.RuleTextRange>} | |
| 454 */ | |
| 455 function usedRulesCallback(error, CSSRules) { | |
|
pfeldman
2016/11/02 18:38:26
variables start with lower case: cssRules or even
| |
| 456 if (error || !CSSRules) | |
| 457 return null; | |
| 458 | |
| 459 return CSSRules.map(rule => ({range: rule.range, styleSheetId: rule.styleS heetId, wasUsed: rule.used})); | |
| 460 } | |
| 461 | |
| 462 return this._agent.stopRuleUsageTracking(usedRulesCallback); | |
| 463 } | |
| 464 | |
| 442 /** | 465 /** |
| 443 * @return {!Promise.<!Array.<!WebInspector.CSSMedia>>} | 466 * @return {!Promise.<!Array.<!WebInspector.CSSMedia>>} |
| 444 */ | 467 */ |
| 445 mediaQueriesPromise() { | 468 mediaQueriesPromise() { |
| 446 /** | 469 /** |
| 447 * @param {?Protocol.Error} error | 470 * @param {?Protocol.Error} error |
| 448 * @param {?Array.<!CSSAgent.CSSMedia>} payload | 471 * @param {?Array.<!CSSAgent.CSSMedia>} payload |
| 449 * @return {!Array.<!WebInspector.CSSMedia>} | 472 * @return {!Array.<!WebInspector.CSSMedia>} |
| 450 * @this {!WebInspector.CSSModel} | 473 * @this {!WebInspector.CSSModel} |
| 451 */ | 474 */ |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 983 this._cachedMatchedCascadePromise = this.matchedStylesPromise(node.id); | 1006 this._cachedMatchedCascadePromise = this.matchedStylesPromise(node.id); |
| 984 return this._cachedMatchedCascadePromise; | 1007 return this._cachedMatchedCascadePromise; |
| 985 } | 1008 } |
| 986 | 1009 |
| 987 discardCachedMatchedCascade() { | 1010 discardCachedMatchedCascade() { |
| 988 delete this._cachedMatchedCascadeNode; | 1011 delete this._cachedMatchedCascadeNode; |
| 989 delete this._cachedMatchedCascadePromise; | 1012 delete this._cachedMatchedCascadePromise; |
| 990 } | 1013 } |
| 991 }; | 1014 }; |
| 992 | 1015 |
| 1016 /** @typedef {!{range: !WebInspector.TextRange, styleSheetId: !CSSAgent.StyleShe etId, wasUsed: boolean}} */ | |
| 1017 WebInspector.CSSModel.RuleTextRange; | |
|
pfeldman
2016/11/02 18:38:26
RuleTextRange should not operate terms such as "wa
| |
| 1018 | |
| 993 /** @enum {symbol} */ | 1019 /** @enum {symbol} */ |
| 994 WebInspector.CSSModel.Events = { | 1020 WebInspector.CSSModel.Events = { |
| 995 LayoutEditorChange: Symbol('LayoutEditorChange'), | 1021 LayoutEditorChange: Symbol('LayoutEditorChange'), |
| 996 FontsUpdated: Symbol('FontsUpdated'), | 1022 FontsUpdated: Symbol('FontsUpdated'), |
| 997 MediaQueryResultChanged: Symbol('MediaQueryResultChanged'), | 1023 MediaQueryResultChanged: Symbol('MediaQueryResultChanged'), |
| 998 ModelWasEnabled: Symbol('ModelWasEnabled'), | 1024 ModelWasEnabled: Symbol('ModelWasEnabled'), |
| 999 PseudoStateForced: Symbol('PseudoStateForced'), | 1025 PseudoStateForced: Symbol('PseudoStateForced'), |
| 1000 StyleSheetAdded: Symbol('StyleSheetAdded'), | 1026 StyleSheetAdded: Symbol('StyleSheetAdded'), |
| 1001 StyleSheetChanged: Symbol('StyleSheetChanged'), | 1027 StyleSheetChanged: Symbol('StyleSheetChanged'), |
| 1002 StyleSheetRemoved: Symbol('StyleSheetRemoved'), | 1028 StyleSheetRemoved: Symbol('StyleSheetRemoved'), |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1179 WebInspector.CSSModel.InlineStyleResult = class { | 1205 WebInspector.CSSModel.InlineStyleResult = class { |
| 1180 /** | 1206 /** |
| 1181 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle | 1207 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle |
| 1182 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle | 1208 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle |
| 1183 */ | 1209 */ |
| 1184 constructor(inlineStyle, attributesStyle) { | 1210 constructor(inlineStyle, attributesStyle) { |
| 1185 this.inlineStyle = inlineStyle; | 1211 this.inlineStyle = inlineStyle; |
| 1186 this.attributesStyle = attributesStyle; | 1212 this.attributesStyle = attributesStyle; |
| 1187 } | 1213 } |
| 1188 }; | 1214 }; |
| OLD | NEW |