| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * @extends {WebInspector.Widget} | 7 * @extends {WebInspector.Widget} |
| 8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
| 9 */ | 9 */ |
| 10 WebInspector.MediaQueryInspector = function() | 10 WebInspector.MediaQueryInspector = function() |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 WebInspector.Revealer.reveal(location); | 168 WebInspector.Revealer.reveal(location); |
| 169 }, | 169 }, |
| 170 | 170 |
| 171 _scheduleMediaQueriesUpdate: function() | 171 _scheduleMediaQueriesUpdate: function() |
| 172 { | 172 { |
| 173 if (!this._enabled) | 173 if (!this._enabled) |
| 174 return; | 174 return; |
| 175 this._mediaThrottler.schedule(this._refetchMediaQueries.bind(this)); | 175 this._mediaThrottler.schedule(this._refetchMediaQueries.bind(this)); |
| 176 }, | 176 }, |
| 177 | 177 |
| 178 /** | 178 _refetchMediaQueries: function() |
| 179 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | |
| 180 */ | |
| 181 _refetchMediaQueries: function(finishCallback) | |
| 182 { | 179 { |
| 183 if (!this._enabled || !this._cssModel) { | 180 if (!this._enabled || !this._cssModel) |
| 184 finishCallback(); | 181 return Promise.resolve(); |
| 185 return; | |
| 186 } | |
| 187 | 182 |
| 188 this._cssModel.mediaQueriesPromise() | 183 return this._cssModel.mediaQueriesPromise() |
| 189 .then(this._rebuildMediaQueries.bind(this)) | 184 .then(this._rebuildMediaQueries.bind(this)) |
| 190 .then(finishCallback) | |
| 191 .catch(finishCallback); | |
| 192 }, | 185 }, |
| 193 | 186 |
| 194 /** | 187 /** |
| 195 * @param {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} mod
els | 188 * @param {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} mod
els |
| 196 * @return {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} | 189 * @return {!Array.<!WebInspector.MediaQueryInspector.MediaQueryUIModel>} |
| 197 */ | 190 */ |
| 198 _squashAdjacentEqual: function(models) | 191 _squashAdjacentEqual: function(models) |
| 199 { | 192 { |
| 200 var filtered = []; | 193 var filtered = []; |
| 201 for (var i = 0; i < models.length; ++i) { | 194 for (var i = 0; i < models.length; ++i) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 }, | 494 }, |
| 502 | 495 |
| 503 /** | 496 /** |
| 504 * @return {boolean} | 497 * @return {boolean} |
| 505 */ | 498 */ |
| 506 active: function() | 499 active: function() |
| 507 { | 500 { |
| 508 return this._active; | 501 return this._active; |
| 509 } | 502 } |
| 510 } | 503 } |
| OLD | NEW |