Web Inspector: REGRESSION (r244157): Timelines: ruler size appears wrong on first...
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 17:22:11 +0000 (17:22 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Apr 2019 17:22:11 +0000 (17:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196901
<rdar://problem/49880539>

Reviewed by Timothy Hatcher.

* UserInterface/Views/View.js:
(WI.View.prototype._layoutSubtree):
Ensure that the forced override of the layout reason during the initial layout doesn't
affect subviews.

* UserInterface/Views/ConsoleDrawer.js:
(WI.ConsoleDrawer.prototype.sizeDidChange): Added.
(WI.ConsoleDrawer.prototype.layout): Deleted.
* UserInterface/Views/ConsolePrompt.js:
(WI.ConsolePrompt.prototype.sizeDidChange): Added.
(WI.ConsolePrompt.prototype.layout): Deleted.
* UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView.prototype.sizeDidChange): Added.
(WI.DOMTreeContentView.prototype.layout):
* UserInterface/Views/NavigationBar.js:
(WI.NavigationBar.prototype.sizeDidChange): Added.
(WI.NavigationBar.prototype.layout):
(WI.NavigationBar.prototype._updateContent): Added.
(WI.NavigationBar.prototype._updateContent.forceItemHidden): Added.
(WI.NavigationBar.prototype._updateContent.isDivider): Added.
(WI.NavigationBar.prototype._updateContent.calculateVisibleItemWidth): Added.
(WI.NavigationBar.prototype.layout.forceItemHidden): Deleted.
(WI.NavigationBar.prototype.layout.isDivider): Deleted.
(WI.NavigationBar.prototype.layout.calculateVisibleItemWidth): Deleted.
* UserInterface/Views/TabBrowser.js:
(WI.TabBrowser.prototype.sizeDidChange): Added.
(WI.TabBrowser.prototype.layout): Deleted.
Move logic in `layout` to `sizeDidChange` where applicable.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244264 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ConsoleDrawer.js
Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
Source/WebInspectorUI/UserInterface/Views/TabBrowser.js
Source/WebInspectorUI/UserInterface/Views/View.js

index 9383551..d422c40 100644 (file)
@@ -1,3 +1,40 @@
+2019-04-15  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: REGRESSION (r244157): Timelines: ruler size appears wrong on first layout
+        https://bugs.webkit.org/show_bug.cgi?id=196901
+        <rdar://problem/49880539>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/View.js:
+        (WI.View.prototype._layoutSubtree):
+        Ensure that the forced override of the layout reason during the initial layout doesn't
+        affect subviews.
+
+        * UserInterface/Views/ConsoleDrawer.js:
+        (WI.ConsoleDrawer.prototype.sizeDidChange): Added.
+        (WI.ConsoleDrawer.prototype.layout): Deleted.
+        * UserInterface/Views/ConsolePrompt.js:
+        (WI.ConsolePrompt.prototype.sizeDidChange): Added.
+        (WI.ConsolePrompt.prototype.layout): Deleted.
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WI.DOMTreeContentView.prototype.sizeDidChange): Added.
+        (WI.DOMTreeContentView.prototype.layout):
+        * UserInterface/Views/NavigationBar.js:
+        (WI.NavigationBar.prototype.sizeDidChange): Added.
+        (WI.NavigationBar.prototype.layout):
+        (WI.NavigationBar.prototype._updateContent): Added.
+        (WI.NavigationBar.prototype._updateContent.forceItemHidden): Added.
+        (WI.NavigationBar.prototype._updateContent.isDivider): Added.
+        (WI.NavigationBar.prototype._updateContent.calculateVisibleItemWidth): Added.
+        (WI.NavigationBar.prototype.layout.forceItemHidden): Deleted.
+        (WI.NavigationBar.prototype.layout.isDivider): Deleted.
+        (WI.NavigationBar.prototype.layout.calculateVisibleItemWidth): Deleted.
+        * UserInterface/Views/TabBrowser.js:
+        (WI.TabBrowser.prototype.sizeDidChange): Added.
+        (WI.TabBrowser.prototype.layout): Deleted.
+        Move logic in `layout` to `sizeDidChange` where applicable.
+
 2019-04-11  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: REGRESSION(r244195): Timelines: unable to take heap snapshot
