Web Inspector: View: introduce a didLayoutSubtree
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Nov 2018 04:11:57 +0000 (04:11 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Nov 2018 04:11:57 +0000 (04:11 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191176

Reviewed by Matt Baker.

Source/WebInspectorUI:

Introduce logic to allow subclasses of `WI.View` to perform logic after every `WI.View` in
their subtree has finished `layout`.

* UserInterface/Views/View.js:
(WI.View.prototype.didLayoutSubtree): Added.
(WI.View.prototype._layoutSubtree):

* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.layout):
(WI.NetworkTableContentView.prototype.didLayoutSubtree): Added.

LayoutTests:

* inspector/view/resources/test-view.js:
(TestPage.registerInitializer.WI.TestView.prototype.layout):
(TestPage.registerInitializer.WI.TestView.prototype.didLayoutSubtree): Added.

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

LayoutTests/ChangeLog
LayoutTests/inspector/view/resources/test-view.js
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
Source/WebInspectorUI/UserInterface/Views/View.js

index 764d973..e507eec 100644 (file)
@@ -1,3 +1,14 @@
+2018-11-01  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: View: introduce a didLayoutSubtree
+        https://bugs.webkit.org/show_bug.cgi?id=191176
+
+        Reviewed by Matt Baker.
+
+        * inspector/view/resources/test-view.js:
+        (TestPage.registerInitializer.WI.TestView.prototype.layout):
+        (TestPage.registerInitializer.WI.TestView.prototype.didLayoutSubtree): Added.
+
 2018-11-01  Chris Dumez  <cdumez@apple.com>
 
         Location object sans browsing context
index e5eb24a..6659f55 100644 (file)
@@ -30,6 +30,10 @@ TestPage.registerInitializer(() => {
         layout()
         {
             this._layoutCount++;
+        }
+
+        didLayoutSubtree()
+        {
             let callbacks = this._layoutCallbacks;
             this._layoutCallbacks = [];
             for (let callback of callbacks)
index 9bc54b0..78f02a6 100644 (file)
@@ -1,5 +1,23 @@
 2018-11-01  Devin Rousso  <drousso@apple.com>
 
+        Web Inspector: View: introduce a didLayoutSubtree
+        https://bugs.webkit.org/show_bug.cgi?id=191176
+
+        Reviewed by Matt Baker.
+
+        Introduce logic to allow subclasses of `WI.View` to perform logic after every `WI.View` in
+        their subtree has finished `layout`.
+
+        * UserInterface/Views/View.js:
+        (WI.View.prototype.didLayoutSubtree): Added.
+        (WI.View.prototype._layoutSubtree):
+
+        * UserInterface/Views/NetworkTableContentView.js:
+        (WI.NetworkTableContentView.prototype.layout):
+        (WI.NetworkTableContentView.prototype.didLayoutSubtree): Added.
+
+2018-11-01  Devin Rousso  <drousso@apple.com>
+
         Web Inspector: Network: remove unnecessary media event tracking
         https://bugs.webkit.org/show_bug.cgi?id=191174
 
index 603a649..8d9dcbe 100644 (file)
@@ -1094,12 +1094,14 @@ WI.NetworkTableContentView = class NetworkTableContentView extends WI.ContentVie
         this._positionDetailView();
         this._positionEmptyFilterMessage();
         this._updateExportButton();
+    }
 
-        // FIXME: https://webkit.org/b/191176
-        setTimeout(() => {
-            if (this._waterfallPopover)
-                this._waterfallPopover.resize();
-        });
+    didLayoutSubtree()
+    {
+        super.didLayoutSubtree();
+
+        if (this._waterfallPopover)
+            this._waterfallPopover.resize();
     }
 
     handleClearShortcut(event)
index ce64d01..39bdd8b 100644 (file)
@@ -213,6 +213,13 @@ WI.View = class View extends WI.Object
         // Should not be called directly; use updateLayout() instead.
     }
 
+    didLayoutSubtree()
+    {
+        // Implemented by subclasses.
+
+        // Called after the view and its entire subtree have finished layout.
+    }
+
     sizeDidChange()
     {
         // Implemented by subclasses.
@@ -287,6 +294,8 @@ WI.View = class View extends WI.Object
         }
 
         this._layoutReason = null;
+
+        this.didLayoutSubtree();
     }
 
     _setLayoutReason(layoutReason)