| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return; | 135 return; |
| 136 this.suspendInvalidations(); | 136 this.suspendInvalidations(); |
| 137 if (this._mainWidget) | 137 if (this._mainWidget) |
| 138 this._mainWidget.detach(); | 138 this._mainWidget.detach(); |
| 139 this._mainWidget = widget; | 139 this._mainWidget = widget; |
| 140 if (widget) { | 140 if (widget) { |
| 141 widget.element.classList.add('insertion-point-main'); | 141 widget.element.classList.add('insertion-point-main'); |
| 142 widget.element.classList.remove('insertion-point-sidebar'); | 142 widget.element.classList.remove('insertion-point-sidebar'); |
| 143 widget.attach(this); | 143 widget.attach(this); |
| 144 if (this._showMode === UI.SplitWidget.ShowMode.OnlyMain || this._showMode
=== UI.SplitWidget.ShowMode.Both) | 144 if (this._showMode === UI.SplitWidget.ShowMode.OnlyMain || this._showMode
=== UI.SplitWidget.ShowMode.Both) |
| 145 widget.showWidget(this.element); | 145 widget.showWidget(); |
| 146 } | 146 } |
| 147 this.resumeInvalidations(); | 147 this.resumeInvalidations(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * @param {!UI.Widget} widget | 151 * @param {!UI.Widget} widget |
| 152 */ | 152 */ |
| 153 setSidebarWidget(widget) { | 153 setSidebarWidget(widget) { |
| 154 if (this._sidebarWidget === widget) | 154 if (this._sidebarWidget === widget) |
| 155 return; | 155 return; |
| 156 this.suspendInvalidations(); | 156 this.suspendInvalidations(); |
| 157 if (this._sidebarWidget) | 157 if (this._sidebarWidget) |
| 158 this._sidebarWidget.detach(); | 158 this._sidebarWidget.detach(); |
| 159 this._sidebarWidget = widget; | 159 this._sidebarWidget = widget; |
| 160 if (widget) { | 160 if (widget) { |
| 161 widget.element.classList.add('insertion-point-sidebar'); | 161 widget.element.classList.add('insertion-point-sidebar'); |
| 162 widget.element.classList.remove('insertion-point-main'); | 162 widget.element.classList.remove('insertion-point-main'); |
| 163 widget.attach(this); | 163 widget.attach(this); |
| 164 if (this._showMode === UI.SplitWidget.ShowMode.OnlySidebar || this._showMo
de === UI.SplitWidget.ShowMode.Both) | 164 if (this._showMode === UI.SplitWidget.ShowMode.OnlySidebar || this._showMo
de === UI.SplitWidget.ShowMode.Both) |
| 165 widget.showWidget(this.element); | 165 widget.showWidget(); |
| 166 } | 166 } |
| 167 this.resumeInvalidations(); | 167 this.resumeInvalidations(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 /** | 170 /** |
| 171 * @return {?UI.Widget} | 171 * @return {?UI.Widget} |
| 172 */ | 172 */ |
| 173 mainWidget() { | 173 mainWidget() { |
| 174 return this._mainWidget; | 174 return this._mainWidget; |
| 175 } | 175 } |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 _showOnly(sideToShow, sideToHide, shadowToShow, shadowToHide, animate) { | 276 _showOnly(sideToShow, sideToHide, shadowToShow, shadowToHide, animate) { |
| 277 this._cancelAnimation(); | 277 this._cancelAnimation(); |
| 278 | 278 |
| 279 /** | 279 /** |
| 280 * @this {UI.SplitWidget} | 280 * @this {UI.SplitWidget} |
| 281 */ | 281 */ |
| 282 function callback() { | 282 function callback() { |
| 283 if (sideToShow) { | 283 if (sideToShow) { |
| 284 // Make sure main is first in the children list. | 284 // Make sure main is first in the children list. |
| 285 if (sideToShow === this._mainWidget) | 285 if (sideToShow === this._mainWidget) |
| 286 this._mainWidget.showWidget(this.element); | 286 this._mainWidget.showWidget(); |
| 287 else | 287 else |
| 288 this._sidebarWidget.showWidget(this.element); | 288 this._sidebarWidget.showWidget(); |
| 289 } | 289 } |
| 290 if (sideToHide) | 290 if (sideToHide) |
| 291 sideToHide.hideWidget(); | 291 sideToHide.hideWidget(); |
| 292 | 292 |
| 293 this._resizerElement.classList.add('hidden'); | 293 this._resizerElement.classList.add('hidden'); |
| 294 shadowToShow.classList.remove('hidden'); | 294 shadowToShow.classList.remove('hidden'); |
| 295 shadowToShow.classList.add('maximized'); | 295 shadowToShow.classList.add('maximized'); |
| 296 shadowToHide.classList.add('hidden'); | 296 shadowToHide.classList.add('hidden'); |
| 297 shadowToHide.classList.remove('maximized'); | 297 shadowToHide.classList.remove('maximized'); |
| 298 this._removeAllLayoutProperties(); | 298 this._removeAllLayoutProperties(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 this._cancelAnimation(); | 337 this._cancelAnimation(); |
| 338 this._mainElement.classList.remove('maximized', 'hidden'); | 338 this._mainElement.classList.remove('maximized', 'hidden'); |
| 339 this._sidebarElement.classList.remove('maximized', 'hidden'); | 339 this._sidebarElement.classList.remove('maximized', 'hidden'); |
| 340 this._resizerElement.classList.remove('hidden'); | 340 this._resizerElement.classList.remove('hidden'); |
| 341 this.setResizable(true); | 341 this.setResizable(true); |
| 342 | 342 |
| 343 // Make sure main is the first in the children list. | 343 // Make sure main is the first in the children list. |
| 344 this.suspendInvalidations(); | 344 this.suspendInvalidations(); |
| 345 if (this._sidebarWidget) | 345 if (this._sidebarWidget) |
| 346 this._sidebarWidget.showWidget(this.element); | 346 this._sidebarWidget.showWidget(); |
| 347 if (this._mainWidget) | 347 if (this._mainWidget) |
| 348 this._mainWidget.showWidget(this.element); | 348 this._mainWidget.showWidget(); |
| 349 this.resumeInvalidations(); | 349 this.resumeInvalidations(); |
| 350 // Order widgets in DOM properly. | 350 // Order widgets in DOM properly. |
| 351 this.setSecondIsSidebar(this._secondIsSidebar); | 351 this.setSecondIsSidebar(this._secondIsSidebar); |
| 352 | 352 |
| 353 this._sidebarSizeDIP = -1; | 353 this._sidebarSizeDIP = -1; |
| 354 this._updateShowMode(UI.SplitWidget.ShowMode.Both); | 354 this._updateShowMode(UI.SplitWidget.ShowMode.Both); |
| 355 this._updateLayout(animate); | 355 this._updateLayout(animate); |
| 356 } | 356 } |
| 357 | 357 |
| 358 /** | 358 /** |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 OnlySidebar: 'OnlySidebar' | 878 OnlySidebar: 'OnlySidebar' |
| 879 }; | 879 }; |
| 880 | 880 |
| 881 /** @enum {symbol} */ | 881 /** @enum {symbol} */ |
| 882 UI.SplitWidget.Events = { | 882 UI.SplitWidget.Events = { |
| 883 SidebarSizeChanged: Symbol('SidebarSizeChanged'), | 883 SidebarSizeChanged: Symbol('SidebarSizeChanged'), |
| 884 ShowModeChanged: Symbol('ShowModeChanged') | 884 ShowModeChanged: Symbol('ShowModeChanged') |
| 885 }; | 885 }; |
| 886 | 886 |
| 887 UI.SplitWidget.MinPadding = 20; | 887 UI.SplitWidget.MinPadding = 20; |
| OLD | NEW |