| 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.VBox} | 7 * @extends {WebInspector.VBox} |
| 8 * @implements {WebInspector.OverridesSupport.PageResizer} | 8 * @implements {WebInspector.OverridesSupport.PageResizer} |
| 9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder | 9 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder |
| 10 */ | 10 */ |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 canvas.height = deviceScaleFactor * cssCanvasHeight; | 231 canvas.height = deviceScaleFactor * cssCanvasHeight; |
| 232 context.scale(canvas.width / dipCanvasWidth, canvas.height / dipCanvasHe
ight); | 232 context.scale(canvas.width / dipCanvasWidth, canvas.height / dipCanvasHe
ight); |
| 233 context.font = "11px " + WebInspector.fontFamily(); | 233 context.font = "11px " + WebInspector.fontFamily(); |
| 234 | 234 |
| 235 const rulerBackgroundColor = "rgb(0, 0, 0)"; | 235 const rulerBackgroundColor = "rgb(0, 0, 0)"; |
| 236 const backgroundColor = "rgb(102, 102, 102)"; | 236 const backgroundColor = "rgb(102, 102, 102)"; |
| 237 const lightLineColor = "rgb(132, 132, 132)"; | 237 const lightLineColor = "rgb(132, 132, 132)"; |
| 238 const darkLineColor = "rgb(114, 114, 114)"; | 238 const darkLineColor = "rgb(114, 114, 114)"; |
| 239 const rulerColor = "rgb(125, 125, 125)"; | 239 const rulerColor = "rgb(125, 125, 125)"; |
| 240 const textColor = "rgb(186, 186, 186)"; | 240 const textColor = "rgb(186, 186, 186)"; |
| 241 const contentsSizeColor = "rgba(0, 0, 0, 0.3)"; | 241 const contentsSizeColor = "rgba(128, 128, 128, 0.5)"; |
| 242 | 242 |
| 243 var scale = (this._scale || 1) * this._viewport.pageScaleFactor; | 243 var scale = (this._scale || 1) * this._viewport.pageScaleFactor; |
| 244 var rulerScale = 0.5; | 244 var rulerScale = 0.5; |
| 245 while (Math.abs(rulerScale * scale - 1) > Math.abs((rulerScale + 0.5) *
scale - 1)) | 245 while (Math.abs(rulerScale * scale - 1) > Math.abs((rulerScale + 0.5) *
scale - 1)) |
| 246 rulerScale += 0.5; | 246 rulerScale += 0.5; |
| 247 | 247 |
| 248 var gridStep = 50 * scale * rulerScale; | 248 var gridStep = 50 * scale * rulerScale; |
| 249 var gridSubStep = 10 * scale * rulerScale; | 249 var gridSubStep = 10 * scale * rulerScale; |
| 250 | 250 |
| 251 var rulerSubStep = 5 * scale * rulerScale; | 251 var rulerSubStep = 5 * scale * rulerScale; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 context.moveTo(0, y); | 362 context.moveTo(0, y); |
| 363 context.lineTo(dipGridWidth, y); | 363 context.lineTo(dipGridWidth, y); |
| 364 context.stroke(); | 364 context.stroke(); |
| 365 } | 365 } |
| 366 context.restore(); | 366 context.restore(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 context.translate(-0.5, -0.5); | 369 context.translate(-0.5, -0.5); |
| 370 | 370 |
| 371 // Draw contents size. | 371 // Draw contents size. |
| 372 var pageScaleAvailable = WebInspector.overridesSupport.settings.emulateM
obile.get() || WebInspector.overridesSupport.settings.emulateTouch.get(); | 372 if (this._drawContentsSize) { |
| 373 if (this._drawContentsSize && pageScaleAvailable) { | |
| 374 context.fillStyle = contentsSizeColor; | 373 context.fillStyle = contentsSizeColor; |
| 375 var visibleContentsWidth = Math.max(0, Math.min(dipGridWidth, this._
viewport.contentsWidth * scale - dipScrollX)); | 374 var visibleContentsWidth = Math.max(0, Math.min(dipGridWidth, this._
viewport.contentsWidth * scale - dipScrollX)); |
| 376 var visibleContentsHeight = Math.max(0, Math.min(dipGridHeight, this
._viewport.contentsHeight * scale - dipScrollY)); | 375 var visibleContentsHeight = Math.max(0, Math.min(dipGridHeight, this
._viewport.contentsHeight * scale - dipScrollY)); |
| 377 context.fillRect(0, 0, visibleContentsWidth, visibleContentsHeight); | 376 context.fillRect(0, 0, visibleContentsWidth, visibleContentsHeight); |
| 378 } | 377 } |
| 379 }, | 378 }, |
| 380 | 379 |
| 381 _updateUI: function() | 380 _updateUI: function() |
| 382 { | 381 { |
| 383 if (!this._enabled || !this.isShowing()) | 382 if (!this._enabled || !this.isShowing()) |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 * @param {!WebInspector.Throttler.FinishCallback} finishCallback | 605 * @param {!WebInspector.Throttler.FinishCallback} finishCallback |
| 607 */ | 606 */ |
| 608 _updateUIThrottled: function(finishCallback) | 607 _updateUIThrottled: function(finishCallback) |
| 609 { | 608 { |
| 610 this._updateUI(); | 609 this._updateUI(); |
| 611 finishCallback(); | 610 finishCallback(); |
| 612 }, | 611 }, |
| 613 | 612 |
| 614 __proto__: WebInspector.VBox.prototype | 613 __proto__: WebInspector.VBox.prototype |
| 615 }; | 614 }; |
| OLD | NEW |