Bug 1571653: Reshow as parent grid if the grid which we hid is a parent of a subgrid highlighting. r=gl
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Thu, 15 Aug 2019 05:01:26 +0000
changeset 488180 b38497a0592a98311f29f80f68e23530356dd4cb
parent 488179 9e513ae4747fad12001ef627e6f273624a3feff4
child 488181 be174ffafb1d907a290e5838cca043ead0cd9443
push id36437
push userncsoregi@mozilla.com
push dateThu, 15 Aug 2019 19:33:18 +0000
treeherdermozilla-central@44aac6fc3352 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1571653
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1571653: Reshow as parent grid if the grid which we hid is a parent of a subgrid highlighting. r=gl Differential Revision: https://phabricator.services.mozilla.com/D41700
devtools/client/inspector/shared/highlighters-overlay.js
--- a/devtools/client/inspector/shared/highlighters-overlay.js
+++ b/devtools/client/inspector/shared/highlighters-overlay.js
@@ -667,19 +667,23 @@ class HighlightersOverlay {
       this.subgridToParentMap.delete(node);
       await this.hideParentGridHighlighter(parentGridNode);
     }
 
     // Check if the given node matches any of the subgrid's parent grid container.
     // Since the subgrid and its parent grid container were previously both highlighted
     // and the parent grid container (the given node) has just been hidden, show a
     // translucent highlight of the parent grid container.
-    for (const parentGridNode of this.subgridToParentMap.values()) {
-      if (parentGridNode === node) {
-        await this.showParentGridHighlighter(parentGridNode);
+    for (const highlightedNode of this.gridHighlighters.keys()) {
+      const parentGridNode = await this.walker.getParentGridNode(
+        highlightedNode
+      );
+      if (node === parentGridNode) {
+        this.subgridToParentMap.set(highlightedNode, node);
+        await this.showParentGridHighlighter(node);
         break;
       }
     }
 
     this._toggleRuleViewIcon(node, false, ".ruleview-grid");
 
     if (this.isGridHighlighterTimerActive && !this.gridHighlighters.size) {
       this.telemetry.toolClosed(
@@ -708,18 +712,20 @@ class HighlightersOverlay {
       if (parentGridNode === node) {
         // Don't hide the parent grid highlighter if another subgrid is highlighted
         // with the given parent node.
         return;
       }
     }
 
     const highlighter = this.parentGridHighlighters.get(node);
-    await highlighter.hide();
-    this.extraGridHighlighterPool.push(highlighter);
+    if (highlighter) {
+      await highlighter.hide();
+      this.extraGridHighlighterPool.push(highlighter);
+    }
     this.state.grids.delete(node);
     this.parentGridHighlighters.delete(node);
   }
 
   /**
    * Show the box model highlighter for the given node.
    *
    * @param  {NodeFront} node