Title: [222566] trunk/Source/WebInspectorUI
Revision
222566
Author
[email protected]
Date
2017-09-27 11:58:02 -0700 (Wed, 27 Sep 2017)

Log Message

Web Inspector: Fix Layers tab sidebar popover.
https://bugs.webkit.org/show_bug.cgi?id=177477

Patch by Ross Kirsling <[email protected]> on 2017-09-27
Reviewed by Matt Baker.

* UserInterface/Views/LayerDetailsSidebarPanel.js:
(WI.LayerDetailsSidebarPanel.prototype.willDismissPopover): Added.
(WI.LayerDetailsSidebarPanel.prototype._buildDataGrid):
(WI.LayerDetailsSidebarPanel.prototype._sortDataGrid):
(WI.LayerDetailsSidebarPanel.prototype._dataGridSelectedNodeChanged):
(WI.LayerDetailsSidebarPanel.prototype._dataGridFocused):
(WI.LayerDetailsSidebarPanel.prototype._dataGridBlurred):
(WI.LayerDetailsSidebarPanel.prototype._showPopoverForSelectedNode): Refactored.
(WI.LayerDetailsSidebarPanel.prototype._presentPopover):
(WI.LayerDetailsSidebarPanel.prototype._dataGridClicked): Deleted -- not actually desired behavior.
(WI.LayerDetailsSidebarPanel.prototype._updatePopoverForSelectedNode): Deleted -- code simplification.
(WI.LayerDetailsSidebarPanel.prototype._hidePopover): Deleted -- no longer needed.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (222565 => 222566)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-09-27 18:54:39 UTC (rev 222565)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-09-27 18:58:02 UTC (rev 222566)
@@ -1,3 +1,23 @@
+2017-09-27  Ross Kirsling  <[email protected]>
+
+        Web Inspector: Fix Layers tab sidebar popover.
+        https://bugs.webkit.org/show_bug.cgi?id=177477
+
+        Reviewed by Matt Baker.
+
+        * UserInterface/Views/LayerDetailsSidebarPanel.js:
+        (WI.LayerDetailsSidebarPanel.prototype.willDismissPopover): Added.
+        (WI.LayerDetailsSidebarPanel.prototype._buildDataGrid):
+        (WI.LayerDetailsSidebarPanel.prototype._sortDataGrid):
+        (WI.LayerDetailsSidebarPanel.prototype._dataGridSelectedNodeChanged):
+        (WI.LayerDetailsSidebarPanel.prototype._dataGridFocused):
+        (WI.LayerDetailsSidebarPanel.prototype._dataGridBlurred):
+        (WI.LayerDetailsSidebarPanel.prototype._showPopoverForSelectedNode): Refactored.
+        (WI.LayerDetailsSidebarPanel.prototype._presentPopover):
+        (WI.LayerDetailsSidebarPanel.prototype._dataGridClicked): Deleted -- not actually desired behavior.
+        (WI.LayerDetailsSidebarPanel.prototype._updatePopoverForSelectedNode): Deleted -- code simplification.
+        (WI.LayerDetailsSidebarPanel.prototype._hidePopover): Deleted -- no longer needed.
+
 2017-09-27  Fujii Hironori  <[email protected]>
 
         [GTK] Web Inspector: Add Canvas2D.svg and Canvas3D.svg

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js (222565 => 222566)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js	2017-09-27 18:54:39 UTC (rev 222565)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayerDetailsSidebarPanel.js	2017-09-27 18:58:02 UTC (rev 222566)
@@ -55,6 +55,11 @@
         return !!layers.length;
     }
 
+    willDismissPopover()
+    {
+        this._popover = null;
+    }
+
     // Private
 
     _buildDataGrid()
@@ -88,7 +93,6 @@
 
         this._dataGrid.element.addEventListener("focus", this._dataGridFocused.bind(this), false);
         this._dataGrid.element.addEventListener("blur", this._dataGridBlurred.bind(this), false);
-        this._dataGrid.element.addEventListener("click", this._dataGridClicked.bind(this), false);
 
         this.contentView.addSubview(this._dataGrid);
     }
@@ -116,7 +120,6 @@
         }
 
         this._dataGrid.sortNodes(comparator);
-        this._updatePopoverForSelectedNode();
     }
 
     _dataGridSelectedNodeChanged()
@@ -124,30 +127,20 @@
         if (this._dataGrid.selectedNode) {
             this._highlightSelectedNode();
             this._showPopoverForSelectedNode();
-        } else {
+        } else
             WI.domTreeManager.hideDOMNodeHighlight();
-            this._hidePopover();
-        }
     }
 
     _dataGridFocused(event)
     {
         this._highlightSelectedNode();
-        this._showPopoverForSelectedNode();
     }
 
     _dataGridBlurred(event)
     {
         WI.domTreeManager.hideDOMNodeHighlight();
-        this._hidePopover();
     }
 
-    _dataGridClicked(event)
-    {
-        if (this._dataGrid.selectedNode && event.target.parentNode.classList.contains("filler"))
-            this._dataGrid.selectedNode.deselect();
-    }
-
     _highlightSelectedNode()
     {
         if (!this._dataGrid.selectedNode)
@@ -228,35 +221,23 @@
             return;
 
         this._contentForPopover(dataGridNode.layer, (content) => {
-            if (dataGridNode === this._dataGrid.selectedNode)
-                this._updatePopoverForSelectedNode(content);
+            if (dataGridNode !== this._dataGrid.selectedNode)
+                return;
+
+            this._popover = this._popover || new WI.Popover(this);
+            this._popover.content = content;
+            this._popover.windowResizeHandler = () => { this._presentPopover(); };
+
+            this._presentPopover();
         });
     }
 
-    _updatePopoverForSelectedNode(content)
+    _presentPopover()
     {
-        if (!this._dataGrid.selectedNode)
-            return;
-
-        if (!this._popover) {
-            this._popover = new WI.Popover;
-            this._popover.windowResizeHandler = () => { this._updatePopoverForSelectedNode(); };
-        }
-
         let targetFrame = WI.Rect.rectFromClientRect(this._dataGrid.selectedNode.element.getBoundingClientRect());
-
-        if (content)
-            this._popover.content = content;
-
         this._popover.present(targetFrame.pad(2), [WI.RectEdge.MIN_X]);
     }
 
-    _hidePopover()
-    {
-        if (this._popover)
-            this._popover.dismiss();
-    }
-
     _contentForPopover(layer, callback)
     {
         let content = document.createElement("div");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to