Title: [272976] trunk/Source/WebInspectorUI
Revision
272976
Author
commit-qu...@webkit.org
Date
2021-02-16 19:47:18 -0800 (Tue, 16 Feb 2021)

Log 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 <rcali...@apple.com> 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):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (272975 => 272976)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-02-17 02:42:23 UTC (rev 272975)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-02-17 03:47:18 UTC (rev 272976)
@@ -1,5 +1,21 @@
 2021-02-16  Razvan Caliman  <rcali...@apple.com>
 
+        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>
+
+        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):
+
+2021-02-16  Razvan Caliman  <rcali...@apple.com>
+
         Web Inspector: Grid list in Layout panel missing empty message
         https://bugs.webkit.org/show_bug.cgi?id=221763
         <rdar://problem/74242610>

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/OverlayManager.js (272975 => 272976)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/OverlayManager.js	2021-02-17 02:42:23 UTC (rev 272975)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/OverlayManager.js	2021-02-17 03:47:18 UTC (rev 272976)
@@ -53,6 +53,7 @@
 
         console.assert(domNode instanceof WI.DOMNode, domNode);
         console.assert(!color || color instanceof WI.Color, color);
+        console.assert(domNode.layoutContextType === WI.DOMNode.LayoutContextType.Grid, domNode.layoutContextType);
 
         color ||= WI.Color.fromString("magenta"); // fallback color
 
@@ -71,6 +72,7 @@
         let overlay = {domNode, ...commandArguments};
         this._gridOverlayForNodeMap.set(domNode, overlay);
 
+        domNode.addEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);
         this.dispatchEventToListeners(WI.OverlayManager.Event.GridOverlayShown, overlay);
     }
 
@@ -78,6 +80,7 @@
     {
         console.assert(domNode instanceof WI.DOMNode, domNode);
         console.assert(!domNode.destroyed, domNode);
+        console.assert(domNode.layoutContextType === WI.DOMNode.LayoutContextType.Grid, domNode.layoutContextType);
         if (domNode.destroyed)
             return;
 
@@ -88,11 +91,24 @@
         let target = WI.assumingMainTarget();
         target.DOMAgent.hideGridOverlay(domNode.id);
 
+        domNode.removeEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);
         this.dispatchEventToListeners(WI.OverlayManager.Event.GridOverlayHidden, overlay);
     }
 
     // Private
 
+    _handleLayoutContextTypeChanged(event)
+    {
+        let domNode = event.target;
+        console.assert(domNode.layoutContextType !== WI.DOMNode.LayoutContextType.Grid, domNode);
+
+        domNode.removeEventListener(WI.DOMNode.Event.LayoutContextTypeChanged, this._handleLayoutContextTypeChanged, this);
+
+        // When the context type changes, the overlay is automatically hidden on the backend. Here, we only update the map and notify listeners.
+        let overlay = this._gridOverlayForNodeMap.take(domNode);
+        this.dispatchEventToListeners(WI.OverlayManager.Event.GridOverlayHidden, overlay);
+    }
+
     _handleGridSettingChanged(event)
     {
         for (let [domNode, overlay] of this._gridOverlayForNodeMap) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to