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
--- 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);
},