Title: [276170] trunk/Source/WebInspectorUI
Revision
276170
Author
[email protected]
Date
2021-04-16 14:22:00 -0700 (Fri, 16 Apr 2021)

Log Message

Web Inspector: REGRESSION(?): Graphics: dropping a recording leaves behind a drop zone view
https://bugs.webkit.org/show_bug.cgi?id=224648

Reviewed by BJ Burg.

* UserInterface/Views/GraphicsTabContentView.js:
(WI.GraphicsTabContentView.prototype.initialLayout):
It appears that it's possible for re-entrancy issues in the `WI.View` system since the
`_didInitialLayout` flag isn't set until _after_ `initialLayout` returns, meaning that if
the logic inside `initialLayout` triggers a synchronous `layout` then that second `layout`
won't know that it's already in the middle of an `initialLayout`. In this case, showing the
`WI.GraphicsOverviewContentView` causes the navigation sidebar to be shown, which forces a
synchronous `layout` from handling `WI.Sidebar.Event.WidthDidChange`. For now, there's no
"rush" to show the `WI.GraphicsOverviewContentView` so we delay it by one event loop turn.

* UserInterface/Views/CanvasContentView.js:
(WI.CanvasContentView.prototype.initialLayout):
(WI.CanvasContentView.prototype.dropZoneShouldAppearForDragEvent): Deleted.
(WI.CanvasContentView.prototype.dropZoneHandleDrop): Deleted.
There's no reason to have another `WI.DropZoneView` here since there's already one that
covers the entire tab.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (276169 => 276170)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-04-16 21:13:11 UTC (rev 276169)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-04-16 21:22:00 UTC (rev 276170)
@@ -1,5 +1,29 @@
 2021-04-16  Devin Rousso  <[email protected]>
 
+        Web Inspector: REGRESSION(?): Graphics: dropping a recording leaves behind a drop zone view
+        https://bugs.webkit.org/show_bug.cgi?id=224648
+
+        Reviewed by BJ Burg.
+
+        * UserInterface/Views/GraphicsTabContentView.js:
+        (WI.GraphicsTabContentView.prototype.initialLayout):
+        It appears that it's possible for re-entrancy issues in the `WI.View` system since the
+        `_didInitialLayout` flag isn't set until _after_ `initialLayout` returns, meaning that if
+        the logic inside `initialLayout` triggers a synchronous `layout` then that second `layout`
+        won't know that it's already in the middle of an `initialLayout`. In this case, showing the
+        `WI.GraphicsOverviewContentView` causes the navigation sidebar to be shown, which forces a
+        synchronous `layout` from handling `WI.Sidebar.Event.WidthDidChange`. For now, there's no
+        "rush" to show the `WI.GraphicsOverviewContentView` so we delay it by one event loop turn.
+
+        * UserInterface/Views/CanvasContentView.js:
+        (WI.CanvasContentView.prototype.initialLayout):
+        (WI.CanvasContentView.prototype.dropZoneShouldAppearForDragEvent): Deleted.
+        (WI.CanvasContentView.prototype.dropZoneHandleDrop): Deleted.
+        There's no reason to have another `WI.DropZoneView` here since there's already one that
+        covers the entire tab.
+
+2021-04-16  Devin Rousso  <[email protected]>
+
         Web Inspector: Uncaught Exception: null is not an object (evaluating 'this._listeners.get')
         https://bugs.webkit.org/show_bug.cgi?id=224651
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js (276169 => 276170)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js	2021-04-16 21:13:11 UTC (rev 276169)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js	2021-04-16 21:22:00 UTC (rev 276170)
@@ -82,24 +82,6 @@
         this.refreshPreview();
     }
 
-    // DropZoneView delegate
-
-    dropZoneShouldAppearForDragEvent(dropZone, event)
-    {
-        return event.dataTransfer.types.includes("Files");
-    }
-
-    dropZoneHandleDrop(dropZone, event)
-    {
-        let files = event.dataTransfer.files;
-        if (files.length !== 1) {
-            InspectorFrontendHost.beep();
-            return;
-        }
-
-        WI.FileUtilities.readJSON(files, (result) => WI.canvasManager.processJSON(result));
-    }
-
     // Protected
 
     initialLayout()
@@ -183,13 +165,6 @@
 
         if (isCard)
             this._refreshPixelSize();
-
-        if (!isCard) {
-            let dropZoneView = new WI.DropZoneView(this);
-            dropZoneView.text = WI.UIString("Import Recording");
-            dropZoneView.targetElement = this.element;
-            this.addSubview(dropZoneView);
-        }
     }
 
     layout()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/GraphicsTabContentView.js (276169 => 276170)


--- trunk/Source/WebInspectorUI/UserInterface/Views/GraphicsTabContentView.js	2021-04-16 21:13:11 UTC (rev 276169)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/GraphicsTabContentView.js	2021-04-16 21:22:00 UTC (rev 276170)
@@ -203,8 +203,12 @@
         super.initialLayout();
 
         this._overviewContentView = new WI.GraphicsOverviewContentView;
-        this.contentBrowser.showContentView(this._overviewContentView);
 
+        // FIXME: <https://webkit.org/b/224650> (Web Inspector: audit for re-entrancy issues with `initialLayout` and `layout`)
+        setTimeout(() => {
+            this.contentBrowser.showContentView(this._overviewContentView);
+        });
+
         let dropZoneView = new WI.DropZoneView(this);
         dropZoneView.text = WI.UIString("Import Recording");
         dropZoneView.targetElement = this.element;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to