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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 _availableDipSize: function() | 181 _availableDipSize: function() |
182 { | 182 { |
183 if (typeof this._availableSize === "undefined") { | 183 if (typeof this._availableSize === "undefined") { |
184 var zoomFactor = WebInspector.zoomManager.zoomFactor(); | 184 var zoomFactor = WebInspector.zoomManager.zoomFactor(); |
185 var rect = this._canvasContainer.element.getBoundingClientRect(); | 185 var rect = this._canvasContainer.element.getBoundingClientRect(); |
186 var mediaInspectorHeight = this._mediaInspector.element.offsetHeight ; | 186 var mediaInspectorHeight = this._mediaInspector.element.offsetHeight ; |
187 if (mediaInspectorHeight) | 187 if (mediaInspectorHeight) |
188 mediaInspectorHeight += WebInspector.ResponsiveDesignView.RulerB ottomHeight; | 188 mediaInspectorHeight += WebInspector.ResponsiveDesignView.RulerB ottomHeight; |
189 this._availableSize = new Size(Math.max(rect.width * zoomFactor - We bInspector.ResponsiveDesignView.RulerWidth, 1), | 189 this._availableSize = new Size(Math.max(rect.width * zoomFactor - We bInspector.ResponsiveDesignView.RulerWidth, 1), |
190 Math.max(rect.height * zoomFactor - m ediaInspectorHeight - WebInspector.ResponsiveDesignView.RulerHeight, 1)); | 190 Math.max(rect.height * zoomFactor - m ediaInspectorHeight - WebInspector.ResponsiveDesignView.RulerHeight, 1)); |
191 | |
dgozman
2014/09/09 14:46:49
nit: remove this extra line.
pbakaus
2014/09/10 11:18:15
Done.
| |
191 } | 192 } |
192 return this._availableSize; | 193 return this._availableSize; |
193 }, | 194 }, |
194 | 195 |
195 /** | 196 /** |
196 * @param {!Element} element | 197 * @param {!Element} element |
197 * @param {boolean} vertical | 198 * @param {boolean} vertical |
198 * @return {!WebInspector.ResizerWidget} | 199 * @return {!WebInspector.ResizerWidget} |
199 */ | 200 */ |
200 _createResizer: function(element, vertical) | 201 _createResizer: function(element, vertical) |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 var deviceScaleFactor = window.devicePixelRatio; | 278 var deviceScaleFactor = window.devicePixelRatio; |
278 canvas.width = deviceScaleFactor * cssCanvasWidth; | 279 canvas.width = deviceScaleFactor * cssCanvasWidth; |
279 canvas.height = deviceScaleFactor * cssCanvasHeight; | 280 canvas.height = deviceScaleFactor * cssCanvasHeight; |
280 context.scale(canvas.width / dipCanvasWidth, canvas.height / dipCanvasHe ight); | 281 context.scale(canvas.width / dipCanvasWidth, canvas.height / dipCanvasHe ight); |
281 context.font = "11px " + WebInspector.fontFamily(); | 282 context.font = "11px " + WebInspector.fontFamily(); |
282 | 283 |
283 const backgroundColor = "rgb(102, 102, 102)"; | 284 const backgroundColor = "rgb(102, 102, 102)"; |
284 const lightLineColor = "rgb(132, 132, 132)"; | 285 const lightLineColor = "rgb(132, 132, 132)"; |
285 const darkLineColor = "rgb(114, 114, 114)"; | 286 const darkLineColor = "rgb(114, 114, 114)"; |
286 const rulerColor = "rgb(125, 125, 125)"; | 287 const rulerColor = "rgb(125, 125, 125)"; |
287 const rulerOverlayColor = "rgba(255, 255, 255, 0.4)"; | 288 const rulerOverlayColor = "rgba(255, 255, 255, 0.2)"; |
288 const textColor = "rgb(186, 186, 186)"; | 289 const textColor = "rgb(186, 186, 186)"; |
289 const contentsSizeColor = "rgba(0, 0, 0, 0.3)"; | 290 const contentsSizeColor = "rgba(0, 0, 0, 0.3)"; |
290 | 291 |
291 var scale = (this._scale || 1) * this._viewport.pageScaleFactor; | 292 var scale = (this._scale || 1) * this._viewport.pageScaleFactor; |
292 var rulerScale = 0.5; | 293 var rulerScale = 0.5; |
293 while (Math.abs(rulerScale * scale - 1) > Math.abs((rulerScale + 0.5) * scale - 1)) | 294 while (Math.abs(rulerScale * scale - 1) > Math.abs((rulerScale + 0.5) * scale - 1)) |
294 rulerScale += 0.5; | 295 rulerScale += 0.5; |
295 | 296 |
296 var gridStep = 50 * scale * rulerScale; | 297 var gridStep = 50 * scale * rulerScale; |
297 var gridSubStep = 10 * scale * rulerScale; | 298 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); | 467 this._mediaInspector.setAxisTransform(this._viewport.scrollX, this._scal e * this._viewport.pageScaleFactor); |
467 | 468 |
468 if (this._cachedZoomFactor !== zoomFactor || this._cachedMediaInspectorH eight !== mediaInspectorHeight) { | 469 if (this._cachedZoomFactor !== zoomFactor || this._cachedMediaInspectorH eight !== mediaInspectorHeight) { |
469 var cssRulerWidth = WebInspector.ResponsiveDesignView.RulerWidth / z oomFactor + "px"; | 470 var cssRulerWidth = WebInspector.ResponsiveDesignView.RulerWidth / z oomFactor + "px"; |
470 var cssRulerHeight = WebInspector.ResponsiveDesignView.RulerHeight / zoomFactor + "px"; | 471 var cssRulerHeight = WebInspector.ResponsiveDesignView.RulerHeight / zoomFactor + "px"; |
471 var cssCanvasOffset = rulerTotalHeight / zoomFactor + mediaInspector Height + "px"; | 472 var cssCanvasOffset = rulerTotalHeight / zoomFactor + mediaInspector Height + "px"; |
472 this._slidersContainer.style.left = cssRulerWidth; | 473 this._slidersContainer.style.left = cssRulerWidth; |
473 this._slidersContainer.style.top = cssCanvasOffset; | 474 this._slidersContainer.style.top = cssCanvasOffset; |
474 this._warningMessage.style.height = cssRulerHeight; | 475 this._warningMessage.style.height = cssRulerHeight; |
475 this._mediaInspectorContainer.style.left = cssRulerWidth; | 476 this._mediaInspectorContainer.style.left = cssRulerWidth; |
476 this._mediaInspectorContainer.style.top = cssRulerHeight; | 477 this._mediaInspectorContainer.style.top = cssRulerHeight; |
dgozman
2014/09/09 14:46:49
I know this is not your change, but... If you set
pbakaus
2014/09/10 11:18:15
Good point, will address.
| |
477 | 478 |
478 var cssSliderWidth = WebInspector.ResponsiveDesignView.SliderWidth / zoomFactor + "px"; | 479 var cssSliderWidth = WebInspector.ResponsiveDesignView.SliderWidth / zoomFactor + "px"; |
479 this._heightSliderContainer.style.flexBasis = cssSliderWidth; | 480 this._heightSliderContainer.style.flexBasis = cssSliderWidth; |
480 this._heightSliderContainer.style.marginBottom = "-" + cssSliderWidt h; | 481 this._heightSliderContainer.style.marginBottom = "-" + cssSliderWidt h; |
481 this._widthSliderContainer.style.flexBasis = cssSliderWidth; | 482 this._widthSliderContainer.style.flexBasis = cssSliderWidth; |
482 this._widthSliderContainer.style.marginRight = "-" + cssSliderWidth; | 483 this._widthSliderContainer.style.marginRight = "-" + cssSliderWidth; |
483 } | 484 } |
484 | 485 |
485 var cssWidth = (this._dipWidth ? this._dipWidth : availableDip.width) / zoomFactor; | 486 var cssWidth = (this._dipWidth ? this._dipWidth : availableDip.width) / zoomFactor; |
486 var cssHeight = (this._dipHeight ? this._dipHeight : availableDip.height ) / zoomFactor; | 487 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); | 744 value = Math.min(this._viewport.maximumPageScaleFactor, value); |
744 value = Math.max(this._viewport.minimumPageScaleFactor, value) | 745 value = Math.max(this._viewport.minimumPageScaleFactor, value) |
745 this._target.pageAgent().setPageScaleFactor(value); | 746 this._target.pageAgent().setPageScaleFactor(value); |
746 } | 747 } |
747 finishCallback(); | 748 finishCallback(); |
748 } | 749 } |
749 }, | 750 }, |
750 | 751 |
751 __proto__: WebInspector.VBox.prototype | 752 __proto__: WebInspector.VBox.prototype |
752 }; | 753 }; |
OLD | NEW |