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

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

Issue 1574213006: DevTools: beautified styles sidebar toolbar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 4 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.VBox} 7 * @extends {WebInspector.VBox}
8 */ 8 */
9 WebInspector.DeviceModeView = function() 9 WebInspector.DeviceModeView = function()
10 { 10 {
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 */ 342 */
343 WebInspector.DeviceModeView.Toolbar = function(model, showMediaInspectorSetting, showRulersSetting) 343 WebInspector.DeviceModeView.Toolbar = function(model, showMediaInspectorSetting, showRulersSetting)
344 { 344 {
345 this._model = model; 345 this._model = model;
346 this._showMediaInspectorSetting = showMediaInspectorSetting; 346 this._showMediaInspectorSetting = showMediaInspectorSetting;
347 this._showRulersSetting = showRulersSetting; 347 this._showRulersSetting = showRulersSetting;
348 /** @type {!Map<!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.M ode>} */ 348 /** @type {!Map<!WebInspector.EmulatedDevice, !WebInspector.EmulatedDevice.M ode>} */
349 this._lastMode = new Map(); 349 this._lastMode = new Map();
350 /** @type {?WebInspector.EmulatedDevice} */ 350 /** @type {?WebInspector.EmulatedDevice} */
351 this._lastDevice = null; 351 this._lastDevice = null;
352 /** @type {!Array<!WebInspector.ToolbarLabel>} */ 352 /** @type {!Array<!WebInspector.ToolbarButton>} */
353 this._appliedSizeItems = []; 353 this._appliedSizeItems = [];
354 /** @type {!Array<!WebInspector.ToolbarMenuButton>} */ 354 /** @type {!Array<!WebInspector.ToolbarMenuButton>} */
355 this._scaleItems = []; 355 this._scaleItems = [];
356 /** @type {?Element} */ 356 /** @type {?Element} */
357 this._visibleToolbar = null; 357 this._visibleToolbar = null;
358 358
359 this._element = createElementWithClass("div", "device-mode-toolbar"); 359 this._element = createElementWithClass("div", "device-mode-toolbar");
360 360
361 var leftContainer = this._element.createChild("div", "device-mode-toolbar-le ft"); 361 var leftContainer = this._element.createChild("div", "device-mode-toolbar-le ft");
362 var leftToolbar = new WebInspector.Toolbar("", leftContainer); 362 var leftToolbar = new WebInspector.Toolbar("", leftContainer);
(...skipping 10 matching lines...) Expand all
373 373
374 var middle = this._element.createChild("div", "device-mode-toolbar-middle-co ntainer"); 374 var middle = this._element.createChild("div", "device-mode-toolbar-middle-co ntainer");
375 this._noneToolbar = this._wrapMiddleToolbar(middle, this._createNoneToolbar( )); 375 this._noneToolbar = this._wrapMiddleToolbar(middle, this._createNoneToolbar( ));
376 this._responsiveToolbar = this._wrapMiddleToolbar(middle, this._createRespon siveToolbar()); 376 this._responsiveToolbar = this._wrapMiddleToolbar(middle, this._createRespon siveToolbar());
377 this._deviceToolbar = this._wrapMiddleToolbar(middle, this._createDeviceTool bar()); 377 this._deviceToolbar = this._wrapMiddleToolbar(middle, this._createDeviceTool bar());
378 378
379 var rightContainer = this._element.createChild("div", "device-mode-toolbar-r ight"); 379 var rightContainer = this._element.createChild("div", "device-mode-toolbar-r ight");
380 rightContainer.createChild("div", "device-mode-toolbar-spacer"); 380 rightContainer.createChild("div", "device-mode-toolbar-spacer");
381 var rightToolbar = new WebInspector.Toolbar("", rightContainer); 381 var rightToolbar = new WebInspector.Toolbar("", rightContainer);
382 rightToolbar.makeWrappable(true); 382 rightToolbar.makeWrappable(true);
383 this._uaItem = new WebInspector.ToolbarLabel(); 383 this._uaItem = new WebInspector.ToolbarText();
384 this._uaItem.setVisible(false); 384 this._uaItem.setVisible(false);
385 this._uaItem.setTitle(WebInspector.UIString("User agent type")); 385 this._uaItem.setTitle(WebInspector.UIString("User agent type"));
386 rightToolbar.appendToolbarItem(this._uaItem); 386 rightToolbar.appendToolbarItem(this._uaItem);
387 this._deviceScaleItem = new WebInspector.ToolbarLabel(); 387 this._deviceScaleItem = new WebInspector.ToolbarText();
388 this._deviceScaleItem.setVisible(false); 388 this._deviceScaleItem.setVisible(false);
389 this._deviceScaleItem.setTitle(WebInspector.UIString("Device pixel ratio")); 389 this._deviceScaleItem.setTitle(WebInspector.UIString("Device pixel ratio"));
390 rightToolbar.appendToolbarItem(this._deviceScaleItem); 390 rightToolbar.appendToolbarItem(this._deviceScaleItem);
391 rightToolbar.appendSeparator(); 391 rightToolbar.appendSeparator();
392 var moreOptionsButton = new WebInspector.ToolbarMenuButton(this._appendMenuI tems.bind(this)); 392 var moreOptionsButton = new WebInspector.ToolbarMenuButton(this._appendMenuI tems.bind(this));
393 moreOptionsButton.setTitle(WebInspector.UIString("More options")); 393 moreOptionsButton.setTitle(WebInspector.UIString("More options"));
394 rightToolbar.appendToolbarItem(moreOptionsButton); 394 rightToolbar.appendToolbarItem(moreOptionsButton);
395 395
396 this._persistenceSetting = WebInspector.settings.createSetting("emulation.de viceModeViewPersistence", {type: WebInspector.DeviceModeModel.Type.None, device: "", orientation: "", mode: ""}); 396 this._persistenceSetting = WebInspector.settings.createSetting("emulation.de viceModeViewPersistence", {type: WebInspector.DeviceModeModel.Type.None, device: "", orientation: "", mode: ""});
397 this._restored = false; 397 this._restored = false;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 this._appendScaleItem(toolbar); 555 this._appendScaleItem(toolbar);
556 556
557 return toolbar; 557 return toolbar;
558 }, 558 },
559 559
560 /** 560 /**
561 * @param {!WebInspector.Toolbar} toolbar 561 * @param {!WebInspector.Toolbar} toolbar
562 */ 562 */
563 _appendAppliedSizeItems: function(toolbar) 563 _appendAppliedSizeItems: function(toolbar)
564 { 564 {
565 var item = new WebInspector.ToolbarLabel(); 565 var item = new WebInspector.ToolbarText("");
566 this._appliedSizeItems.push(item); 566 this._appliedSizeItems.push(item);
567 toolbar.appendToolbarItem(item); 567 toolbar.appendToolbarItem(item);
568 }, 568 },
569 569
570 /** 570 /**
571 * @param {!WebInspector.Toolbar} toolbar 571 * @param {!WebInspector.Toolbar} toolbar
572 */ 572 */
573 _appendScaleItem: function(toolbar) 573 _appendScaleItem: function(toolbar)
574 { 574 {
575 var scaleItem = new WebInspector.ToolbarMenuButton(this._appendScaleMenu Items.bind(this)); 575 var scaleItem = new WebInspector.ToolbarMenuButton(this._appendScaleMenu Items.bind(this));
576 scaleItem.setTitle(WebInspector.UIString("Zoom")); 576 scaleItem.setTitle(WebInspector.UIString("Zoom"));
577 scaleItem.setGlyph(""); 577 scaleItem.setGlyph("");
578 scaleItem.setBold(false);
579 scaleItem.addDropDownArrow(); 578 scaleItem.addDropDownArrow();
580 toolbar.appendToolbarItem(scaleItem); 579 toolbar.appendToolbarItem(scaleItem);
581 this._scaleItems.push(scaleItem); 580 this._scaleItems.push(scaleItem);
582 }, 581 },
583 582
584 /** 583 /**
585 * @param {!WebInspector.ContextMenu} contextMenu 584 * @param {!WebInspector.ContextMenu} contextMenu
586 */ 585 */
587 _appendScaleMenuItems: function(contextMenu) 586 _appendScaleMenuItems: function(contextMenu)
588 { 587 {
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 } else { 1197 } else {
1199 this._deviceModeView.detach(); 1198 this._deviceModeView.detach();
1200 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins(); 1199 this._inspectedPagePlaceholder.restoreMinimumSizeAndMargins();
1201 this._inspectedPagePlaceholder.show(this.element); 1200 this._inspectedPagePlaceholder.show(this.element);
1202 this._deviceModeView._model.emulate(WebInspector.DeviceModeModel.Typ e.None, null, null); 1201 this._deviceModeView._model.emulate(WebInspector.DeviceModeModel.Typ e.None, null, null);
1203 } 1202 }
1204 }, 1203 },
1205 1204
1206 __proto__: WebInspector.VBox.prototype 1205 __proto__: WebInspector.VBox.prototype
1207 } 1206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698