Title: [195456] trunk/Source/WebInspectorUI
Revision
195456
Author
[email protected]
Date
2016-01-22 10:07:58 -0800 (Fri, 22 Jan 2016)

Log Message

Web Inspector: Sidebar's should remember their width's
https://bugs.webkit.org/show_bug.cgi?id=153007

Patch by Devin Rousso <[email protected]> on 2016-01-22
Reviewed by Timothy Hatcher.

* UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
(WebInspector.CSSStyleDetailsSidebarPanel.prototype.widthDidChange):
Now calls superclass function.

* UserInterface/Views/Sidebar.js:
(WebInspector.Sidebar.prototype.set selectedSidebarPanel):
Now calls _recalculateWidth with the saved width value of the sidebar as
the first parameter.

(WebInspector.Sidebar.prototype.set collapsed):
Now only calls _recalculateWidth if the selected sidebar panel is visible,
seeing as if it is hidden the width is irrelevant.

* UserInterface/Views/SidebarPanel.js:
(WebInspector.SidebarPanel):
Creates a setting object using the panel's identifier to store the current width.

(WebInspector.SidebarPanel.prototype.get savedWidth):
(WebInspector.SidebarPanel.prototype.widthDidChange):
So long as the current width has a value, save it to the setting object.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (195455 => 195456)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-01-22 18:06:18 UTC (rev 195455)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-01-22 18:07:58 UTC (rev 195456)
@@ -1,5 +1,33 @@
 2016-01-22  Devin Rousso  <[email protected]>
 
+        Web Inspector: Sidebar's should remember their width's
+        https://bugs.webkit.org/show_bug.cgi?id=153007
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/CSSStyleDetailsSidebarPanel.js:
+        (WebInspector.CSSStyleDetailsSidebarPanel.prototype.widthDidChange):
+        Now calls superclass function.
+
+        * UserInterface/Views/Sidebar.js:
+        (WebInspector.Sidebar.prototype.set selectedSidebarPanel):
+        Now calls _recalculateWidth with the saved width value of the sidebar as
+        the first parameter.
+
+        (WebInspector.Sidebar.prototype.set collapsed):
+        Now only calls _recalculateWidth if the selected sidebar panel is visible,
+        seeing as if it is hidden the width is irrelevant.
+
+        * UserInterface/Views/SidebarPanel.js:
+        (WebInspector.SidebarPanel):
+        Creates a setting object using the panel's identifier to store the current width.
+
+        (WebInspector.SidebarPanel.prototype.get savedWidth):
+        (WebInspector.SidebarPanel.prototype.widthDidChange):
+        So long as the current width has a value, save it to the setting object.
+
+2016-01-22  Devin Rousso  <[email protected]>
+
         Web Inspector: Class toggle add icon flashes when changing nodes
         https://bugs.webkit.org/show_bug.cgi?id=153341
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js (195455 => 195456)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js	2016-01-22 18:06:18 UTC (rev 195455)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDetailsSidebarPanel.js	2016-01-22 18:07:58 UTC (rev 195456)
@@ -172,6 +172,8 @@
 
     widthDidChange()
     {
+        super.widthDidChange();
+
         this._updateNoForcedPseudoClassesScrollOffset();
 
         if (this._selectedPanel)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js (195455 => 195456)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2016-01-22 18:06:18 UTC (rev 195455)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Sidebar.js	2016-01-22 18:07:58 UTC (rev 195456)
@@ -147,7 +147,7 @@
             if (this._selectedSidebarPanel.visible) {
                 this._selectedSidebarPanel.shown();
                 this._selectedSidebarPanel.visibilityDidChange();
-                this._recalculateWidth();
+                this._recalculateWidth(this._selectedSidebarPanel.savedWidth);
             }
         }
 
@@ -200,14 +200,13 @@
             this._navigationBar.needsLayout();
 
         if (this._selectedSidebarPanel) {
-            if (this._selectedSidebarPanel.visible)
+            if (this._selectedSidebarPanel.visible) {
                 this._selectedSidebarPanel.shown();
-            else
+                this._recalculateWidth(this._selectedSidebarPanel.savedWidth);
+            } else
                 this._selectedSidebarPanel.hidden();
 
             this._selectedSidebarPanel.visibilityDidChange();
-            this._selectedSidebarPanel.widthDidChange();
-            this._recalculateWidth();
         }
 
         this.dispatchEventToListeners(WebInspector.Sidebar.Event.CollapsedStateDidChange);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js (195455 => 195456)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js	2016-01-22 18:06:18 UTC (rev 195455)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SidebarPanel.js	2016-01-22 18:07:58 UTC (rev 195456)
@@ -33,6 +33,7 @@
         this._displayName = displayName;
         this._selected = false;
 
+        this._widthSetting = new WebInspector.Setting(identifier + "-sidebar-panel-width", 0);
         this._savedScrollPosition = 0;
 
         this.element.classList.add("panel", identifier);
@@ -87,6 +88,11 @@
         return 0;
     }
 
+    get savedWidth()
+    {
+        return this._widthSetting.value;
+    }
+
     show()
     {
         if (!this.parentSidebar)
@@ -148,6 +154,10 @@
 
     widthDidChange()
     {
+        let width = this.element.realOffsetWidth;
+        if (width && width !== this._widthSetting.value)
+            this._widthSetting.value = width;
+
         // Implemented by subclasses.
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to