| 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 * @param {!WebInspector.Setting} widthSetting | 9 * @param {!WebInspector.Setting} widthSetting |
| 10 */ | 10 */ |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 | 255 |
| 256 if (markers.length !== this._lastReportedCount) { | 256 if (markers.length !== this._lastReportedCount) { |
| 257 this._lastReportedCount = markers.length; | 257 this._lastReportedCount = markers.length; |
| 258 this.dispatchEventToListeners(WebInspector.MediaQueryInspector.Event
s.CountUpdated, markers.length); | 258 this.dispatchEventToListeners(WebInspector.MediaQueryInspector.Event
s.CountUpdated, markers.length); |
| 259 } | 259 } |
| 260 | 260 |
| 261 if (!this.isShowing()) | 261 if (!this.isShowing()) |
| 262 return; | 262 return; |
| 263 | 263 |
| 264 var oldChildrenCount = this.contentElement.children.length; | 264 var oldChildrenCount = this.contentElement.children.length; |
| 265 var scrollTop = this.contentElement.scrollTop; | |
| 266 this.contentElement.removeChildren(); | 265 this.contentElement.removeChildren(); |
| 267 | 266 |
| 268 var container = null; | 267 var container = null; |
| 269 for (var i = 0; i < markers.length; ++i) { | 268 for (var i = 0; i < markers.length; ++i) { |
| 270 if (!i || markers[i].model.section() !== markers[i - 1].model.sectio
n()) | 269 if (!i || markers[i].model.section() !== markers[i - 1].model.sectio
n()) |
| 271 container = this.contentElement.createChild("div", "media-inspec
tor-marker-container"); | 270 container = this.contentElement.createChild("div", "media-inspec
tor-marker-container"); |
| 272 var marker = markers[i]; | 271 var marker = markers[i]; |
| 273 var bar = this._createElementFromMediaQueryModel(marker.model); | 272 var bar = this._createElementFromMediaQueryModel(marker.model); |
| 274 bar._model = marker.model; | 273 bar._model = marker.model; |
| 275 bar._locations = marker.locations; | 274 bar._locations = marker.locations; |
| 276 bar.classList.toggle("media-inspector-marker-inactive", !marker.acti
ve); | 275 bar.classList.toggle("media-inspector-marker-inactive", !marker.acti
ve); |
| 277 container.appendChild(bar); | 276 container.appendChild(bar); |
| 278 } | 277 } |
| 279 this.contentElement.scrollTop = scrollTop; | |
| 280 }, | 278 }, |
| 281 | 279 |
| 282 /** | 280 /** |
| 283 * @return {number} | 281 * @return {number} |
| 284 */ | 282 */ |
| 285 _zoomFactor: function() | 283 _zoomFactor: function() |
| 286 { | 284 { |
| 287 return WebInspector.zoomManager.zoomFactor() / this._scale; | 285 return WebInspector.zoomManager.zoomFactor() / this._scale; |
| 288 }, | 286 }, |
| 289 | 287 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 }, | 482 }, |
| 485 | 483 |
| 486 /** | 484 /** |
| 487 * @return {boolean} | 485 * @return {boolean} |
| 488 */ | 486 */ |
| 489 active: function() | 487 active: function() |
| 490 { | 488 { |
| 491 return this._active; | 489 return this._active; |
| 492 } | 490 } |
| 493 } | 491 } |
| OLD | NEW |