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

Side by Side Diff: Source/devtools/front_end/ui/SplitView.js

Issue 713053002: DevTools: do not detach views that should be hidden upon detach. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/splitView.css ('k') | Source/devtools/front_end/ui/View.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 this._mainView = new WebInspector.VBox(); 45 this._mainView = new WebInspector.VBox();
46 this._mainElement = this._mainView.element; 46 this._mainElement = this._mainView.element;
47 this._mainElement.className = "split-view-contents split-view-main vbox"; // Override 47 this._mainElement.className = "split-view-contents split-view-main vbox"; // Override
48 48
49 this._sidebarView = new WebInspector.VBox(); 49 this._sidebarView = new WebInspector.VBox();
50 this._sidebarElement = this._sidebarView.element; 50 this._sidebarElement = this._sidebarView.element;
51 this._sidebarElement.className = "split-view-contents split-view-sidebar vbo x"; // Override 51 this._sidebarElement.className = "split-view-contents split-view-sidebar vbo x"; // Override
52 52
53 this._resizerElement = this.element.createChild("div", "split-view-resizer") ; 53 this._resizerElement = this.element.createChild("div", "split-view-resizer") ;
54 this._resizerElement.createChild("div", "split-view-resizer-border"); 54 this._resizerElement.createChild("div", "split-view-resizer-border");
55 if (secondIsSidebar) { 55 this._mainView.show(this.element);
56 this._mainView.show(this.element); 56 this._sidebarView.show(this.element);
57 this._sidebarView.show(this.element);
58 } else {
59 this._sidebarView.show(this.element);
60 this._mainView.show(this.element);
61 }
62 57
63 this._resizerWidget = new WebInspector.ResizerWidget(); 58 this._resizerWidget = new WebInspector.ResizerWidget();
64 this._resizerWidget.setEnabled(true); 59 this._resizerWidget.setEnabled(true);
65 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.Resiz eStart, this._onResizeStart, this); 60 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.Resiz eStart, this._onResizeStart, this);
66 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.Resiz eUpdate, this._onResizeUpdate, this); 61 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.Resiz eUpdate, this._onResizeUpdate, this);
67 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.Resiz eEnd, this._onResizeEnd, this); 62 this._resizerWidget.addEventListener(WebInspector.ResizerWidget.Events.Resiz eEnd, this._onResizeEnd, this);
68 63
69 this._defaultSidebarWidth = defaultSidebarWidth || 200; 64 this._defaultSidebarWidth = defaultSidebarWidth || 200;
70 this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWid th; 65 this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWid th;
71 this._constraintsInDip = !!constraintsInDip; 66 this._constraintsInDip = !!constraintsInDip;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 showMode: function() 186 showMode: function()
192 { 187 {
193 return this._showMode; 188 return this._showMode;
194 }, 189 },
195 190
196 /** 191 /**
197 * @param {boolean} secondIsSidebar 192 * @param {boolean} secondIsSidebar
198 */ 193 */
199 setSecondIsSidebar: function(secondIsSidebar) 194 setSecondIsSidebar: function(secondIsSidebar)
200 { 195 {
201 this._mainElement.classList.toggle("split-view-contents-first", secondIs Sidebar); 196 this._mainElement.classList.toggle("split-view-contents-first", secondIs Sidebar);
dgozman 2014/11/11 10:46:42 I wonder why don't we remove these classes.
pfeldman 2014/11/11 12:49:59 dunno.
202 this._mainElement.classList.toggle("split-view-contents-second", !second IsSidebar); 197 this._mainElement.classList.toggle("split-view-contents-second", !second IsSidebar);
203 this._sidebarElement.classList.toggle("split-view-contents-first", !seco ndIsSidebar); 198 this._sidebarElement.classList.toggle("split-view-contents-first", !seco ndIsSidebar);
204 this._sidebarElement.classList.toggle("split-view-contents-second", seco ndIsSidebar); 199 this._sidebarElement.classList.toggle("split-view-contents-second", seco ndIsSidebar);
205 200 this.element.classList.toggle("split-view-first-is-sidebar", !secondIsSi debar);
206 // Make sure second is last in the children array.
207 if (secondIsSidebar) {
208 if (this._sidebarElement.parentElement && this._sidebarElement.nextS ibling)
209 this.element.appendChild(this._sidebarElement);
210 } else {
211 if (this._mainElement.parentElement && this._mainElement.nextSibling )
212 this.element.appendChild(this._mainElement);
213 }
214
215 this._secondIsSidebar = secondIsSidebar; 201 this._secondIsSidebar = secondIsSidebar;
216 }, 202 },
217 203
218 /** 204 /**
219 * @return {?string} 205 * @return {?string}
220 */ 206 */
221 sidebarSide: function() 207 sidebarSide: function()
222 { 208 {
223 if (this._showMode !== WebInspector.SplitView.ShowMode.Both) 209 if (this._showMode !== WebInspector.SplitView.ShowMode.Both)
224 return null; 210 return null;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 */ 263 */
278 _showOnly: function(sideToShow, sideToHide, animate) 264 _showOnly: function(sideToShow, sideToHide, animate)
279 { 265 {
280 this._cancelAnimation(); 266 this._cancelAnimation();
281 267
282 /** 268 /**
283 * @this {WebInspector.SplitView} 269 * @this {WebInspector.SplitView}
284 */ 270 */
285 function callback() 271 function callback()
286 { 272 {
287 sideToShow.show(this.element); 273 // Make sure main is first in the children list.
274 if (sideToShow === this._mainView)
275 this._mainView.show(this.element, this._sidebarView.element);
276 else
277 this._sidebarView.show(this.element);
288 sideToHide.detach(); 278 sideToHide.detach();
289 sideToShow.element.classList.add("maximized"); 279 sideToShow.element.classList.add("maximized");
290 sideToHide.element.classList.remove("maximized"); 280 sideToHide.element.classList.remove("maximized");
291 this._resizerElement.classList.add("hidden"); 281 this._resizerElement.classList.add("hidden");
292 this._removeAllLayoutProperties(); 282 this._removeAllLayoutProperties();
293 } 283 }
294 284
295 if (animate) { 285 if (animate) {
296 this._animate(true, callback.bind(this)); 286 this._animate(true, callback.bind(this));
297 } else { 287 } else {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 showBoth: function(animate) 319 showBoth: function(animate)
330 { 320 {
331 if (this._showMode === WebInspector.SplitView.ShowMode.Both) 321 if (this._showMode === WebInspector.SplitView.ShowMode.Both)
332 animate = false; 322 animate = false;
333 323
334 this._cancelAnimation(); 324 this._cancelAnimation();
335 this._mainElement.classList.remove("maximized"); 325 this._mainElement.classList.remove("maximized");
336 this._sidebarElement.classList.remove("maximized"); 326 this._sidebarElement.classList.remove("maximized");
337 this._resizerElement.classList.remove("hidden"); 327 this._resizerElement.classList.remove("hidden");
338 328
339 this._mainView.show(this.element); 329 // Make sure main is the first in the children list.
330 this._mainView.show(this.element, this._sidebarView.element);
340 this._sidebarView.show(this.element); 331 this._sidebarView.show(this.element);
341 // Order views in DOM properly. 332 // Order views in DOM properly.
342 this.setSecondIsSidebar(this._secondIsSidebar); 333 this.setSecondIsSidebar(this._secondIsSidebar);
343 334
344 this._sidebarSize = -1; 335 this._sidebarSize = -1;
345 this.setResizable(true); 336 this.setResizable(true);
346 this._updateShowMode(WebInspector.SplitView.ShowMode.Both); 337 this._updateShowMode(WebInspector.SplitView.ShowMode.Both);
347 this._updateLayout(animate); 338 this._updateLayout(animate);
348 }, 339 },
349 340
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 this._showHideSidebarButton.state = sidebarHidden ? "show" : "hide"; 869 this._showHideSidebarButton.state = sidebarHidden ? "show" : "hide";
879 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-h ide-button", !this.isVertical() && !this.isSidebarSecond()); 870 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-h ide-button", !this.isVertical() && !this.isSidebarSecond());
880 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show -hide-button", this.isVertical() && this.isSidebarSecond()); 871 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show -hide-button", this.isVertical() && this.isSidebarSecond());
881 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-sho w-hide-button", !this.isVertical() && this.isSidebarSecond()); 872 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-sho w-hide-button", !this.isVertical() && this.isSidebarSecond());
882 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show- hide-button", this.isVertical() && !this.isSidebarSecond()); 873 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show- hide-button", this.isVertical() && !this.isSidebarSecond());
883 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s" , this._showHideSidebarButtonTitle); 874 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s" , this._showHideSidebarButtonTitle);
884 }, 875 },
885 876
886 __proto__: WebInspector.View.prototype 877 __proto__: WebInspector.View.prototype
887 } 878 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/splitView.css ('k') | Source/devtools/front_end/ui/View.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698