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