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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 this._pendingPageContainerImage = this._pageContainerImage.createChild("
img", "responsive-design-page-container-image hidden"); | 90 this._pendingPageContainerImage = this._pageContainerImage.createChild("
img", "responsive-design-page-container-image hidden"); |
91 | 91 |
92 // Page scale controls. | 92 // Page scale controls. |
93 this._pageScaleContainer = this._canvasContainer.element.createChild("di
v", "hbox responsive-design-page-scale-container"); | 93 this._pageScaleContainer = this._canvasContainer.element.createChild("di
v", "hbox responsive-design-page-scale-container"); |
94 this._decreasePageScaleButton = this._pageScaleContainer.createChild("bu
tton", "responsive-design-page-scale-button responsive-design-page-scale-decreas
e"); | 94 this._decreasePageScaleButton = this._pageScaleContainer.createChild("bu
tton", "responsive-design-page-scale-button responsive-design-page-scale-decreas
e"); |
95 this._decreasePageScaleButton.createChild("div", "glyph"); | 95 this._decreasePageScaleButton.createChild("div", "glyph"); |
96 this._decreasePageScaleButton.tabIndex = -1; | 96 this._decreasePageScaleButton.tabIndex = -1; |
97 this._decreasePageScaleButton.addEventListener("click", this._pageScaleB
uttonClicked.bind(this, false), false); | 97 this._decreasePageScaleButton.addEventListener("click", this._pageScaleB
uttonClicked.bind(this, false), false); |
98 | 98 |
99 this._pageScaleLabel = this._pageScaleContainer.createChild("label", "re
sponsive-design-page-scale-label"); | 99 this._pageScaleLabel = this._pageScaleContainer.createChild("label", "re
sponsive-design-page-scale-label"); |
100 WebInspector.Tooltip.install(this._pageScaleLabel, WebInspector.UIString
("Shift + drag to change page scale"), WebInspector.Tooltip.AlignmentOverride.Ri
ght); | 100 WebInspector.Tooltip.install(this._pageScaleLabel, WebInspector.UIString
("Shift + drag to change page scale")); |
101 this._pageScaleLabel.addEventListener("dblclick", this._resetPageScale.b
ind(this), false); | 101 this._pageScaleLabel.addEventListener("dblclick", this._resetPageScale.b
ind(this), false); |
102 | 102 |
103 this._increasePageScaleButton = this._pageScaleContainer.createChild("bu
tton", "responsive-design-page-scale-button responsive-design-page-scale-increas
e"); | 103 this._increasePageScaleButton = this._pageScaleContainer.createChild("bu
tton", "responsive-design-page-scale-button responsive-design-page-scale-increas
e"); |
104 this._increasePageScaleButton.tabIndex = -1; | 104 this._increasePageScaleButton.tabIndex = -1; |
105 this._increasePageScaleButton.createChild("div", "glyph"); | 105 this._increasePageScaleButton.createChild("div", "glyph"); |
106 this._increasePageScaleButton.addEventListener("click", this._pageScaleB
uttonClicked.bind(this, true), false); | 106 this._increasePageScaleButton.addEventListener("click", this._pageScaleB
uttonClicked.bind(this, true), false); |
107 | 107 |
108 this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.E
vents.CountUpdated, this._updateMediaQueryInspectorButton, this); | 108 this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.E
vents.CountUpdated, this._updateMediaQueryInspectorButton, this); |
109 this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.E
vents.HeightUpdated, this.onResize, this); | 109 this._mediaInspector.addEventListener(WebInspector.MediaQueryInspector.E
vents.HeightUpdated, this.onResize, this); |
110 this._overridesWarningUpdated(); | 110 this._overridesWarningUpdated(); |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 | 534 |
535 var canvasInvalidated = viewportChanged || this._drawContentsSize !== th
is._cachedDrawContentsSize || this._cachedScale !== this._scale || | 535 var canvasInvalidated = viewportChanged || this._drawContentsSize !== th
is._cachedDrawContentsSize || this._cachedScale !== this._scale || |
536 this._cachedCssCanvasWidth !== cssCanvasWidth || this._cachedCssCanv
asHeight !== cssCanvasHeight || this._cachedZoomFactor !== zoomFactor || | 536 this._cachedCssCanvasWidth !== cssCanvasWidth || this._cachedCssCanv
asHeight !== cssCanvasHeight || this._cachedZoomFactor !== zoomFactor || |
537 this._cachedMediaInspectorHeight !== mediaInspectorHeight; | 537 this._cachedMediaInspectorHeight !== mediaInspectorHeight; |
538 | 538 |
539 if (canvasInvalidated) | 539 if (canvasInvalidated) |
540 this._drawCanvas(cssCanvasWidth, cssCanvasHeight, rulerTotalHeight); | 540 this._drawCanvas(cssCanvasWidth, cssCanvasHeight, rulerTotalHeight); |
541 | 541 |
542 if (viewportChanged) { | 542 if (viewportChanged) { |
543 this._pageScaleLabel.textContent = WebInspector.UIString("%.1f", thi
s._viewport.pageScaleFactor); | 543 this._pageScaleLabel.textContent = WebInspector.UIString("%.1f", thi
s._viewport.pageScaleFactor); |
544 WebInspector.Tooltip.install(this._decreasePageScaleButton, WebInspe
ctor.UIString("Scale down (minimum %.1f)", this._viewport.minimumPageScaleFactor
), WebInspector.Tooltip.AlignmentOverride.Right); | 544 WebInspector.Tooltip.install(this._decreasePageScaleButton, WebInspe
ctor.UIString("Scale down (minimum %.1f)", this._viewport.minimumPageScaleFactor
)); |
545 this._decreasePageScaleButton.disabled = this._viewport.pageScaleFac
tor <= this._viewport.minimumPageScaleFactor; | 545 this._decreasePageScaleButton.disabled = this._viewport.pageScaleFac
tor <= this._viewport.minimumPageScaleFactor; |
546 WebInspector.Tooltip.install(this._increasePageScaleButton, WebInspe
ctor.UIString("Scale up (maximum %.1f)", this._viewport.maximumPageScaleFactor),
WebInspector.Tooltip.AlignmentOverride.Right); | 546 WebInspector.Tooltip.install(this._increasePageScaleButton, WebInspe
ctor.UIString("Scale up (maximum %.1f)", this._viewport.maximumPageScaleFactor))
; |
547 this._increasePageScaleButton.disabled = this._viewport.pageScaleFac
tor >= this._viewport.maximumPageScaleFactor; | 547 this._increasePageScaleButton.disabled = this._viewport.pageScaleFac
tor >= this._viewport.maximumPageScaleFactor; |
548 } | 548 } |
549 | 549 |
550 this._cachedScale = this._scale; | 550 this._cachedScale = this._scale; |
551 this._cachedCssCanvasWidth = cssCanvasWidth; | 551 this._cachedCssCanvasWidth = cssCanvasWidth; |
552 this._cachedCssCanvasHeight = cssCanvasHeight; | 552 this._cachedCssCanvasHeight = cssCanvasHeight; |
553 this._cachedCssHeight = cssHeight; | 553 this._cachedCssHeight = cssHeight; |
554 this._cachedCssWidth = cssWidth; | 554 this._cachedCssWidth = cssWidth; |
555 this._cachedDeviceInsets = deviceInsets; | 555 this._cachedDeviceInsets = deviceInsets; |
556 this._cachedZoomFactor = zoomFactor; | 556 this._cachedZoomFactor = zoomFactor; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 WebInspector.EmulationDispatcher.prototype = { | 875 WebInspector.EmulationDispatcher.prototype = { |
876 /** | 876 /** |
877 * @override | 877 * @override |
878 * @param {!EmulationAgent.Viewport=} viewport | 878 * @param {!EmulationAgent.Viewport=} viewport |
879 */ | 879 */ |
880 viewportChanged: function(viewport) | 880 viewportChanged: function(viewport) |
881 { | 881 { |
882 this._responsiveDesignView._viewportChanged(viewport); | 882 this._responsiveDesignView._viewportChanged(viewport); |
883 } | 883 } |
884 } | 884 } |
OLD | NEW |