Bug 1476221 - Keep the bounding client rect of the 'FormAssist:AutoCompleteResults' message relative to the visual viewport. r=mstange

Depends on D6090

Differential Revision: https://phabricator.services.mozilla.com/D6091

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2018-09-20 19:31:54 +00:00
Родитель 08d328e92e
Коммит 022d2224d5
1 изменённых файлов: 10 добавлений и 2 удалений

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

@ -378,9 +378,17 @@ var FormAssistant = {
scrollY += rect.top + parseInt(top);
}
// The rect computed above is relative to the origin of the viewport frame,
// i.e. the layout viewport origin, but the consumer of the
// FormAssist::AutoCompleteResult messaage expects a rect relative to
// the visual viewport origin, so translate between the two.
let offsetX = {}, offsetY = {};
aElement.ownerGlobal.windowUtils
.getVisualViewportOffsetRelativeToLayoutViewport(offsetX, offsetY);
return {
x: r.left + scrollX,
y: r.top + scrollY,
x: r.left + scrollX - offsetX.value,
y: r.top + scrollY - offsetY.value,
w: r.width,
h: r.height,
};