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

Side by Side Diff: Source/devtools/front_end/TabbedPane.js

Issue 214663005: [DevTools] Add preferred size to WebInspector.View. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Constraints Created 6 years, 8 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 { 76 {
77 this._shrinkableTabs = shrinkableTabs; 77 this._shrinkableTabs = shrinkableTabs;
78 }, 78 },
79 79
80 /** 80 /**
81 * @type {boolean} verticalTabLayout 81 * @type {boolean} verticalTabLayout
82 */ 82 */
83 set verticalTabLayout(verticalTabLayout) 83 set verticalTabLayout(verticalTabLayout)
84 { 84 {
85 this._verticalTabLayout = verticalTabLayout; 85 this._verticalTabLayout = verticalTabLayout;
86 this.invalidateMinimumSize(); 86 this.invalidateConstraints();
87 }, 87 },
88 88
89 /** 89 /**
90 * @type {boolean} closeableTabs 90 * @type {boolean} closeableTabs
91 */ 91 */
92 set closeableTabs(closeableTabs) 92 set closeableTabs(closeableTabs)
93 { 93 {
94 this._closeableTabs = closeableTabs; 94 this._closeableTabs = closeableTabs;
95 }, 95 },
96 96
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 headerResized: function() 369 headerResized: function()
370 { 370 {
371 this._updateTabElements(); 371 this._updateTabElements();
372 }, 372 },
373 373
374 wasShown: function() 374 wasShown: function()
375 { 375 {
376 var effectiveTab = this._currentTab || this._tabsHistory[0]; 376 var effectiveTab = this._currentTab || this._tabsHistory[0];
377 if (effectiveTab) 377 if (effectiveTab)
378 this.selectTab(effectiveTab.id); 378 this.selectTab(effectiveTab.id);
379 this.invalidateMinimumSize(); 379 this.invalidateConstraints();
380 }, 380 },
381 381
382 /** 382 /**
383 * @return {!Size} 383 * @return {!Constraints}
384 */ 384 */
385 calculateMinimumSize: function() 385 calculateConstraints: function()
386 { 386 {
387 var size = WebInspector.VBox.prototype.calculateMinimumSize.call(this); 387 var constraints = WebInspector.VBox.prototype.calculateConstraints.call( this);
388 var minContentConstraints = new Constraints(new Size(0, 0), new Size(50, 50));
389 constraints = constraints.widthToMax(minContentConstraints).heightToMax( minContentConstraints);
388 if (this._verticalTabLayout) 390 if (this._verticalTabLayout)
389 size.width += this._headerElement.offsetWidth; 391 constraints = constraints.addWidth(new Constraints(new Size(this._he aderElement.offsetWidth, 0)));
390 else 392 else
391 size.height += this._headerElement.offsetHeight; 393 constraints = constraints.addHeight(new Constraints(new Size(0, this ._headerElement.offsetHeight)));
392 return size; 394 return constraints;
393 }, 395 },
394 396
395 _updateTabElements: function() 397 _updateTabElements: function()
396 { 398 {
397 WebInspector.invokeOnceAfterBatchUpdate(this, this._innerUpdateTabElemen ts); 399 WebInspector.invokeOnceAfterBatchUpdate(this, this._innerUpdateTabElemen ts);
398 }, 400 },
399 401
400 /** 402 /**
401 * @param {string} text 403 * @param {string} text
402 */ 404 */
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 { 1130 {
1129 if (this._views.contains(id)) 1131 if (this._views.contains(id))
1130 return /** @type {!WebInspector.View} */ (this._views.get(id)); 1132 return /** @type {!WebInspector.View} */ (this._views.get(id));
1131 var view = this._extensions[id] ? /** @type {!WebInspector.View} */ (thi s._extensions[id].instance()) : null; 1133 var view = this._extensions[id] ? /** @type {!WebInspector.View} */ (thi s._extensions[id].instance()) : null;
1132 this._views.put(id, view); 1134 this._views.put(id, view);
1133 if (this._viewCallback && view) 1135 if (this._viewCallback && view)
1134 this._viewCallback(id, view); 1136 this._viewCallback(id, view);
1135 return view; 1137 return view;
1136 } 1138 }
1137 } 1139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698