Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/emulation/SensorsView.js

Issue 2875193002: DevTools: update text inputs to new style (Closed)
Patch Set: ac Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 Emulation.SensorsView = class extends UI.VBox { 7 Emulation.SensorsView = class extends UI.VBox {
8 constructor() { 8 constructor() {
9 super(true); 9 super(true);
10 this.registerRequiredCSS('emulation/sensors.css'); 10 this.registerRequiredCSS('emulation/sensors.css');
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 this._locationSelectElement.addEventListener('change', this._geolocationSele ctChanged.bind(this)); 69 this._locationSelectElement.addEventListener('change', this._geolocationSele ctChanged.bind(this));
70 70
71 // Validated input fieldset. 71 // Validated input fieldset.
72 this._fieldsetElement = fields.createChild('fieldset'); 72 this._fieldsetElement = fields.createChild('fieldset');
73 this._fieldsetElement.disabled = !this._geolocationOverrideEnabled; 73 this._fieldsetElement.disabled = !this._geolocationOverrideEnabled;
74 this._fieldsetElement.id = 'geolocation-override-section'; 74 this._fieldsetElement.id = 'geolocation-override-section';
75 75
76 var latitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group' ); 76 var latitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group' );
77 var longitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group '); 77 var longitudeGroup = this._fieldsetElement.createChild('div', 'latlong-group ');
78 78
79 this._latitudeInput = latitudeGroup.createChild('input'); 79 this._latitudeInput = UI.createInput('', 'number');
80 latitudeGroup.appendChild(this._latitudeInput);
80 this._latitudeInput.setAttribute('step', 'any'); 81 this._latitudeInput.setAttribute('step', 'any');
81 this._latitudeInput.setAttribute('type', 'number');
82 this._latitudeInput.value = 0; 82 this._latitudeInput.value = 0;
83 this._latitudeSetter = UI.bindInput( 83 this._latitudeSetter = UI.bindInput(
84 this._latitudeInput, this._applyGeolocationUserInput.bind(this), 84 this._latitudeInput, this._applyGeolocationUserInput.bind(this),
85 SDK.EmulationModel.Geolocation.latitudeValidator, true); 85 SDK.EmulationModel.Geolocation.latitudeValidator, true);
86 this._latitudeSetter(String(geolocation.latitude)); 86 this._latitudeSetter(String(geolocation.latitude));
87 87
88 this._longitudeInput = longitudeGroup.createChild('input'); 88 this._longitudeInput = UI.createInput('', 'number');
89 longitudeGroup.appendChild(this._longitudeInput);
89 this._longitudeInput.setAttribute('step', 'any'); 90 this._longitudeInput.setAttribute('step', 'any');
90 this._longitudeInput.setAttribute('type', 'number');
91 this._longitudeInput.value = 0; 91 this._longitudeInput.value = 0;
92 this._longitudeSetter = UI.bindInput( 92 this._longitudeSetter = UI.bindInput(
93 this._longitudeInput, this._applyGeolocationUserInput.bind(this), 93 this._longitudeInput, this._applyGeolocationUserInput.bind(this),
94 SDK.EmulationModel.Geolocation.longitudeValidator, true); 94 SDK.EmulationModel.Geolocation.longitudeValidator, true);
95 this._longitudeSetter(String(geolocation.longitude)); 95 this._longitudeSetter(String(geolocation.longitude));
96 96
97 latitudeGroup.createChild('div', 'latlong-title').textContent = Common.UIStr ing('Latitude'); 97 latitudeGroup.createChild('div', 'latlong-title').textContent = Common.UIStr ing('Latitude');
98 longitudeGroup.createChild('div', 'latlong-title').textContent = Common.UISt ring('Longitude'); 98 longitudeGroup.createChild('div', 'latlong-title').textContent = Common.UISt ring('Longitude');
99 } 99 }
100 100
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 305
306 /** 306 /**
307 * @param {!SDK.EmulationModel.DeviceOrientation} deviceOrientation 307 * @param {!SDK.EmulationModel.DeviceOrientation} deviceOrientation
308 * @return {!Element} 308 * @return {!Element}
309 */ 309 */
310 _createDeviceOrientationOverrideElement(deviceOrientation) { 310 _createDeviceOrientationOverrideElement(deviceOrientation) {
311 var fieldsetElement = createElement('fieldset'); 311 var fieldsetElement = createElement('fieldset');
312 fieldsetElement.classList.add('device-orientation-override-section'); 312 fieldsetElement.classList.add('device-orientation-override-section');
313 var cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell '); 313 var cellElement = fieldsetElement.createChild('td', 'orientation-inputs-cell ');
314 314
315 this._alphaElement = createElement('input'); 315 this._alphaElement = UI.createInput();
316 this._alphaElement.setAttribute('step', 'any'); 316 this._alphaElement.setAttribute('step', 'any');
317 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElement, C ommon.UIString('\u03B1 (alpha)')); 317 this._alphaSetter = this._createAxisInput(cellElement, this._alphaElement, C ommon.UIString('\u03B1 (alpha)'));
318 this._alphaSetter(String(deviceOrientation.alpha)); 318 this._alphaSetter(String(deviceOrientation.alpha));
319 319
320 this._betaElement = createElement('input'); 320 this._betaElement = UI.createInput();
321 this._betaElement.setAttribute('step', 'any'); 321 this._betaElement.setAttribute('step', 'any');
322 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, Com mon.UIString('\u03B2 (beta)')); 322 this._betaSetter = this._createAxisInput(cellElement, this._betaElement, Com mon.UIString('\u03B2 (beta)'));
323 this._betaSetter(String(deviceOrientation.beta)); 323 this._betaSetter(String(deviceOrientation.beta));
324 324
325 this._gammaElement = createElement('input'); 325 this._gammaElement = UI.createInput();
326 this._gammaElement.setAttribute('step', 'any'); 326 this._gammaElement.setAttribute('step', 'any');
327 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, C ommon.UIString('\u03B3 (gamma)')); 327 this._gammaSetter = this._createAxisInput(cellElement, this._gammaElement, C ommon.UIString('\u03B3 (gamma)'));
328 this._gammaSetter(String(deviceOrientation.gamma)); 328 this._gammaSetter(String(deviceOrientation.gamma));
329 329
330 cellElement.appendChild(UI.createTextButton( 330 cellElement.appendChild(UI.createTextButton(
331 Common.UIString('Reset'), this._resetDeviceOrientation.bind(this), 'orie ntation-reset-button')); 331 Common.UIString('Reset'), this._resetDeviceOrientation.bind(this), 'orie ntation-reset-button'));
332 return fieldsetElement; 332 return fieldsetElement;
333 } 333 }
334 334
335 /** 335 /**
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 * @param {string} actionId 502 * @param {string} actionId
503 * @return {boolean} 503 * @return {boolean}
504 */ 504 */
505 handleAction(context, actionId) { 505 handleAction(context, actionId) {
506 UI.viewManager.showView('sensors'); 506 UI.viewManager.showView('sensors');
507 return true; 507 return true;
508 } 508 }
509 }; 509 };
510 510
511 Emulation.SensorsView.ShiftDragOrientationSpeed = 16; 511 Emulation.SensorsView.ShiftDragOrientationSpeed = 16;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698