Bug 1406509 - Search results are truncated and left aligned in RTL languages. r=mak, a=ritu
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 10 Oct 2017 14:25:58 +0100
changeset 432451 94cb468585934ecc5bd6b0f617d483a14359e69b
parent 432450 f66f3fd671001bfdc83d630d2f79aeebb7cf8a74
child 432452 c8d3b27528f758e9291946fa16b1269b6ec71acb
push id7955
push userryanvm@gmail.com
push dateThu, 12 Oct 2017 18:26:39 +0000
treeherdermozilla-beta@c8d3b27528f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak, ritu
bugs1406509
milestone57.0
Bug 1406509 - Search results are truncated and left aligned in RTL languages. r=mak, a=ritu MozReview-Commit-ID: 8a68U05wggj
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1917,18 +1917,21 @@ file, You can obtain one at http://mozil
           let boundToCheck = popupDirection == "rtl" ? "right" : "left";
           let inputRect = this.DOMWindowUtils.getBoundsWithoutFlushing(aInput);
           let startOffset = Math.abs(inputRect[boundToCheck] - documentRect[boundToCheck]);
           let alignSiteIcons = startOffset / width <= 0.3 || startOffset <= 250;
           if (alignSiteIcons) {
             let identityIcon = document.getElementById("identity-icon");
             let identityRect =
               this.DOMWindowUtils.getBoundsWithoutFlushing(identityIcon);
-            this.siteIconStart = popupDirection == "rtl" ? identityRect.right
-                                                         : identityRect.left;
+            if (popupDirection == "rtl") {
+              this.siteIconStart = documentRect.right - identityRect.right;
+            } else {
+              this.siteIconStart = identityRect.left;
+            }
           } else {
             // Reset the alignment so that the site icons are positioned
             // according to whatever's in the CSS.
             this.siteIconStart = undefined;
           }
 
           // Now that siteIconStart has been set, start adding items (via
           // _invalidate).
@@ -1973,20 +1976,18 @@ file, You can obtain one at http://mozil
         <parameter name="popupDirection"/>
         <body>
           <![CDATA[
           let deckIndex = 0;
           if (whichNotification == "opt-out") {
             deckIndex = 1;
 
             if (this.siteIconStart) {
-              let rect = this.DOMWindowUtils.getBoundsWithoutFlushing(window.document.documentElement);
-              let padding = popupDirection == "rtl" ? rect.right - this.siteIconStart
-                                                    : this.siteIconStart;
-              this.searchSuggestionsNotification.style.paddingInlineStart = padding + "px";
+              this.searchSuggestionsNotification.style.paddingInlineStart =
+                this.siteIconStart + "px";
             } else {
               this.searchSuggestionsNotification.style.removeProperty("padding-inline-start");
             }
 
             // We want to animate the opt-out hint only once.
             if (!this._firstSearchSuggestionsNotification) {
               this._firstSearchSuggestionsNotification = true;
               this.searchSuggestionsNotification.setAttribute("animate", "true");