index 3e0f663..16929cd 100644 (file)
@@ -93,16 +93,13 @@ WI.ConsoleDrawer = class ConsoleDrawer extends WI.ContentBrowser
 
     // Protected
 
-    layout()
+    sizeDidChange()
     {
-        if (this._collapsed)
-            return;
+        super.sizeDidChange();
 
-        if (this.layoutReason !== WI.View.LayoutReason.Resize)
+        if (this._collapsed)
             return;
 
-        super.layout();
-
         let height = this.height;
         this._restoreDrawerHeight();
 
index 053e8f0..549cab4 100644 (file)
@@ -144,9 +144,11 @@ WI.ConsolePrompt = class ConsolePrompt extends WI.View
         return !!this.text;
     }
 
-    layout()
+    sizeDidChange()
     {
-        if (this.layoutReason === WI.View.LayoutReason.Resize && this.text)
+        super.sizeDidChange();
+
+        if (this.text)
             this._codeMirror.refresh();
     }
 
index 920a96f..d7ea205 100644 (file)
@@ -364,12 +364,18 @@ WI.DOMTreeContentView = class DOMTreeContentView extends WI.ContentView
 
     // Protected
 
+    sizeDidChange()
+    {
+        super.sizeDidChange();
+
+        this._domTreeOutline.selectDOMNode(this._domTreeOutline.selectedDOMNode());
+    }
+
     layout()
     {
-        this._domTreeOutline.updateSelectionArea();
+        super.layout();
 
-        if (this.layoutReason === WI.View.LayoutReason.Resize)
-            this._domTreeOutline.selectDOMNode(this._domTreeOutline.selectedDOMNode());
+        this._domTreeOutline.updateSelectionArea();
     }
 
     // Private
index 144fe16..d91aa22 100644 (file)
@@ -208,11 +208,27 @@ WI.NavigationBar = class NavigationBar extends WI.View
         super.needsLayout();
     }
 
+    sizeDidChange()
+    {
+        super.sizeDidChange();
+
+        this._updateContent();
+    }
+
     layout()
     {
-        if (this.layoutReason !== WI.View.LayoutReason.Resize && !this._forceLayout)
+        super.layout();
+
+        if (!this._forceLayout)
             return;
 
+        this._updateContent();
+    }
+
+    // Private
+
+    _updateContent()
+    {
         this._forceLayout = false;
 
         // Remove the collapsed style class to test if the items can fit at full width.
@@ -285,8 +301,6 @@ WI.NavigationBar = class NavigationBar extends WI.View
             forceItemHidden(previousItem);
     }
 
-    // Private
-
     _mouseDown(event)
     {
         // Only handle left mouse clicks.
index 48f2282..2de7592 100644 (file)
@@ -214,10 +214,9 @@ WI.TabBrowser = class TabBrowser extends WI.View
 
     // Protected
 
-    layout()
+    sizeDidChange()
     {
-        if (this.layoutReason !== WI.View.LayoutReason.Resize)
-            return;
+        super.sizeDidChange();
 
         for (let tabContentView of this._recentTabContentViews)
             tabContentView[WI.TabBrowser.NeedsResizeLayoutSymbol] = tabContentView !== this.selectedTabContentView;
index b4adbce..6ae7091 100644 (file)
@@ -277,18 +277,24 @@ WI.View = class View extends WI.Object
         let isInitialLayout = !this._didInitialLayout;
 
         if (isInitialLayout) {
-            // The initial layout should always be treated as dirty.
-            this._setLayoutReason();
-
             this.initialLayout();
             this._didInitialLayout = true;
         }
 
-        if (this._layoutReason === WI.View.LayoutReason.Resize)
+        if (this._layoutReason === WI.View.LayoutReason.Resize || isInitialLayout)
             this.sizeDidChange();
 
+        let savedLayoutReason = this._layoutReason;
+        if (isInitialLayout) {
+            // The initial layout should always be treated as dirty.
+            this._setLayoutReason();
+        }
+
         this.layout();
 
+        // Ensure that the initial layout override doesn't affects to subviews.
+        this._layoutReason = savedLayoutReason;
+
         if (WI.settings.enableLayoutFlashing.value)
             this._drawLayoutFlashingOutline(isInitialLayout);