Changeset 272976 in webkit


Ignore:
Timestamp:
Feb 16, 2021 7:47:18 PM (17 months ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Grids with overlays that disappear and reappear remain checked in Layout pane, toggling hits assertion
https://bugs.webkit.org/show_bug.cgi?id=221919
<rdar://problem/74363006>

Patch by Razvan Caliman <Razvan Caliman> on 2021-02-16
Reviewed by Devin Rousso.

When a DOMNode's grid layout context changes to something else,
its corresponding shown grid overlay is automatically hidden on the backend.
The frontend needs to update its mapping of nodes to overlays and notify listeners of the change in state.

  • UserInterface/Controllers/OverlayManager.js:

(WI.OverlayManager):
(WI.OverlayManager.prototype._handleLayoutContextTypeChanged):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r272934 r272976  
     12021-02-16  Razvan Caliman  <rcaliman@apple.com>
     2
     3        Web Inspector: Grids with overlays that disappear and reappear remain checked in Layout pane, toggling hits assertion
     4        https://bugs.webkit.org/show_bug.cgi?id=221919
     5        <rdar://problem/74363006>
     6
     7        Reviewed by Devin Rousso.
     8
     9        When a DOMNode's grid layout context changes to something else,
     10        its corresponding shown grid overlay is automatically hidden on the backend.
     11        The frontend needs to update its mapping of nodes to overlays and notify listeners of the change in state.
     12
     13        * UserInterface/Controllers/OverlayManager.js:
     14        (WI.OverlayManager):
     15        (WI.OverlayManager.prototype._handleLayoutContextTypeChanged):
     16
    1172021-02-16  Razvan Caliman  <rcaliman@apple.com>
    218
  • trunk/Source/WebInspectorUI/UserInterface/Controllers/OverlayManager.js

    r272737 r272976  
    5454        console.assert(domNode instanceof WI.DOMNode, domNode);
    5555        console.assert(!color || color instanceof WI.Color, color);
     56        console.assert(domNode.layoutContextType === WI.DOMNode.LayoutContextType.Grid, domNode.layoutContextType);
    5657
    5758        color ||= WI.Color.fromString("magenta"); // fallback color
     
    7273        this._gridOverlayForNodeMap.set(domNode, overlay);
    7374
     75        domNode.addEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);
    7476        this.dispatchEventToListeners(WI.OverlayManager.Event.GridOverlayShown, overlay);
    7577    }
     
    7981        console.assert(domNode instanceof WI.DOMNode, domNode);
    8082        console.assert(!domNode.destroyed, domNode);
     83        console.assert(domNode.layoutContextType === WI.DOMNode.LayoutContextType.Grid, domNode.layoutContextType);
    8184        if (domNode.destroyed)
    8285            return;
     
    8992        target.DOMAgent.hideGridOverlay(domNode.id);
    9093
     94        domNode.removeEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);
    9195        this.dispatchEventToListeners(WI.OverlayManager.Event.GridOverlayHidden, overlay);
    9296    }
    9397
    9498    // Private
     99
     100    _handleLayoutContextTypeChanged(event)
     101    {
     102        let domNode = event.target;
     103        console.assert(domNode.layoutContextType !== WI.DOMNode.LayoutContextType.Grid, domNode);
     104
     105        domNode.removeEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);
     106
     107        // When the context type changes, the overlay is automatically hidden on the backend. Here, we only update the map and notify listeners.
     108        let overlay = this._gridOverlayForNodeMap.take(domNode);
     109        this.dispatchEventToListeners(WI.OverlayManager.Event.GridOverlayHidden, overlay);
     110    }
    95111
    96112    _handleGridSettingChanged(event)
Note: See TracChangeset for help on using the changeset viewer.