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 * @implements {WebInspector.TargetManager.Observer} | 9 * @implements {WebInspector.TargetManager.Observer} |
10 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder | 10 * @param {!WebInspector.InspectedPagePlaceholder} inspectedPagePlaceholder |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 var deviceScaleFactor = window.devicePixelRatio; | 277 var deviceScaleFactor = window.devicePixelRatio; |
278 canvas.width = deviceScaleFactor * cssCanvasWidth; | 278 canvas.width = deviceScaleFactor * cssCanvasWidth; |
279 canvas.height = deviceScaleFactor * cssCanvasHeight; | 279 canvas.height = deviceScaleFactor * cssCanvasHeight; |
280 context.scale(canvas.width / dipCanvasWidth, canvas.height / dipCanvasHe
ight); | 280 context.scale(canvas.width / dipCanvasWidth, canvas.height / dipCanvasHe
ight); |
281 context.font = "11px " + WebInspector.fontFamily(); | 281 context.font = "11px " + WebInspector.fontFamily(); |
282 | 282 |
283 const backgroundColor = "rgb(102, 102, 102)"; | 283 const backgroundColor = "rgb(102, 102, 102)"; |
284 const lightLineColor = "rgb(132, 132, 132)"; | 284 const lightLineColor = "rgb(132, 132, 132)"; |
285 const darkLineColor = "rgb(114, 114, 114)"; | 285 const darkLineColor = "rgb(114, 114, 114)"; |
286 const rulerColor = "rgb(125, 125, 125)"; | 286 const rulerColor = "rgb(125, 125, 125)"; |
287 const rulerOverlayColor = "rgba(255, 255, 255, 0.4)"; | 287 const rulerOverlayColor = "rgba(255, 255, 255, 0.2)"; |
288 const textColor = "rgb(186, 186, 186)"; | 288 const textColor = "rgb(186, 186, 186)"; |
289 const contentsSizeColor = "rgba(0, 0, 0, 0.3)"; | 289 const contentsSizeColor = "rgba(0, 0, 0, 0.3)"; |
290 | 290 |
291 var scale = (this._scale || 1) * this._viewport.pageScaleFactor; | 291 var scale = (this._scale || 1) * this._viewport.pageScaleFactor; |
292 var rulerScale = 0.5; | 292 var rulerScale = 0.5; |
293 while (Math.abs(rulerScale * scale - 1) > Math.abs((rulerScale + 0.5) *
scale - 1)) | 293 while (Math.abs(rulerScale * scale - 1) > Math.abs((rulerScale + 0.5) *
scale - 1)) |
294 rulerScale += 0.5; | 294 rulerScale += 0.5; |
295 | 295 |
296 var gridStep = 50 * scale * rulerScale; | 296 var gridStep = 50 * scale * rulerScale; |
297 var gridSubStep = 10 * scale * rulerScale; | 297 var gridSubStep = 10 * scale * rulerScale; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 this._mediaInspector.setAxisTransform(this._viewport.scrollX, this._scal
e * this._viewport.pageScaleFactor); | 466 this._mediaInspector.setAxisTransform(this._viewport.scrollX, this._scal
e * this._viewport.pageScaleFactor); |
467 | 467 |
468 if (this._cachedZoomFactor !== zoomFactor || this._cachedMediaInspectorH
eight !== mediaInspectorHeight) { | 468 if (this._cachedZoomFactor !== zoomFactor || this._cachedMediaInspectorH
eight !== mediaInspectorHeight) { |
469 var cssRulerWidth = WebInspector.ResponsiveDesignView.RulerWidth / z
oomFactor + "px"; | 469 var cssRulerWidth = WebInspector.ResponsiveDesignView.RulerWidth / z
oomFactor + "px"; |
470 var cssRulerHeight = WebInspector.ResponsiveDesignView.RulerHeight /
zoomFactor + "px"; | 470 var cssRulerHeight = WebInspector.ResponsiveDesignView.RulerHeight /
zoomFactor + "px"; |
471 var cssCanvasOffset = rulerTotalHeight / zoomFactor + mediaInspector
Height + "px"; | 471 var cssCanvasOffset = rulerTotalHeight / zoomFactor + mediaInspector
Height + "px"; |
472 this._slidersContainer.style.left = cssRulerWidth; | 472 this._slidersContainer.style.left = cssRulerWidth; |
473 this._slidersContainer.style.top = cssCanvasOffset; | 473 this._slidersContainer.style.top = cssCanvasOffset; |
474 this._warningMessage.style.height = cssRulerHeight; | 474 this._warningMessage.style.height = cssRulerHeight; |
475 this._mediaInspectorContainer.style.left = cssRulerWidth; | 475 this._mediaInspectorContainer.style.left = cssRulerWidth; |
476 this._mediaInspectorContainer.style.top = cssRulerHeight; | 476 this._mediaInspectorContainer.style.marginTop = cssRulerHeight; |
477 | 477 |
478 var cssSliderWidth = WebInspector.ResponsiveDesignView.SliderWidth /
zoomFactor + "px"; | 478 var cssSliderWidth = WebInspector.ResponsiveDesignView.SliderWidth /
zoomFactor + "px"; |
479 this._heightSliderContainer.style.flexBasis = cssSliderWidth; | 479 this._heightSliderContainer.style.flexBasis = cssSliderWidth; |
480 this._heightSliderContainer.style.marginBottom = "-" + cssSliderWidt
h; | 480 this._heightSliderContainer.style.marginBottom = "-" + cssSliderWidt
h; |
481 this._widthSliderContainer.style.flexBasis = cssSliderWidth; | 481 this._widthSliderContainer.style.flexBasis = cssSliderWidth; |
482 this._widthSliderContainer.style.marginRight = "-" + cssSliderWidth; | 482 this._widthSliderContainer.style.marginRight = "-" + cssSliderWidth; |
483 } | 483 } |
484 | 484 |
485 var cssWidth = (this._dipWidth ? this._dipWidth : availableDip.width) /
zoomFactor; | 485 var cssWidth = (this._dipWidth ? this._dipWidth : availableDip.width) /
zoomFactor; |
486 var cssHeight = (this._dipHeight ? this._dipHeight : availableDip.height
) / zoomFactor; | 486 var cssHeight = (this._dipHeight ? this._dipHeight : availableDip.height
) / zoomFactor; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 value = Math.min(this._viewport.maximumPageScaleFactor, value); | 743 value = Math.min(this._viewport.maximumPageScaleFactor, value); |
744 value = Math.max(this._viewport.minimumPageScaleFactor, value) | 744 value = Math.max(this._viewport.minimumPageScaleFactor, value) |
745 this._target.pageAgent().setPageScaleFactor(value); | 745 this._target.pageAgent().setPageScaleFactor(value); |
746 } | 746 } |
747 finishCallback(); | 747 finishCallback(); |
748 } | 748 } |
749 }, | 749 }, |
750 | 750 |
751 __proto__: WebInspector.VBox.prototype | 751 __proto__: WebInspector.VBox.prototype |
752 }; | 752 }; |
OLD | NEW |