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: IN4i4FOD7v2
This commit is contained in:
Makoto Kato 2016-05-23 16:47:48 +09:00
Родитель d8ef4deef4
Коммит ce24bb4b69
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -47,15 +47,19 @@ RemoteController.prototype = {
params: null
};
if (aCommand == "cmd_lookUpDictionary") {
// Although getBoundingClientRect of the element is logical pixel, but
// x and y parameter of cmd_lookUpDictionary are device pixel.
// So we need calculate child process's coordinate using correct unit.
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 {