| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 this._heightSlider = this._heightSliderContainer.createChild("div", "respons
ive-design-slider-thumb"); | 44 this._heightSlider = this._heightSliderContainer.createChild("div", "respons
ive-design-slider-thumb"); |
| 45 this._heightSlider.createChild("div", "responsive-design-thumb-handle"); | 45 this._heightSlider.createChild("div", "responsive-design-thumb-handle"); |
| 46 this._createResizer(this._heightSlider, true); | 46 this._createResizer(this._heightSlider, true); |
| 47 | 47 |
| 48 this._inspectedPagePlaceholder = inspectedPagePlaceholder; | 48 this._inspectedPagePlaceholder = inspectedPagePlaceholder; |
| 49 inspectedPagePlaceholder.show(this.element); | 49 inspectedPagePlaceholder.show(this.element); |
| 50 | 50 |
| 51 this._enabled = false; | 51 this._enabled = false; |
| 52 | 52 |
| 53 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo
omChanged, this._onZoomChanged, this); | 53 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo
omChanged, this._onZoomChanged, this); |
| 54 WebInspector.overridesSupport.settings.emulationEnabled.addChangeListener(th
is._emulationEnabledChanged, this); | 54 WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport
.Events.EmulationStateChanged, this._emulationEnabledChanged, this); |
| 55 this._emulationEnabledChanged(); | 55 this._emulationEnabledChanged(); |
| 56 this._overridesWarningUpdated(); | 56 this._overridesWarningUpdated(); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 // Measured in DIP. | 59 // Measured in DIP. |
| 60 WebInspector.ResponsiveDesignView.SliderWidth = 19; | 60 WebInspector.ResponsiveDesignView.SliderWidth = 19; |
| 61 WebInspector.ResponsiveDesignView.RulerWidth = 22; | 61 WebInspector.ResponsiveDesignView.RulerWidth = 22; |
| 62 | 62 |
| 63 WebInspector.ResponsiveDesignView.prototype = { | 63 WebInspector.ResponsiveDesignView.prototype = { |
| 64 _invalidateCache: function() | 64 _invalidateCache: function() |
| 65 { | 65 { |
| 66 delete this._cachedScale; | 66 delete this._cachedScale; |
| 67 delete this._cachedCssCanvasWidth; | 67 delete this._cachedCssCanvasWidth; |
| 68 delete this._cachedCssCanvasHeight; | 68 delete this._cachedCssCanvasHeight; |
| 69 delete this._cachedCssHeight; | 69 delete this._cachedCssHeight; |
| 70 delete this._cachedCssWidth; | 70 delete this._cachedCssWidth; |
| 71 delete this._cachedZoomFactor; | 71 delete this._cachedZoomFactor; |
| 72 delete this._availableSize; | 72 delete this._availableSize; |
| 73 }, | 73 }, |
| 74 | 74 |
| 75 _emulationEnabledChanged: function() | 75 _emulationEnabledChanged: function() |
| 76 { | 76 { |
| 77 var enabled = WebInspector.overridesSupport.settings.emulationEnabled.ge
t(); | 77 var enabled = WebInspector.overridesSupport.emulationEnabled(); |
| 78 if (enabled && !this._enabled) { | 78 if (enabled && !this._enabled) { |
| 79 this._invalidateCache(); | 79 this._invalidateCache(); |
| 80 this._ignoreResize = true; | 80 this._ignoreResize = true; |
| 81 this._enabled = true; | 81 this._enabled = true; |
| 82 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); | 82 this._inspectedPagePlaceholder.clearMinimumSizeAndMargins(); |
| 83 this._inspectedPagePlaceholder.show(this._pageContainer); | 83 this._inspectedPagePlaceholder.show(this._pageContainer); |
| 84 this._responsiveDesignContainer.show(this.element); | 84 this._responsiveDesignContainer.show(this.element); |
| 85 this.update(this._dipWidth || 0, this._dipHeight || 0, this._scale |
| 0); | 85 this.update(this._dipWidth || 0, this._dipHeight || 0, this._scale |
| 0); |
| 86 delete this._ignoreResize; | 86 delete this._ignoreResize; |
| 87 } else if (!enabled && this._enabled) { | 87 } else if (!enabled && this._enabled) { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 this.onResize(); | 469 this.onResize(); |
| 470 }, | 470 }, |
| 471 | 471 |
| 472 _showEmulationInDrawer: function() | 472 _showEmulationInDrawer: function() |
| 473 { | 473 { |
| 474 WebInspector.overridesSupport.reveal(); | 474 WebInspector.overridesSupport.reveal(); |
| 475 }, | 475 }, |
| 476 | 476 |
| 477 __proto__: WebInspector.VBox.prototype | 477 __proto__: WebInspector.VBox.prototype |
| 478 }; | 478 }; |
| OLD | NEW |