Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @param {!WebInspector.DeviceModeModel} model | 6 * @param {!WebInspector.DeviceModeModel} model |
| 7 * @param {!WebInspector.Setting} showMediaInspectorSetting | 7 * @param {!WebInspector.Setting} showMediaInspectorSetting |
| 8 * @param {!WebInspector.Setting} showRulersSetting | 8 * @param {!WebInspector.Setting} showRulersSetting |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * @param {!WebInspector.Toolbar} toolbar | 78 * @param {!WebInspector.Toolbar} toolbar |
| 79 */ | 79 */ |
| 80 _fillMainToolbar: function(toolbar) | 80 _fillMainToolbar: function(toolbar) |
| 81 { | 81 { |
| 82 var widthInput = createElementWithClass("input", "device-mode-size-input "); | 82 var widthInput = createElementWithClass("input", "device-mode-size-input "); |
| 83 widthInput.maxLength = 4; | 83 widthInput.maxLength = 4; |
| 84 widthInput.type = "text"; | 84 widthInput.type = "text"; |
| 85 widthInput.title = WebInspector.UIString("Width"); | 85 widthInput.title = WebInspector.UIString("Width"); |
| 86 this._updateWidthInput = WebInspector.bindInput(widthInput, applyWidth.b ind(this), WebInspector.DeviceModeModel.deviceSizeValidator, true); | 86 this._updateWidthInput = WebInspector.bindInput(widthInput, this._applyW idth.bind(this), WebInspector.DeviceModeModel.deviceSizeValidator, true); |
| 87 this._widthInput = widthInput; | 87 this._widthInput = widthInput; |
| 88 this._widthItem = this._wrapToolbarItem(widthInput); | 88 this._widthItem = this._wrapToolbarItem(widthInput); |
| 89 toolbar.appendToolbarItem(this._widthItem); | 89 toolbar.appendToolbarItem(this._widthItem); |
| 90 | 90 |
| 91 var xElement = createElementWithClass("div", "device-mode-x"); | 91 var xElement = createElementWithClass("div", "device-mode-x"); |
| 92 xElement.textContent = "\u00D7"; | 92 xElement.textContent = "\u00D7"; |
| 93 this._xItem = this._wrapToolbarItem(xElement); | 93 this._xItem = this._wrapToolbarItem(xElement); |
| 94 toolbar.appendToolbarItem(this._xItem); | 94 toolbar.appendToolbarItem(this._xItem); |
| 95 | 95 |
| 96 var heightInput = createElementWithClass("input", "device-mode-size-inpu t"); | 96 var heightInput = createElementWithClass("input", "device-mode-size-inpu t"); |
| 97 heightInput.maxLength = 4; | 97 heightInput.maxLength = 4; |
| 98 heightInput.type = "text"; | 98 heightInput.type = "text"; |
| 99 heightInput.title = WebInspector.UIString("Height (leave empty for full) "); | 99 heightInput.title = WebInspector.UIString("Height (leave empty for full) "); |
| 100 this._updateHeightInput = WebInspector.bindInput(heightInput, applyHeigh t.bind(this), validateHeight, true); | 100 this._updateHeightInput = WebInspector.bindInput(heightInput, this._appl yHeight.bind(this), validateHeight, true); |
| 101 this._heightInput = heightInput; | 101 this._heightInput = heightInput; |
| 102 this._heightItem = this._wrapToolbarItem(heightInput); | 102 this._heightItem = this._wrapToolbarItem(heightInput); |
| 103 toolbar.appendToolbarItem(this._heightItem); | 103 toolbar.appendToolbarItem(this._heightItem); |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * @param {string} value | 106 * @param {string} value |
| 107 * @return {boolean} | 107 * @return {boolean} |
| 108 */ | 108 */ |
| 109 function validateHeight(value) | 109 function validateHeight(value) |
| 110 { | 110 { |
| 111 return !value || WebInspector.DeviceModeModel.deviceSizeValidator(va lue); | 111 return !value || WebInspector.DeviceModeModel.deviceSizeValidator(va lue); |
| 112 } | 112 } |
| 113 | |
| 114 /** | |
| 115 * @param {string} value | |
| 116 * @this {WebInspector.DeviceModeToolbar} | |
| 117 */ | |
| 118 function applyWidth(value) | |
| 119 { | |
| 120 var width = value ? Number(value) : 0; | |
| 121 this._model.setWidthAndScaleToFit(width); | |
| 122 } | |
| 123 | |
| 124 /** | |
| 125 * @param {string} value | |
| 126 * @this {WebInspector.DeviceModeToolbar} | |
| 127 */ | |
| 128 function applyHeight(value) | |
| 129 { | |
| 130 var height = value ? Number(value) : 0; | |
| 131 this._model.setHeightAndScaleToFit(height); | |
| 132 } | |
| 133 }, | 113 }, |
| 134 | 114 |
| 135 /** | 115 /** |
| 116 * @param {string} value | |
| 117 * @this {WebInspector.DeviceModeToolbar} | |
|
dgozman
2016/10/26 18:35:22
Don't need @this annotations on prototype function
luoe
2016/10/26 18:56:51
Done.
| |
| 118 */ | |
| 119 _applyWidth: function(value) | |
| 120 { | |
| 121 var width = value ? Number(value) : 0; | |
| 122 this._model.setWidthAndScaleToFit(width); | |
| 123 }, | |
| 124 | |
| 125 /** | |
| 126 * @param {string} value | |
| 127 * @this {WebInspector.DeviceModeToolbar} | |
| 128 */ | |
| 129 _applyHeight: function(value) | |
| 130 { | |
| 131 var height = value ? Number(value) : 0; | |
| 132 this._model.setHeightAndScaleToFit(height); | |
| 133 }, | |
| 134 | |
| 135 /** | |
| 136 * @param {!WebInspector.Toolbar} toolbar | 136 * @param {!WebInspector.Toolbar} toolbar |
| 137 */ | 137 */ |
| 138 _fillRightToolbar: function(toolbar) | 138 _fillRightToolbar: function(toolbar) |
| 139 { | 139 { |
| 140 toolbar.appendToolbarItem(this._wrapToolbarItem(createElementWithClass(" div", "device-mode-empty-toolbar-element"))); | 140 toolbar.appendToolbarItem(this._wrapToolbarItem(createElementWithClass(" div", "device-mode-empty-toolbar-element"))); |
| 141 this._scaleItem = new WebInspector.ToolbarMenuButton(this._appendScaleMe nuItems.bind(this)); | 141 this._scaleItem = new WebInspector.ToolbarMenuButton(this._appendScaleMe nuItems.bind(this)); |
| 142 this._scaleItem.setTitle(WebInspector.UIString("Zoom")); | 142 this._scaleItem.setTitle(WebInspector.UIString("Zoom")); |
| 143 this._scaleItem.setGlyph(""); | 143 this._scaleItem.setGlyph(""); |
| 144 this._scaleItem.turnIntoSelect(); | 144 this._scaleItem.turnIntoSelect(); |
| 145 toolbar.appendToolbarItem(this._scaleItem); | 145 toolbar.appendToolbarItem(this._scaleItem); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 this._emulateDevice(device); | 580 this._emulateDevice(device); |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 | 586 |
| 587 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null); | 587 this._model.emulate(WebInspector.DeviceModeModel.Type.Responsive, null, null); |
| 588 } | 588 } |
| 589 }; | 589 }; |
| OLD | NEW |