Bug 1177943 - Part 6. Fix HiDPI support. r?smaug draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 18 May 2016 20:43:13 +0900
changeset 368220 285165d77bd42f143860a7fd63fa2e6a624bfa09
parent 368219 4ed4deeeb0995c70e4b6b8cf18cc4ad33c2a1f1f
child 521213 691e867e9e827fa2132e00723359f9243bec0df0
push id18471
push userm_kato@ga2.so-net.ne.jp
push dateWed, 18 May 2016 11:49:22 +0000
reviewerssmaug
bugs1177943
milestone49.0a1
Bug 1177943 - Part 6. Fix HiDPI support. r?smaug Part 4 isn't compatible with HiDPI mode. getBoundingClientRect returns logical pixel, so we need convert to device pixel. MozReview-Commit-ID: L43fRFqJd4r
toolkit/modules/RemoteController.jsm
--- a/toolkit/modules/RemoteController.jsm
+++ b/toolkit/modules/RemoteController.jsm
@@ -43,24 +43,25 @@ RemoteController.prototype = {
 
   doCommandWithParams: function(aCommand, aCommandParams) {
     let cmd = {
       cmd: aCommand,
       params: null
     };
     if (aCommand == "cmd_lookUpDictionary") {
       let rect = this._browser.getBoundingClientRect();
+      let scale = this._browser.ownerDocument.defaultView.devicePixelRatio;
       cmd.params = {
         x:  {
           type: "long",
-          value: aCommandParams.getLongValue("x") - rect.left
+          value: aCommandParams.getLongValue("x") - rect.left * scale
         },
         y: {
           type: "long",
-          value: aCommandParams.getLongValue("y") - rect.top
+          value: aCommandParams.getLongValue("y") - rect.top * scale
         }
       };
     } else {
       throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     }
     this._browser.messageManager.sendAsyncMessage(
       "ControllerCommands:DoWithParams", cmd);
   },