Title: [249848] trunk/Source/WebInspectorUI
Revision
249848
Author
joep...@webkit.org
Date
2019-09-13 12:08:49 -0700 (Fri, 13 Sep 2019)

Log Message

Web Inspector: Tighter autocomplete bubbles
https://bugs.webkit.org/show_bug.cgi?id=201742

Reviewed by Timothy Hatcher.

* UserInterface/Views/CompletionSuggestionsView.js:
(WI.CompletionSuggestionsView.prototype.show):
Eliminate the trailing space. Use bounding client rect to get
fractional widths and raise the value so we are at an even number.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (249847 => 249848)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-09-13 19:02:59 UTC (rev 249847)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-09-13 19:08:49 UTC (rev 249848)
@@ -1,5 +1,17 @@
 2019-09-13  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: Tighter autocomplete bubbles
+        https://bugs.webkit.org/show_bug.cgi?id=201742
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Views/CompletionSuggestionsView.js:
+        (WI.CompletionSuggestionsView.prototype.show):
+        Eliminate the trailing space. Use bounding client rect to get
+        fractional widths and raise the value so we are at an even number.
+
+2019-09-13  Joseph Pecoraro  <pecor...@apple.com>
+
         REGRESSION: Web Inspector: Layout Timeline View does not show popover for initiator data
         https://bugs.webkit.org/show_bug.cgi?id=201732
         <rdar://problem/55312339>

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js (249847 => 249848)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js	2019-09-13 19:02:59 UTC (rev 249847)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CompletionSuggestionsView.js	2019-09-13 19:08:49 UTC (rev 249848)
@@ -119,35 +119,34 @@
         this._containerElement.style.position = "absolute";
         document.body.appendChild(this._containerElement);
 
-        var containerWidth = this._containerElement.offsetWidth;
-        var containerHeight = this._containerElement.offsetHeight;
+        let intrinsicSize = this._containerElement.getBoundingClientRect();
+        let containerWidth = Math.ceil(intrinsicSize.width);
+        let containerHeight = Math.ceil(intrinsicSize.height);
 
         this._containerElement.removeAttribute("style");
         this._element.appendChild(this._containerElement);
 
         // Lay out the suggest-box relative to the anchorBounds.
-        var margin = 10;
-        var horizontalPadding = 22;
-        var absoluteMaximumHeight = 160;
+        let margin = 10;
+        let absoluteMaximumHeight = 160;
 
-        var x = anchorBounds.origin.x;
-        var y = anchorBounds.origin.y + anchorBounds.size.height;
+        let x = anchorBounds.origin.x;
+        let y = anchorBounds.origin.y + anchorBounds.size.height;
 
-        var maximumWidth = window.innerWidth - anchorBounds.origin.x - margin;
-        var width = Math.min(containerWidth, maximumWidth - horizontalPadding) + horizontalPadding;
-        var paddedWidth = containerWidth + horizontalPadding;
+        let maximumWidth = window.innerWidth - anchorBounds.origin.x - margin;
+        let width = Math.min(containerWidth, maximumWidth);
 
-        if (width < paddedWidth) {
+        if (width < containerWidth) {
             // Shift the suggest box to the left to accommodate the content without trimming to the BODY edge.
             maximumWidth = window.innerWidth - margin;
-            width = Math.min(containerWidth, maximumWidth - horizontalPadding) + horizontalPadding;
+            width = Math.min(containerWidth, maximumWidth);
             x = document.body.offsetWidth - width;
         }
 
-        var aboveHeight = anchorBounds.origin.y;
-        var underHeight = window.innerHeight - anchorBounds.origin.y - anchorBounds.size.height;
-        var maximumHeight = Math.min(absoluteMaximumHeight, Math.max(underHeight, aboveHeight) - margin);
-        var height = Math.min(containerHeight, maximumHeight);
+        let aboveHeight = anchorBounds.origin.y;
+        let underHeight = window.innerHeight - anchorBounds.origin.y - anchorBounds.size.height;
+        let maximumHeight = Math.min(absoluteMaximumHeight, Math.max(underHeight, aboveHeight) - margin);
+        let height = Math.min(containerHeight, maximumHeight);
 
         // Position the suggestions below the anchor. If there is no room, position the suggestions above.
         if (underHeight - height < 0)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to