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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 var delta = totalPreferred - totalSize; | 664 var delta = totalPreferred - totalSize; |
665 var sidebarDelta = delta * preferredSidebarSize / totalPreferred; | 665 var sidebarDelta = delta * preferredSidebarSize / totalPreferred; |
666 sidebarSize = preferredSidebarSize - sidebarDelta; | 666 sidebarSize = preferredSidebarSize - sidebarDelta; |
667 return Number.constrain(sidebarSize, minSidebarSize, totalSize - min
MainSize); | 667 return Number.constrain(sidebarSize, minSidebarSize, totalSize - min
MainSize); |
668 } | 668 } |
669 | 669 |
670 // Not enough space even for minimum sizes. | 670 // Not enough space even for minimum sizes. |
671 return Math.max(0, totalSize - minMainSize); | 671 return Math.max(0, totalSize - minMainSize); |
672 }, | 672 }, |
673 | 673 |
| 674 /** |
| 675 * @override |
| 676 */ |
674 wasShown: function() | 677 wasShown: function() |
675 { | 678 { |
676 this._forceUpdateLayout(); | 679 this._forceUpdateLayout(); |
677 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Event
s.ZoomChanged, this._onZoomChanged, this); | 680 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Event
s.ZoomChanged, this._onZoomChanged, this); |
678 }, | 681 }, |
679 | 682 |
| 683 /** |
| 684 * @override |
| 685 */ |
680 willHide: function() | 686 willHide: function() |
681 { | 687 { |
682 WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Ev
ents.ZoomChanged, this._onZoomChanged, this); | 688 WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Ev
ents.ZoomChanged, this._onZoomChanged, this); |
683 }, | 689 }, |
684 | 690 |
| 691 /** |
| 692 * @override |
| 693 */ |
685 onResize: function() | 694 onResize: function() |
686 { | 695 { |
687 this._updateLayout(); | 696 this._updateLayout(); |
688 }, | 697 }, |
689 | 698 |
| 699 /** |
| 700 * @override |
| 701 */ |
690 onLayout: function() | 702 onLayout: function() |
691 { | 703 { |
692 this._updateLayout(); | 704 this._updateLayout(); |
693 }, | 705 }, |
694 | 706 |
695 /** | 707 /** |
696 * @override | 708 * @override |
697 * @return {!Constraints} | 709 * @return {!Constraints} |
698 */ | 710 */ |
699 calculateConstraints: function() | 711 calculateConstraints: function() |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 if (!this._showHideSidebarButton) | 924 if (!this._showHideSidebarButton) |
913 return; | 925 return; |
914 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode
.OnlyMain; | 926 var sidebarHidden = this._showMode === WebInspector.SplitWidget.ShowMode
.OnlyMain; |
915 var side = this.isVertical() ? (this.isSidebarSecond() ? "right" : "left
") : (this.isSidebarSecond() ? "bottom" : "top"); | 927 var side = this.isVertical() ? (this.isSidebarSecond() ? "right" : "left
") : (this.isSidebarSecond() ? "bottom" : "top"); |
916 this._showHideSidebarButton.setState(side + "-" + (sidebarHidden ? "show
" : "hide")); | 928 this._showHideSidebarButton.setState(side + "-" + (sidebarHidden ? "show
" : "hide")); |
917 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri
ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s
", this._showHideSidebarButtonTitle)); | 929 this._showHideSidebarButton.setTitle(sidebarHidden ? WebInspector.UIStri
ng("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s
", this._showHideSidebarButtonTitle)); |
918 }, | 930 }, |
919 | 931 |
920 __proto__: WebInspector.Widget.prototype | 932 __proto__: WebInspector.Widget.prototype |
921 }; | 933 }; |
OLD | NEW |