Bug 1516533 - Stop setting CSS direction when opening the awesomebar popup. r=mak
authorDão Gottwald <dao@mozilla.com>
Thu, 03 Jan 2019 17:23:58 +0000
changeset 509626 8908b6922e23707e92e6bd7a55c5c5460f4fa717
parent 509625 46fd6f5124ff0e8cc890208ac92d8663606b7711
child 509627 0ca6e1f583f4444e415f375d8cd5ff88e3a2be9b
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1516533
milestone66.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 1516533 - Stop setting CSS direction when opening the awesomebar popup. r=mak Differential Revision: https://phabricator.services.mozilla.com/D15411
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -2123,64 +2123,61 @@ file, You can obtain one at http://mozil
       <method name="_openAutocompletePopup">
         <parameter name="aInput"/>
         <parameter name="aElement"/>
         <body><![CDATA[
           if (this.mPopupOpen) {
             return;
           }
 
-          // Set the direction of the popup based on the textbox (bug 649840).
-          let popupDirection = this.style.direction = (RTL_UI ? "rtl" : "ltr");
-
           // Make the popup span the width of the window.  First, set its width.
           let documentRect =
             window.windowUtils
                 .getBoundsWithoutFlushing(window.document.documentElement);
           let width = documentRect.right - documentRect.left;
           this.setAttribute("width", width);
 
           // Now make its starting margin negative so that its leading edge
           // aligns with the window border.
           let elementRect =
             window.windowUtils.getBoundsWithoutFlushing(aElement);
-          if (popupDirection == "rtl") {
+          if (RTL_UI) {
             let offset = elementRect.right - documentRect.right;
             this.style.marginRight = offset + "px";
           } else {
             let offset = documentRect.left - elementRect.left;
             this.style.marginLeft = offset + "px";
           }
 
           // Keep the popup items' site icons aligned with the urlbar'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".  Do this *before* adding any items because when the new
           // value of the margins are different from the previous value, over-
           // and underflow must be handled for each item already in the popup.
           let needsHandleOverUnderflow = false;
-          let boundToCheck = popupDirection == "rtl" ? "right" : "left";
+          let boundToCheck = RTL_UI ? "right" : "left";
           let inputRect = window.windowUtils.getBoundsWithoutFlushing(aInput);
           let startOffset = Math.abs(inputRect[boundToCheck] - documentRect[boundToCheck]);
           let alignSiteIcons = startOffset / width <= 0.3 || startOffset <= 250;
           if (alignSiteIcons) {
             // Calculate the end margin if we have a start margin.
-            let boundToCheckEnd = popupDirection == "rtl" ? "left" : "right";
+            let boundToCheckEnd = RTL_UI ? "left" : "right";
             let endOffset = Math.abs(inputRect[boundToCheckEnd] -
                                      documentRect[boundToCheckEnd]);
             if (endOffset > startOffset * 2) {
               // Provide more space when aligning would result in an unbalanced
               // margin. This allows the location bar to be moved to the start
               // of the navigation toolbar to reclaim space for results.
               endOffset = startOffset;
             }
             let identityIcon = document.getElementById("identity-icon");
             let identityRect =
               window.windowUtils.getBoundsWithoutFlushing(identityIcon);
-            let start = popupDirection == "rtl" ?
+            let start = RTL_UI ?
                         documentRect.right - identityRect.right :
                         identityRect.left;
             if (!this.margins || start != this.margins.start ||
                                  endOffset != this.margins.end ||
                                  width != this.margins.width) {
               this.margins = { start, end: endOffset, width };
               needsHandleOverUnderflow = true;
             }
@@ -2204,17 +2201,17 @@ file, You can obtain one at http://mozil
               // Update the impressions count on real popupshown, since there's
               // no guarantee openPopup will be respected by the platform.
               // Though, we must ensure the handled event is the expected one.
               let impressionId = this._searchSuggestionsImpressionId = {};
               this.addEventListener("popupshown", () => {
                 if (this._searchSuggestionsImpressionId == impressionId)
                   aInput.updateSearchSuggestionsNotificationImpressions(whichNotification);
               }, {once: true});
-              this._showSearchSuggestionsNotification(whichNotification, popupDirection);
+              this._showSearchSuggestionsNotification(whichNotification);
             } else if (this.classList.contains("showSearchSuggestionsNotification")) {
               this._hideSearchSuggestionsNotification();
             }
           } catch (ex) {
             // Not critical for the urlbar functionality, just report the error.
             Cu.reportError(ex);
           }
 
@@ -2320,17 +2317,16 @@ file, You can obtain one at http://mozil
             }, this.shrinkDelay);
           }
           ]]>
         </body>
       </method>
 
       <method name="_showSearchSuggestionsNotification">
         <parameter name="whichNotification"/>
-        <parameter name="popupDirection"/>
         <body>
           <![CDATA[
           if (whichNotification == "opt-out") {
             if (this.margins) {
               this.searchSuggestionsNotification.style.paddingInlineStart =
                 this.margins.start + "px";
             } else {
               this.searchSuggestionsNotification.style.removeProperty("padding-inline-start");