Bug 1543661 - Instead of rounding to integer, use more precision when setting px values. r=mak
authorDão Gottwald <dao@mozilla.com>
Mon, 15 Apr 2019 13:05:03 +0000
changeset 469531 d525a800fe208083107f96d2101661e3cf4b1021
parent 469530 ea02b41a2b1d797cfaa4b1ebdf9d07405608fb06
child 469532 4e44a4a0495a2753160ca76247effe746919c847
push id83199
push userdgottwald@mozilla.com
push dateMon, 15 Apr 2019 15:50:20 +0000
treeherderautoland@d525a800fe20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1543661
milestone68.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 1543661 - Instead of rounding to integer, use more precision when setting px values. r=mak Differential Revision: https://phabricator.services.mozilla.com/D27390
browser/components/urlbar/UrlbarView.jsm
--- a/browser/components/urlbar/UrlbarView.jsm
+++ b/browser/components/urlbar/UrlbarView.jsm
@@ -337,21 +337,22 @@ class UrlbarView {
       return;
     }
     this.controller.userSelectionBehavior = "none";
 
     this.panel.removeAttribute("hidden");
     this.panel.removeAttribute("actionoverride");
 
     // Make the panel span the width of the window.
+    let px = number => number.toFixed(2) + "px";
     let documentRect =
       this._getBoundsWithoutFlushing(this.document.documentElement);
     let width = documentRect.right - documentRect.left;
     this.panel.setAttribute("width", width);
-    this._mainContainer.style.maxWidth = width + "px";
+    this._mainContainer.style.maxWidth = px(width);
 
     // Keep the popup items' site icons aligned with the input's identity
     // icon if it's not too far from the edge of the window.  We define
     // "too far" as "more than 30% of the window's width AND more than
     // 250px".
     let contentWidth = width;
     let boundToCheck = this.window.RTL_UI ? "right" : "left";
     let inputRect = this._getBoundsWithoutFlushing(this.input.textbox);
@@ -369,32 +370,32 @@ class UrlbarView {
         endOffset = startOffset;
       }
       let identityIcon = this.document.getElementById("identity-icon");
       let identityRect = this._getBoundsWithoutFlushing(identityIcon);
       let start = this.window.RTL_UI ?
                     documentRect.right - identityRect.right :
                     identityRect.left;
 
-      this.panel.style.setProperty("--item-padding-start", Math.round(start) + "px");
-      this.panel.style.setProperty("--item-padding-end", Math.round(endOffset) + "px");
+      this.panel.style.setProperty("--item-padding-start", px(start));
+      this.panel.style.setProperty("--item-padding-end", px(endOffset));
       contentWidth -= start + endOffset;
     } else {
       this.panel.style.removeProperty("--item-padding-start");
       this.panel.style.removeProperty("--item-padding-end");
     }
-    this.panel.style.setProperty("--item-content-width", Math.round(contentWidth) + "px");
+    this.panel.style.setProperty("--item-content-width", px(contentWidth));
 
     // Align the panel with the input's parent toolbar.
     let toolbarRect =
       this._getBoundsWithoutFlushing(this.input.textbox.closest("toolbar"));
-    this.panel.style.marginInlineStart = Math.round(this.window.RTL_UI ?
+    this.panel.style.marginInlineStart = px(this.window.RTL_UI ?
       inputRect.right - documentRect.right :
-      documentRect.left - inputRect.left) + "px";
-    this.panel.style.marginTop = Math.round(inputRect.top - toolbarRect.top) + "px";
+      documentRect.left - inputRect.left);
+    this.panel.style.marginTop = px(inputRect.top - toolbarRect.top);
 
     this.panel.openPopup(this.input.textbox, "after_start");
   }
 
   _createRow() {
     let item = this._createElement("div");
     item.className = "urlbarView-row";
     item.setAttribute("role", "option");