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

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

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) 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 StyleSheetRemoved: Symbol("StyleSheetRemoved"), 73 StyleSheetRemoved: Symbol("StyleSheetRemoved"),
74 SourceMapAttached: Symbol("SourceMapAttached"), 74 SourceMapAttached: Symbol("SourceMapAttached"),
75 SourceMapDetached: Symbol("SourceMapDetached"), 75 SourceMapDetached: Symbol("SourceMapDetached"),
76 SourceMapChanged: Symbol("SourceMapChanged") 76 SourceMapChanged: Symbol("SourceMapChanged")
77 }; 77 };
78 78
79 WebInspector.CSSModel.MediaTypes = ["all", "braille", "embossed", "handheld", "p rint", "projection", "screen", "speech", "tty", "tv"]; 79 WebInspector.CSSModel.MediaTypes = ["all", "braille", "embossed", "handheld", "p rint", "projection", "screen", "speech", "tty", "tv"];
80 80
81 WebInspector.CSSModel.PseudoStateMarker = "pseudo-state-marker"; 81 WebInspector.CSSModel.PseudoStateMarker = "pseudo-state-marker";
82 82
83 /** @typedef {!{range: !WebInspector.TextRange, styleSheetId: !CSSAgent.StyleShe etId, wasUsed: boolean}} */
84 WebInspector.CSSModel.RuleTextRange;
85
83 /** 86 /**
84 * @constructor 87 * @constructor
85 * @param {!CSSAgent.StyleSheetId} styleSheetId 88 * @param {!CSSAgent.StyleSheetId} styleSheetId
86 * @param {!WebInspector.TextRange} oldRange 89 * @param {!WebInspector.TextRange} oldRange
87 * @param {string} newText 90 * @param {string} newText
88 * @param {?Object} payload 91 * @param {?Object} payload
89 */ 92 */
90 WebInspector.CSSModel.Edit = function(styleSheetId, oldRange, newText, payload) 93 WebInspector.CSSModel.Edit = function(styleSheetId, oldRange, newText, payload)
91 { 94 {
92 this.styleSheetId = styleSheetId; 95 this.styleSheetId = styleSheetId;
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 * @param {!Array<string>=} backgroundColors 576 * @param {!Array<string>=} backgroundColors
574 * @return {?Array<string>} 577 * @return {?Array<string>}
575 */ 578 */
576 function backgroundColorsCallback(error, backgroundColors) { 579 function backgroundColorsCallback(error, backgroundColors) {
577 return !error && backgroundColors ? backgroundColors : null; 580 return !error && backgroundColors ? backgroundColors : null;
578 } 581 }
579 return this._agent.getBackgroundColors(nodeId, backgroundColorsCallback) ; 582 return this._agent.getBackgroundColors(nodeId, backgroundColorsCallback) ;
580 }, 583 },
581 584
582 /** 585 /**
586 * @param {boolean} enable
587 */
588 startSelectorRecording: function(enable)
589 {
590 this._agent.setSelectorRecording(enable);
591 },
592
593 /**
594 * @return {!Promise<?Array<!WebInspector.CSSModel.RuleTextRange>>}
595 */
596 ruleListPromise: function()
597 {
598 /**
599 * @param {?string} error
600 * @param {!Array<!CSSAgent.RuleUsage>=} CSSRules
601 * @return {?Array<!WebInspector.CSSModel.RuleTextRange>}}
602 */
603 function usedRulesCallback(error, CSSRules)
604 {
605 if (error || !CSSRules)
606 return null;
607
608 return CSSRules.map(rule => ({range: rule.range, styleSheetId: rule. styleSheetId, wasUsed: rule.status}));
609 }
610 return this._agent.getRuleList(usedRulesCallback);
611 },
612
613 /**
583 * @param {number} nodeId 614 * @param {number} nodeId
584 * @return {!Promise.<?Array.<!CSSAgent.PlatformFontUsage>>} 615 * @return {!Promise.<?Array.<!CSSAgent.PlatformFontUsage>>}
585 */ 616 */
586 platformFontsPromise: function(nodeId) 617 platformFontsPromise: function(nodeId)
587 { 618 {
588 /** 619 /**
589 * @param {?Protocol.Error} error 620 * @param {?Protocol.Error} error
590 * @param {?Array.<!CSSAgent.PlatformFontUsage>} fonts 621 * @param {?Array.<!CSSAgent.PlatformFontUsage>} fonts
591 * @return {?Array.<!CSSAgent.PlatformFontUsage>} 622 * @return {?Array.<!CSSAgent.PlatformFontUsage>}
592 */ 623 */
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 /** 1280 /**
1250 * @constructor 1281 * @constructor
1251 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle 1282 * @param {?WebInspector.CSSStyleDeclaration} inlineStyle
1252 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle 1283 * @param {?WebInspector.CSSStyleDeclaration} attributesStyle
1253 */ 1284 */
1254 WebInspector.CSSModel.InlineStyleResult = function(inlineStyle, attributesStyle) 1285 WebInspector.CSSModel.InlineStyleResult = function(inlineStyle, attributesStyle)
1255 { 1286 {
1256 this.inlineStyle = inlineStyle; 1287 this.inlineStyle = inlineStyle;
1257 this.attributesStyle = attributesStyle; 1288 this.attributesStyle = attributesStyle;
1258 }; 1289 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698