Bug 1773811 - Fix APZ autoscroll coordinates. r=tnikkel

In bug 1773342, I made OS text zoom behave like layout full zoom on all
pages (including the main browser page).

This means that getting CSS pixels from the browser page and turning
them to LayoutDevice pixels by multiplying by GetDefaultScale() isn't
right.

However, the caller already has the right device pixel values, so just
use them.

Differential Revision: https://phabricator.services.mozilla.com/D149026
This commit is contained in:
Emilio Cobos Álvarez
2022-06-13 00:54:33 +00:00
parent dd7a96451d
commit 87a0fd94ac
5 changed files with 28 additions and 20 deletions

View File

@@ -2866,13 +2866,12 @@ bool CanonicalBrowsingContext::StartApzAutoscroll(float aAnchorX,
return false;
}
// The anchor coordinates that are passed in are relative to the origin
// of the screen, but we are sending them to APZ which only knows about
// coordinates relative to the widget, so convert them accordingly.
CSSPoint anchorCss{aAnchorX, aAnchorY};
LayoutDeviceIntPoint anchor =
RoundedToInt(anchorCss * widget->GetDefaultScale());
anchor -= widget->WidgetToScreenOffset();
// The anchor coordinates that are passed in are relative to the origin of the
// screen, but we are sending them to APZ which only knows about coordinates
// relative to the widget, so convert them accordingly.
const LayoutDeviceIntPoint anchor =
RoundedToInt(LayoutDevicePoint(aAnchorX, aAnchorY)) -
widget->WidgetToScreenOffset();
mozilla::layers::ScrollableLayerGuid guid(layersId, aPresShellId, aScrollId);