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

Side by Side Diff: Source/devtools/front_end/StyleSheetOutlineDialog.js

Issue 148523012: DevTools: [CSS] remove getAllStylesheets method from protocol (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix testcase extension Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/CSSStyleModel.js ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 renderItem: function(itemIndex, query, titleElement, subtitleElement) 95 renderItem: function(itemIndex, query, titleElement, subtitleElement)
96 { 96 {
97 var rule = this._rules[itemIndex]; 97 var rule = this._rules[itemIndex];
98 titleElement.textContent = rule.selectorText; 98 titleElement.textContent = rule.selectorText;
99 this.highlightRanges(titleElement, query); 99 this.highlightRanges(titleElement, query);
100 subtitleElement.textContent = ":" + (rule.rawLocation.lineNumber + 1); 100 subtitleElement.textContent = ":" + (rule.rawLocation.lineNumber + 1);
101 }, 101 },
102 102
103 _requestItems: function() 103 _requestItems: function()
104 { 104 {
105 /** 105 var styleSheets = WebInspector.cssModel.allStyleSheets();
106 * @param {?Protocol.Error} error 106 for (var i = 0; i < styleSheets.length; ++i) {
107 * @param {!Array.<!CSSAgent.CSSStyleSheetHeader>} infos 107 var styleSheet = styleSheets[i];
108 * @this {WebInspector.StyleSheetOutlineDialog} 108 if (styleSheet.sourceURL === this._uiSourceCode.url) {
109 */ 109 WebInspector.CSSStyleSheet.createForId(styleSheet.id, didGetStyl eSheet.bind(this));
110 function didGetAllStyleSheets(error, infos)
111 {
112 if (error)
113 return; 110 return;
114
115 for (var i = 0; i < infos.length; ++i) {
116 var info = infos[i];
117 if (info.sourceURL === this._uiSourceCode.url) {
118 WebInspector.CSSStyleSheet.createForId(info.styleSheetId, di dGetStyleSheet.bind(this));
119 return;
120 }
121 } 111 }
122 } 112 }
123 113
124 CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this));
125
126 /** 114 /**
127 * @param {?WebInspector.CSSStyleSheet} styleSheet 115 * @param {?WebInspector.CSSStyleSheet} styleSheet
128 * @this {WebInspector.StyleSheetOutlineDialog} 116 * @this {WebInspector.StyleSheetOutlineDialog}
129 */ 117 */
130 function didGetStyleSheet(styleSheet) 118 function didGetStyleSheet(styleSheet)
131 { 119 {
132 if (!styleSheet) 120 if (!styleSheet)
133 return; 121 return;
134 122
135 this._rules = styleSheet.rules; 123 this._rules = styleSheet.rules;
136 this.refresh(); 124 this.refresh();
137 } 125 }
138 }, 126 },
139 127
140 /** 128 /**
141 * @param {number} itemIndex 129 * @param {number} itemIndex
142 * @param {string} promptValue 130 * @param {string} promptValue
143 */ 131 */
144 selectItem: function(itemIndex, promptValue) 132 selectItem: function(itemIndex, promptValue)
145 { 133 {
146 var rule = this._rules[itemIndex]; 134 var rule = this._rules[itemIndex];
147 var lineNumber = rule.rawLocation.lineNumber; 135 var lineNumber = rule.rawLocation.lineNumber;
148 if (!isNaN(lineNumber) && lineNumber >= 0) 136 if (!isNaN(lineNumber) && lineNumber >= 0)
149 this._selectItemCallback(lineNumber, rule.rawLocation.columnNumber); 137 this._selectItemCallback(lineNumber, rule.rawLocation.columnNumber);
150 }, 138 },
151 139
152 __proto__: WebInspector.SelectionDialogContentProvider.prototype 140 __proto__: WebInspector.SelectionDialogContentProvider.prototype
153 } 141 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/CSSStyleModel.js ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698