| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 this._innerSetSidebarSizeDIP(this._preferredSidebarSizeDIP(), !!animate)
; | 145 this._innerSetSidebarSizeDIP(this._preferredSidebarSizeDIP(), !!animate)
; |
| 146 }, | 146 }, |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * @param {!WebInspector.Widget} widget | 149 * @param {!WebInspector.Widget} widget |
| 150 */ | 150 */ |
| 151 setMainWidget: function(widget) | 151 setMainWidget: function(widget) |
| 152 { | 152 { |
| 153 if (this._mainWidget === widget) | 153 if (this._mainWidget === widget) |
| 154 return; | 154 return; |
| 155 this.suspendInvalidations(); | |
| 156 if (this._mainWidget) | 155 if (this._mainWidget) |
| 157 this._mainWidget.detach(); | 156 this._mainWidget.detach(); |
| 158 this._mainWidget = widget; | 157 this._mainWidget = widget; |
| 159 if (widget) { | 158 if (widget) { |
| 160 widget.element.classList.add("insertion-point-main"); | 159 widget.element.classList.add("insertion-point-main"); |
| 161 widget.element.classList.remove("insertion-point-sidebar"); | 160 widget.element.classList.remove("insertion-point-sidebar"); |
| 162 widget.attach(this.element, this._sidebarWidget ? this._sidebarWidge
t.element : null); | |
| 163 if (this._showMode === WebInspector.SplitWidget.ShowMode.OnlyMain ||
this._showMode === WebInspector.SplitWidget.ShowMode.Both) | 161 if (this._showMode === WebInspector.SplitWidget.ShowMode.OnlyMain ||
this._showMode === WebInspector.SplitWidget.ShowMode.Both) |
| 164 widget.showWidget(); | 162 widget.show(this.element); |
| 165 } | 163 } |
| 166 this.resumeInvalidations(); | |
| 167 }, | 164 }, |
| 168 | 165 |
| 169 /** | 166 /** |
| 170 * @param {!WebInspector.Widget} widget | 167 * @param {!WebInspector.Widget} widget |
| 171 */ | 168 */ |
| 172 setSidebarWidget: function(widget) | 169 setSidebarWidget: function(widget) |
| 173 { | 170 { |
| 174 if (this._sidebarWidget === widget) | 171 if (this._sidebarWidget === widget) |
| 175 return; | 172 return; |
| 176 this.suspendInvalidations(); | |
| 177 if (this._sidebarWidget) | 173 if (this._sidebarWidget) |
| 178 this._sidebarWidget.detach(); | 174 this._sidebarWidget.detach(); |
| 179 this._sidebarWidget = widget; | 175 this._sidebarWidget = widget; |
| 180 if (widget) { | 176 if (widget) { |
| 181 widget.element.classList.add("insertion-point-sidebar"); | 177 widget.element.classList.add("insertion-point-sidebar"); |
| 182 widget.element.classList.remove("insertion-point-main"); | 178 widget.element.classList.remove("insertion-point-main"); |
| 183 widget.attach(this.element); | |
| 184 if (this._showMode === WebInspector.SplitWidget.ShowMode.OnlySidebar
|| this._showMode === WebInspector.SplitWidget.ShowMode.Both) | 179 if (this._showMode === WebInspector.SplitWidget.ShowMode.OnlySidebar
|| this._showMode === WebInspector.SplitWidget.ShowMode.Both) |
| 185 widget.showWidget(); | 180 widget.show(this.element); |
| 186 } | 181 } |
| 187 this.resumeInvalidations(); | |
| 188 }, | 182 }, |
| 189 | 183 |
| 190 /** | 184 /** |
| 191 * @return {?WebInspector.Widget} | 185 * @return {?WebInspector.Widget} |
| 192 */ | 186 */ |
| 193 mainWidget: function() | 187 mainWidget: function() |
| 194 { | 188 { |
| 195 return this._mainWidget; | 189 return this._mainWidget; |
| 196 }, | 190 }, |
| 197 | 191 |
| 198 /** | 192 /** |
| 199 * @return {?WebInspector.Widget} | 193 * @return {?WebInspector.Widget} |
| 200 */ | 194 */ |
| 201 sidebarWidget: function() | 195 sidebarWidget: function() |
| 202 { | 196 { |
| 203 return this._sidebarWidget; | 197 return this._sidebarWidget; |
| 204 }, | 198 }, |
| 205 | 199 |
| 206 /** | 200 /** |
| 207 * @override | 201 * @override |
| 208 * @param {!WebInspector.Widget} widget | 202 * @param {!WebInspector.Widget} widget |
| 209 */ | 203 */ |
| 210 childWasDetached: function(widget) | 204 childWasDetached: function(widget) |
| 211 { | 205 { |
| 206 if (this._detaching) |
| 207 return; |
| 212 if (this._mainWidget === widget) | 208 if (this._mainWidget === widget) |
| 213 delete this._mainWidget; | 209 delete this._mainWidget; |
| 214 if (this._sidebarWidget === widget) | 210 if (this._sidebarWidget === widget) |
| 215 delete this._sidebarWidget; | 211 delete this._sidebarWidget; |
| 216 }, | 212 }, |
| 217 | 213 |
| 218 /** | 214 /** |
| 219 * @return {boolean} | 215 * @return {boolean} |
| 220 */ | 216 */ |
| 221 isSidebarSecond: function() | 217 isSidebarSecond: function() |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 this._cancelAnimation(); | 309 this._cancelAnimation(); |
| 314 | 310 |
| 315 /** | 311 /** |
| 316 * @this {WebInspector.SplitWidget} | 312 * @this {WebInspector.SplitWidget} |
| 317 */ | 313 */ |
| 318 function callback() | 314 function callback() |
| 319 { | 315 { |
| 320 if (sideToShow) { | 316 if (sideToShow) { |
| 321 // Make sure main is first in the children list. | 317 // Make sure main is first in the children list. |
| 322 if (sideToShow === this._mainWidget) | 318 if (sideToShow === this._mainWidget) |
| 323 this._mainWidget.showWidget(); | 319 this._mainWidget.show(this.element, this._sidebarWidget ? th
is._sidebarWidget.element : null); |
| 324 else | 320 else |
| 325 this._sidebarWidget.showWidget(); | 321 this._sidebarWidget.show(this.element); |
| 326 } | 322 } |
| 327 if (sideToHide) | 323 if (sideToHide) { |
| 328 sideToHide.hideWidget(); | 324 this._detaching = true; |
| 325 sideToHide.detach(); |
| 326 delete this._detaching; |
| 327 } |
| 329 | 328 |
| 330 this._resizerElement.classList.add("hidden"); | 329 this._resizerElement.classList.add("hidden"); |
| 331 shadowToShow.classList.remove("hidden"); | 330 shadowToShow.classList.remove("hidden"); |
| 332 shadowToShow.classList.add("maximized"); | 331 shadowToShow.classList.add("maximized"); |
| 333 shadowToHide.classList.add("hidden"); | 332 shadowToHide.classList.add("hidden"); |
| 334 shadowToHide.classList.remove("maximized"); | 333 shadowToHide.classList.remove("maximized"); |
| 335 this._removeAllLayoutProperties(); | 334 this._removeAllLayoutProperties(); |
| 336 this.doResize(); | 335 this.doResize(); |
| 337 } | 336 } |
| 338 | 337 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 if (this._showMode === WebInspector.SplitWidget.ShowMode.Both) | 372 if (this._showMode === WebInspector.SplitWidget.ShowMode.Both) |
| 374 animate = false; | 373 animate = false; |
| 375 | 374 |
| 376 this._cancelAnimation(); | 375 this._cancelAnimation(); |
| 377 this._mainElement.classList.remove("maximized", "hidden"); | 376 this._mainElement.classList.remove("maximized", "hidden"); |
| 378 this._sidebarElement.classList.remove("maximized", "hidden"); | 377 this._sidebarElement.classList.remove("maximized", "hidden"); |
| 379 this._resizerElement.classList.remove("hidden"); | 378 this._resizerElement.classList.remove("hidden"); |
| 380 this.setResizable(true); | 379 this.setResizable(true); |
| 381 | 380 |
| 382 // Make sure main is the first in the children list. | 381 // Make sure main is the first in the children list. |
| 383 this.suspendInvalidations(); | |
| 384 if (this._sidebarWidget) | 382 if (this._sidebarWidget) |
| 385 this._sidebarWidget.showWidget(); | 383 this._sidebarWidget.show(this.element); |
| 386 if (this._mainWidget) | 384 if (this._mainWidget) |
| 387 this._mainWidget.showWidget(); | 385 this._mainWidget.show(this.element, this._sidebarWidget ? this._side
barWidget.element : null); |
| 388 this.resumeInvalidations(); | |
| 389 // Order widgets in DOM properly. | 386 // Order widgets in DOM properly. |
| 390 this.setSecondIsSidebar(this._secondIsSidebar); | 387 this.setSecondIsSidebar(this._secondIsSidebar); |
| 391 | 388 |
| 392 this._sidebarSizeDIP = -1; | 389 this._sidebarSizeDIP = -1; |
| 393 this._updateShowMode(WebInspector.SplitWidget.ShowMode.Both); | 390 this._updateShowMode(WebInspector.SplitWidget.ShowMode.Both); |
| 394 this._updateLayout(animate); | 391 this._updateLayout(animate); |
| 395 }, | 392 }, |
| 396 | 393 |
| 397 /** | 394 /** |
| 398 * @param {boolean} resizable | 395 * @param {boolean} resizable |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 this._showHideSidebarButton.classList.toggle("toggled-hide", !sidebarHid
den); | 913 this._showHideSidebarButton.classList.toggle("toggled-hide", !sidebarHid
den); |
| 917 this._showHideSidebarButton.classList.toggle("top-sidebar-show-hide-butt
on", !this.isVertical() && !this.isSidebarSecond()); | 914 this._showHideSidebarButton.classList.toggle("top-sidebar-show-hide-butt
on", !this.isVertical() && !this.isSidebarSecond()); |
| 918 this._showHideSidebarButton.classList.toggle("right-sidebar-show-hide-bu
tton", this.isVertical() && this.isSidebarSecond()); | 915 this._showHideSidebarButton.classList.toggle("right-sidebar-show-hide-bu
tton", this.isVertical() && this.isSidebarSecond()); |
| 919 this._showHideSidebarButton.classList.toggle("bottom-sidebar-show-hide-b
utton", !this.isVertical() && this.isSidebarSecond()); | 916 this._showHideSidebarButton.classList.toggle("bottom-sidebar-show-hide-b
utton", !this.isVertical() && this.isSidebarSecond()); |
| 920 this._showHideSidebarButton.classList.toggle("left-sidebar-show-hide-but
ton", this.isVertical() && !this.isSidebarSecond()); | 917 this._showHideSidebarButton.classList.toggle("left-sidebar-show-hide-but
ton", this.isVertical() && !this.isSidebarSecond()); |
| 921 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin
g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s"
, this._showHideSidebarButtonTitle); | 918 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin
g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s"
, this._showHideSidebarButtonTitle); |
| 922 }, | 919 }, |
| 923 | 920 |
| 924 __proto__: WebInspector.Widget.prototype | 921 __proto__: WebInspector.Widget.prototype |
| 925 } | 922 } |
| OLD | NEW |