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