Title: [200792] trunk/Source/WebInspectorUI
Revision
200792
Author
[email protected]
Date
2016-05-12 15:08:28 -0700 (Thu, 12 May 2016)

Log Message

Web Inspector: Layout timeline popovers are inconsistently shown
https://bugs.webkit.org/show_bug.cgi?id=157640
<rdar://problem/26253394>

Patch by Joseph Pecoraro <[email protected]> on 2016-05-12
Reviewed by Timothy Hatcher.

* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype._showPopoverForSelectedNodeSoon):
Fix the bug by clearing _showPopoverTimeout when we show the popover.

(WebInspector.TimelineDataGrid.prototype._hidePopover):
Modernize the code to use arrow functions and avoid binds.

(WebInspector.TimelineDataGrid.prototype._updatePopoverForSelectedNode):
Updating with presentNewContentWithFrame animates the popover to the correct
position instead of jumping and ending up at the wrong location.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (200791 => 200792)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-05-12 22:06:57 UTC (rev 200791)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-05-12 22:08:28 UTC (rev 200792)
@@ -1,5 +1,24 @@
 2016-05-12  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Layout timeline popovers are inconsistently shown
+        https://bugs.webkit.org/show_bug.cgi?id=157640
+        <rdar://problem/26253394>
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/TimelineDataGrid.js:
+        (WebInspector.TimelineDataGrid.prototype._showPopoverForSelectedNodeSoon):
+        Fix the bug by clearing _showPopoverTimeout when we show the popover.
+
+        (WebInspector.TimelineDataGrid.prototype._hidePopover):
+        Modernize the code to use arrow functions and avoid binds.
+
+        (WebInspector.TimelineDataGrid.prototype._updatePopoverForSelectedNode):
+        Updating with presentNewContentWithFrame animates the popover to the correct
+        position instead of jumping and ending up at the wrong location.
+
+2016-05-12  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Remove forced layouts caused by DOMTreeElement during Timeline recording
         https://bugs.webkit.org/show_bug.cgi?id=157641
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js (200791 => 200792)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js	2016-05-12 22:06:57 UTC (rev 200791)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js	2016-05-12 22:08:28 UTC (rev 200792)
@@ -450,15 +450,12 @@
         if (this._showPopoverTimeout)
             return;
 
-        function delayedWork()
-        {
+        this._showPopoverTimeout = setTimeout(() => {
             if (!this._popover)
                 this._popover = new WebInspector.Popover;
-
             this._updatePopoverForSelectedNode(true);
-        }
-
-        this._showPopoverTimeout = setTimeout(delayedWork.bind(this), WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout);
+            this._showPopoverTimeout = undefined;
+        }, WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout);
     }
 
     _hidePopover()
@@ -471,15 +468,13 @@
         if (this._popover)
             this._popover.dismiss();
 
-        function delayedWork()
-        {
-            if (this._popoverCallStackTreeOutline)
-                this._popoverCallStackTreeOutline.removeChildren();
-        }
-
         if (this._hidePopoverContentClearTimeout)
             clearTimeout(this._hidePopoverContentClearTimeout);
-        this._hidePopoverContentClearTimeout = setTimeout(delayedWork.bind(this), WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout);
+
+        this._hidePopoverContentClearTimeout = setTimeout(() => {
+            if (this._popoverCallStackTreeOutline)
+                this._popoverCallStackTreeOutline.removeChildren();
+        }, WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout);
     }
 
     _updatePopoverForSelectedNode(updateContent)
@@ -487,15 +482,14 @@
         if (!this._popover || !this.selectedNode)
             return;
 
-        var targetPopoverElement = this.callFramePopoverAnchorElement();
+        let targetPopoverElement = this.callFramePopoverAnchorElement();
         console.assert(targetPopoverElement, "TimelineDataGrid subclass should always return a valid element from callFramePopoverAnchorElement.");
         if (!targetPopoverElement)
             return;
 
-        var targetFrame = WebInspector.Rect.rectFromClientRect(targetPopoverElement.getBoundingClientRect());
-
         // The element might be hidden if it does not have a width and height.
-        if (!targetFrame.size.width && !targetFrame.size.height)
+        let rect = WebInspector.Rect.rectFromClientRect(targetPopoverElement.getBoundingClientRect());
+        if (!rect.size.width && !targetFrame.rect.height)
             return;
 
         if (this._hidePopoverContentClearTimeout) {
@@ -503,10 +497,13 @@
             this._hidePopoverContentClearTimeout = undefined;
         }
 
-        if (updateContent)
-            this._popover.content = this._createPopoverContent();
+        let targetFrame = rect.pad(2);
+        let preferredEdges = [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X];
 
-        this._popover.present(targetFrame.pad(2), [WebInspector.RectEdge.MAX_Y, WebInspector.RectEdge.MIN_Y, WebInspector.RectEdge.MAX_X]);
+        if (updateContent)
+            this._popover.presentNewContentWithFrame(this._createPopoverContent(), targetFrame, preferredEdges);
+        else
+            this._popover.present(targetFrame, preferredEdges);
     }
 
     _createPopoverContent()
@@ -548,8 +545,6 @@
     }
 };
 
-WebInspector.TimelineDataGrid.WasExpandedDuringFilteringSymbol = Symbol("was-expanded-during-filtering");
-
 WebInspector.TimelineDataGrid.HasNonDefaultFilterStyleClassName = "has-non-default-filter";
 WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout = 250;
 WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout = 500;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to