Bug 1106235 - [e10s] Make autocompletion dropdown menu honour RTL. r=mrbkap.
authorMike Conley <mconley@mozilla.com>
Tue, 14 Apr 2015 11:48:19 -0400
changeset 270496 16958c3e86dab77a301918df0d77400674f794d1
parent 270495 9b3b216d2e98792ac2bfc464fb69efdf5c1d3484
child 270497 0e0d984f606cf7220006a6e2476085b76880bf57
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1106235
milestone40.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 1106235 - [e10s] Make autocompletion dropdown menu honour RTL. r=mrbkap.
toolkit/components/satchel/AutoCompleteE10S.jsm
toolkit/components/satchel/nsFormAutoComplete.js
--- a/toolkit/components/satchel/AutoCompleteE10S.jsm
+++ b/toolkit/components/satchel/AutoCompleteE10S.jsm
@@ -79,21 +79,22 @@ this.AutoCompleteE10S = {
   init: function() {
     let messageManager = Cc["@mozilla.org/globalmessagemanager;1"].
                          getService(Ci.nsIMessageListenerManager);
     messageManager.addMessageListener("FormAutoComplete:SelectBy", this);
     messageManager.addMessageListener("FormAutoComplete:GetSelectedIndex", this);
     messageManager.addMessageListener("FormAutoComplete:ClosePopup", this);
   },
 
-  _initPopup: function(browserWindow, rect) {
+  _initPopup: function(browserWindow, rect, direction) {
     this.browser = browserWindow.gBrowser.selectedBrowser;
     this.popup = this.browser.autoCompletePopup;
     this.popup.hidden = false;
     this.popup.setAttribute("width", rect.width);
+    this.popup.style.direction = direction;
 
     this.x = rect.left;
     this.y = rect.top + rect.height;
   },
 
   _showPopup: function(results) {
     AutoCompleteE10SView.clearResults();
 
@@ -132,18 +133,19 @@ this.AutoCompleteE10S = {
   },
 
   // This function is called in response to AutoComplete requests from the
   // child (received via the message manager, see
   // "FormHistory:AutoCompleteSearchAsync").
   search: function(message) {
     let browserWindow = message.target.ownerDocument.defaultView;
     let rect = message.data;
+    let direction = message.data.direction;
 
-    this._initPopup(browserWindow, rect);
+    this._initPopup(browserWindow, rect, direction);
 
     let formAutoComplete = Cc["@mozilla.org/satchel/form-autocomplete;1"]
                              .getService(Ci.nsIFormAutoComplete);
 
     formAutoComplete.autoCompleteSearchAsync(message.data.inputName,
                                              message.data.untrimmedSearchString,
                                              null,
                                              null,
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -367,34 +367,36 @@ FormAutoCompleteChild.prototype = {
 
     autoCompleteSearchAsync : function (aInputName, aUntrimmedSearchString, aField, aPreviousResult, aListener) {
       this.log("autoCompleteSearchAsync");
 
       if (this._pendingSearch) {
         this.stopAutoCompleteSearch();
       }
 
-      let rect = BrowserUtils.getElementBoundingScreenRect(aField);
+      let window = aField.ownerDocument.defaultView;
 
-      let window = aField.ownerDocument.defaultView;
+      let rect = BrowserUtils.getElementBoundingScreenRect(aField);
+      let direction = window.getComputedStyle(aField).direction;
       let topLevelDocshell = window.QueryInterface(Ci.nsIInterfaceRequestor)
                                    .getInterface(Ci.nsIDocShell)
                                    .sameTypeRootTreeItem
                                    .QueryInterface(Ci.nsIDocShell);
 
       let mm = topLevelDocshell.QueryInterface(Ci.nsIInterfaceRequestor)
                                .getInterface(Ci.nsIContentFrameMessageManager);
 
       mm.sendAsyncMessage("FormHistory:AutoCompleteSearchAsync", {
         inputName: aInputName,
         untrimmedSearchString: aUntrimmedSearchString,
         left: rect.left,
         top: rect.top,
         width: rect.width,
-        height: rect.height
+        height: rect.height,
+        direction: direction,
       });
 
       let search = this._pendingSearch = {};
       let searchFinished = message => {
         mm.removeMessageListener("FormAutoComplete:AutoCompleteSearchAsyncResult", searchFinished);
 
         // Check whether stopAutoCompleteSearch() was called, i.e. the search
         // was cancelled, while waiting for a result.