Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.ContentProvider} | 7 * @implements {WebInspector.ContentProvider} |
| 8 * @param {!WebInspector.CSSModel} cssModel | 8 * @param {!WebInspector.CSSModel} cssModel |
| 9 * @param {!CSSAgent.CSSStyleSheetHeader} payload | 9 * @param {!CSSAgent.CSSStyleSheetHeader} payload |
| 10 */ | 10 */ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 resourceURL: function() | 70 resourceURL: function() |
| 71 { | 71 { |
| 72 return this.isViaInspector() ? this._viaInspectorResourceURL() : this.so urceURL; | 72 return this.isViaInspector() ? this._viaInspectorResourceURL() : this.so urceURL; |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 /** | 75 /** |
| 76 * @return {string} | 76 * @return {string} |
| 77 */ | 77 */ |
| 78 _viaInspectorResourceURL: function() | 78 _viaInspectorResourceURL: function() |
| 79 { | 79 { |
| 80 var frame = this._cssModel.target().resourceTreeModel.frameForId(this.fr ameId); | 80 var doc = this._cssModel.domModel().existingDocument(); |
|
pfeldman
2016/08/11 00:34:17
Depending on the iframe, these will be different d
eostroukhov-old
2016/08/17 01:09:02
Rewrote, assuming RTModel is always there.
| |
| 81 console.assert(frame); | 81 if (!doc) |
| 82 var parsedURL = new WebInspector.ParsedURL(frame.url); | 82 return ""; |
| 83 var parsedURL = new WebInspector.ParsedURL(doc.documentURL); | |
| 83 var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComp onents; | 84 var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComp onents; |
| 84 if (!fakeURL.endsWith("/")) | 85 if (!fakeURL.endsWith("/")) |
| 85 fakeURL += "/"; | 86 fakeURL += "/"; |
| 86 fakeURL += "inspector-stylesheet"; | 87 fakeURL += "inspector-stylesheet"; |
| 87 return fakeURL; | 88 return fakeURL; |
| 88 }, | 89 }, |
| 89 | 90 |
| 90 /** | 91 /** |
| 91 * @param {number} lineNumberInStyleSheet | 92 * @param {number} lineNumberInStyleSheet |
| 92 * @return {number} | 93 * @return {number} |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 */ | 213 */ |
| 213 function performSearch(content) | 214 function performSearch(content) |
| 214 { | 215 { |
| 215 var searchResults = content ? WebInspector.ContentProvider.performSe archInContent(content, query, caseSensitive, isRegex) : []; | 216 var searchResults = content ? WebInspector.ContentProvider.performSe archInContent(content, query, caseSensitive, isRegex) : []; |
| 216 callback(searchResults); | 217 callback(searchResults); |
| 217 } | 218 } |
| 218 | 219 |
| 219 this.requestContent().then(performSearch); | 220 this.requestContent().then(performSearch); |
| 220 } | 221 } |
| 221 } | 222 } |
| OLD | NEW |