⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276170 in webkit


Ignore:
Timestamp:
Apr 16, 2021, 2:22:00 PM (5 years ago)
Author:
Devin Rousso
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.

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r276146 r276170  
     12021-04-16  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: REGRESSION(?): Graphics: dropping a recording leaves behind a drop zone view
     4        https://bugs.webkit.org/show_bug.cgi?id=224648
     5
     6        Reviewed by BJ Burg.
     7
     8        * UserInterface/Views/GraphicsTabContentView.js:
     9        (WI.GraphicsTabContentView.prototype.initialLayout):
     10        It appears that it's possible for re-entrancy issues in the `WI.View` system since the
     11        `_didInitialLayout` flag isn't set until _after_ `initialLayout` returns, meaning that if
     12        the logic inside `initialLayout` triggers a synchronous `layout` then that second `layout`
     13        won't know that it's already in the middle of an `initialLayout`. In this case, showing the
     14        `WI.GraphicsOverviewContentView` causes the navigation sidebar to be shown, which forces a
     15        synchronous `layout` from handling `WI.Sidebar.Event.WidthDidChange`. For now, there's no
     16        "rush" to show the `WI.GraphicsOverviewContentView` so we delay it by one event loop turn.
     17
     18        * UserInterface/Views/CanvasContentView.js:
     19        (WI.CanvasContentView.prototype.initialLayout):
     20        (WI.CanvasContentView.prototype.dropZoneShouldAppearForDragEvent): Deleted.
     21        (WI.CanvasContentView.prototype.dropZoneHandleDrop): Deleted.
     22        There's no reason to have another `WI.DropZoneView` here since there's already one that
     23        covers the entire tab.
     24
    1252021-04-16  Devin Rousso  <drousso@apple.com>
    226
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js

    r269359 r276170  
    8383    }
    8484
    85     // DropZoneView delegate
    86 
    87     dropZoneShouldAppearForDragEvent(dropZone, event)
    88     {
    89         return event.dataTransfer.types.includes("Files");
    90     }
    91 
    92     dropZoneHandleDrop(dropZone, event)
    93     {
    94         let files = event.dataTransfer.files;
    95         if (files.length !== 1) {
    96             InspectorFrontendHost.beep();
    97             return;
    98         }
    99 
    100         WI.FileUtilities.readJSON(files, (result) => WI.canvasManager.processJSON(result));
    101     }
    102 
    10385    // Protected
    10486
     
    184166        if (isCard)
    185167            this._refreshPixelSize();
    186 
    187         if (!isCard) {
    188             let dropZoneView = new WI.DropZoneView(this);
    189             dropZoneView.text = WI.UIString("Import Recording");
    190             dropZoneView.targetElement = this.element;
    191             this.addSubview(dropZoneView);
    192         }
    193168    }
    194169
  • trunk/Source/WebInspectorUI/UserInterface/Views/GraphicsTabContentView.js

    r266464 r276170  
    204204
    205205        this._overviewContentView = new WI.GraphicsOverviewContentView;
    206         this.contentBrowser.showContentView(this._overviewContentView);
     206
     207        // FIXME: <https://webkit.org/b/224650> (Web Inspector: audit for re-entrancy issues with `initialLayout` and `layout`)
     208        setTimeout(() => {
     209            this.contentBrowser.showContentView(this._overviewContentView);
     210        });
    207211
    208212        let dropZoneView = new WI.DropZoneView(this);
Note: See TracChangeset for help on using the changeset viewer.