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

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

Issue 208053003: Fix HeapSnapshotView leaks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/HeapSnapshotView.js ('k') | no next file » | 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 24 matching lines...) Expand all
35 * @param {number=} defaultSidebarWidth 35 * @param {number=} defaultSidebarWidth
36 * @param {number=} defaultSidebarHeight 36 * @param {number=} defaultSidebarHeight
37 */ 37 */
38 WebInspector.SplitView = function(isVertical, secondIsSidebar, settingName, defa ultSidebarWidth, defaultSidebarHeight) 38 WebInspector.SplitView = function(isVertical, secondIsSidebar, settingName, defa ultSidebarWidth, defaultSidebarHeight)
39 { 39 {
40 WebInspector.View.call(this); 40 WebInspector.View.call(this);
41 41
42 this.registerRequiredCSS("splitView.css"); 42 this.registerRequiredCSS("splitView.css");
43 this.element.classList.add("split-view"); 43 this.element.classList.add("split-view");
44 44
45 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo omChanged, this._onZoomChanged, this);
46
47 this._mainView = new WebInspector.VBox(); 45 this._mainView = new WebInspector.VBox();
48 this._mainView.makeLayoutBoundary(); 46 this._mainView.makeLayoutBoundary();
49 this._mainElement = this._mainView.element; 47 this._mainElement = this._mainView.element;
50 this._mainElement.className = "split-view-contents scroll-target split-view- main vbox"; // Override 48 this._mainElement.className = "split-view-contents scroll-target split-view- main vbox"; // Override
51 49
52 this._sidebarView = new WebInspector.VBox(); 50 this._sidebarView = new WebInspector.VBox();
53 this._sidebarView.makeLayoutBoundary(); 51 this._sidebarView.makeLayoutBoundary();
54 this._sidebarElement = this._sidebarView.element; 52 this._sidebarElement = this._sidebarView.element;
55 this._sidebarElement.className = "split-view-contents scroll-target split-vi ew-sidebar vbox"; // Override 53 this._sidebarElement.className = "split-view-contents scroll-target split-vi ew-sidebar vbox"; // Override
56 54
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 563
566 var to = totalSize - minMainSize; 564 var to = totalSize - minMainSize;
567 if (from <= to) 565 if (from <= to)
568 return Number.constrain(sidebarSize, from, to); 566 return Number.constrain(sidebarSize, from, to);
569 567
570 return -1; 568 return -1;
571 }, 569 },
572 570
573 wasShown: function() 571 wasShown: function()
574 { 572 {
575 this._updateLayout(); 573 this._forceUpdateLayout();
574 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Event s.ZoomChanged, this._onZoomChanged, this);
575 },
576
577 willHide: function()
578 {
579 WebInspector.zoomManager.removeEventListener(WebInspector.ZoomManager.Ev ents.ZoomChanged, this._onZoomChanged, this);
576 }, 580 },
577 581
578 onResize: function() 582 onResize: function()
579 { 583 {
580 this._updateLayout(); 584 this._updateLayout();
581 }, 585 },
582 586
583 /** 587 /**
584 * @param {!MouseEvent} event 588 * @param {!MouseEvent} event
585 * @return {boolean} 589 * @return {boolean}
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 if (this._shouldSaveShowMode) 776 if (this._shouldSaveShowMode)
773 orientationState.showMode = this._savedShowMode; 777 orientationState.showMode = this._savedShowMode;
774 778
775 if (this._isVertical) 779 if (this._isVertical)
776 state.vertical = orientationState; 780 state.vertical = orientationState;
777 else 781 else
778 state.horizontal = orientationState; 782 state.horizontal = orientationState;
779 setting.set(state); 783 setting.set(state);
780 }, 784 },
781 785
786 _forceUpdateLayout: function()
787 {
788 // Force layout even if sidebar size does not change.
789 this._sidebarSize = -1;
790 this._updateLayout();
791 },
792
782 /** 793 /**
783 * @param {!WebInspector.Event} event 794 * @param {!WebInspector.Event} event
784 */ 795 */
785 _onZoomChanged: function(event) 796 _onZoomChanged: function(event)
786 { 797 {
787 // Force layout even if sidebar size does not change. 798 this._forceUpdateLayout();
788 this._sidebarSize = -1;
789 if (this.isShowing())
790 this._updateLayout();
791 }, 799 },
792 800
793 /** 801 /**
794 * @param {string} title 802 * @param {string} title
795 * @param {string} className 803 * @param {string} className
796 * @return {!WebInspector.StatusBarButton} 804 * @return {!WebInspector.StatusBarButton}
797 */ 805 */
798 createShowHideSidebarButton: function(title, className) 806 createShowHideSidebarButton: function(title, className)
799 { 807 {
800 console.assert(this.isVertical(), "Buttons for split view with horizonta l split are not supported yet."); 808 console.assert(this.isVertical(), "Buttons for split view with horizonta l split are not supported yet.");
(...skipping 26 matching lines...) Expand all
827 this._showHideSidebarButton.state = sidebarHidden ? "show" : "hide"; 835 this._showHideSidebarButton.state = sidebarHidden ? "show" : "hide";
828 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-h ide-button", !this.isVertical() && !this.isSidebarSecond()); 836 this._showHideSidebarButton.element.classList.toggle("top-sidebar-show-h ide-button", !this.isVertical() && !this.isSidebarSecond());
829 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show -hide-button", this.isVertical() && this.isSidebarSecond()); 837 this._showHideSidebarButton.element.classList.toggle("right-sidebar-show -hide-button", this.isVertical() && this.isSidebarSecond());
830 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-sho w-hide-button", !this.isVertical() && this.isSidebarSecond()); 838 this._showHideSidebarButton.element.classList.toggle("bottom-sidebar-sho w-hide-button", !this.isVertical() && this.isSidebarSecond());
831 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show- hide-button", this.isVertical() && !this.isSidebarSecond()); 839 this._showHideSidebarButton.element.classList.toggle("left-sidebar-show- hide-button", this.isVertical() && !this.isSidebarSecond());
832 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s" , this._showHideSidebarButtonTitle); 840 this._showHideSidebarButton.title = sidebarHidden ? WebInspector.UIStrin g("Show %s", this._showHideSidebarButtonTitle) : WebInspector.UIString("Hide %s" , this._showHideSidebarButtonTitle);
833 }, 841 },
834 842
835 __proto__: WebInspector.View.prototype 843 __proto__: WebInspector.View.prototype
836 } 844 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/HeapSnapshotView.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698