Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * | 10 * |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 30 * @unrestricted | 30 * @unrestricted |
| 31 */ | 31 */ |
| 32 UI.SplitWidget = class extends UI.Widget { | 32 UI.SplitWidget = class extends UI.Widget { |
| 33 /** | 33 /** |
| 34 * @param {boolean} isVertical | 34 * @param {boolean} isVertical |
| 35 * @param {boolean} secondIsSidebar | 35 * @param {boolean} secondIsSidebar |
| 36 * @param {string=} settingName | 36 * @param {string=} settingName |
| 37 * @param {number=} defaultSidebarWidth | 37 * @param {number=} defaultSidebarWidth |
| 38 * @param {number=} defaultSidebarHeight | 38 * @param {number=} defaultSidebarHeight |
| 39 * @param {boolean=} constraintsInDip | 39 * @param {boolean=} constraintsInDip |
| 40 * @param {number=} resizerThickness | |
|
einbinder
2017/01/04 00:26:26
Adding yet another parameter feels unfortunate.
dgozman
2017/01/04 18:11:22
Turn it into a setter.
| |
| 40 */ | 41 */ |
| 41 constructor(isVertical, secondIsSidebar, settingName, defaultSidebarWidth, def aultSidebarHeight, constraintsInDip) { | 42 constructor( |
| 43 isVertical, | |
| 44 secondIsSidebar, | |
| 45 settingName, | |
| 46 defaultSidebarWidth, | |
| 47 defaultSidebarHeight, | |
| 48 constraintsInDip, | |
| 49 resizerThickness) { | |
| 42 super(true); | 50 super(true); |
| 43 this.element.classList.add('split-widget'); | 51 this.element.classList.add('split-widget'); |
| 44 this.registerRequiredCSS('ui/splitWidget.css'); | 52 this.registerRequiredCSS('ui/splitWidget.css'); |
| 45 | 53 |
| 46 this.contentElement.classList.add('shadow-split-widget'); | 54 this.contentElement.classList.add('shadow-split-widget'); |
| 47 this._mainElement = | 55 this._mainElement = |
| 48 this.contentElement.createChild('div', 'shadow-split-widget-contents sha dow-split-widget-main vbox'); | 56 this.contentElement.createChild('div', 'shadow-split-widget-contents sha dow-split-widget-main vbox'); |
| 49 this._mainElement.createChild('content').select = '.insertion-point-main'; | 57 this._mainElement.createChild('content').select = '.insertion-point-main'; |
| 50 this._sidebarElement = | 58 this._sidebarElement = |
| 51 this.contentElement.createChild('div', 'shadow-split-widget-contents sha dow-split-widget-sidebar vbox'); | 59 this.contentElement.createChild('div', 'shadow-split-widget-contents sha dow-split-widget-sidebar vbox'); |
| 52 this._sidebarElement.createChild('content').select = '.insertion-point-sideb ar'; | 60 this._sidebarElement.createChild('content').select = '.insertion-point-sideb ar'; |
| 53 this._resizerElement = this.contentElement.createChild('div', 'shadow-split- widget-resizer'); | 61 this._resizerElement = this.contentElement.createChild('div', 'shadow-split- widget-resizer'); |
| 62 if (typeof resizerThickness === 'number') { | |
| 63 if (isVertical) | |
|
dgozman
2017/01/04 18:11:22
Note that isVertical may change (see setVertical).
| |
| 64 this._resizerElement.style.height = resizerThickness + 'px'; | |
| 65 else | |
| 66 this._resizerElement.style.width = resizerThickness + 'px'; | |
|
dgozman
2017/01/04 18:11:22
This makes it extra-thick in device mode, right?
einbinder
2017/01/05 20:41:00
Done.
| |
| 67 } | |
| 54 | 68 |
| 55 this._resizerWidget = new UI.SimpleResizerWidget(); | 69 this._resizerWidget = new UI.SimpleResizerWidget(); |
| 56 this._resizerWidget.setEnabled(true); | 70 this._resizerWidget.setEnabled(true); |
| 57 this._resizerWidget.addEventListener(UI.ResizerWidget.Events.ResizeStart, th is._onResizeStart, this); | 71 this._resizerWidget.addEventListener(UI.ResizerWidget.Events.ResizeStart, th is._onResizeStart, this); |
| 58 this._resizerWidget.addEventListener(UI.ResizerWidget.Events.ResizeUpdate, t his._onResizeUpdate, this); | 72 this._resizerWidget.addEventListener(UI.ResizerWidget.Events.ResizeUpdate, t his._onResizeUpdate, this); |
| 59 this._resizerWidget.addEventListener(UI.ResizerWidget.Events.ResizeEnd, this ._onResizeEnd, this); | 73 this._resizerWidget.addEventListener(UI.ResizerWidget.Events.ResizeEnd, this ._onResizeEnd, this); |
| 60 | 74 |
| 61 this._defaultSidebarWidth = defaultSidebarWidth || 200; | 75 this._defaultSidebarWidth = defaultSidebarWidth || 200; |
| 62 this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWid th; | 76 this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWid th; |
| 63 this._constraintsInDip = !!constraintsInDip; | 77 this._constraintsInDip = !!constraintsInDip; |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 878 OnlySidebar: 'OnlySidebar' | 892 OnlySidebar: 'OnlySidebar' |
| 879 }; | 893 }; |
| 880 | 894 |
| 881 /** @enum {symbol} */ | 895 /** @enum {symbol} */ |
| 882 UI.SplitWidget.Events = { | 896 UI.SplitWidget.Events = { |
| 883 SidebarSizeChanged: Symbol('SidebarSizeChanged'), | 897 SidebarSizeChanged: Symbol('SidebarSizeChanged'), |
| 884 ShowModeChanged: Symbol('ShowModeChanged') | 898 ShowModeChanged: Symbol('ShowModeChanged') |
| 885 }; | 899 }; |
| 886 | 900 |
| 887 UI.SplitWidget.MinPadding = 20; | 901 UI.SplitWidget.MinPadding = 20; |
| OLD | NEW |