mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1669865 - Fix invalidations from external scroll offset inaccuracy. r=kats
Ensure that the external scroll offset is rounded from app units into whole device pixels. This means that the primitive content id matches in cases with non-round device pixel ratios, avoiding unnecessary invalidations in these cases. Differential Revision: https://phabricator.services.mozilla.com/D93175
This commit is contained in:
parent
6ea02af2f9
commit
1a7a9739e4
@ -315,8 +315,15 @@ Maybe<wr::WrSpaceAndClip> ClipManager::DefineScrollLayers(
|
||||
if (parent) {
|
||||
parent->space = SpatialIdAfterOverride(parent->space);
|
||||
}
|
||||
LayoutDevicePoint scrollOffset =
|
||||
metrics.GetLayoutScrollOffset() * metrics.GetDevPixelsPerCSSPixel();
|
||||
// The external scroll offset is accumulated into the local space positions of
|
||||
// display items inside WR, so that the elements hash (intern) to the same
|
||||
// content ID for quick comparisons. To avoid invalidations when the
|
||||
// auPerDevPixel is not a round value, round here directly from app units.
|
||||
// This guarantees we won't introduce any inaccuracy in the external scroll
|
||||
// offset passed to WR.
|
||||
LayoutDevicePoint scrollOffset = LayoutDevicePoint::FromAppUnitsRounded(
|
||||
scrollableFrame->GetScrollPosition(), auPerDevPixel);
|
||||
|
||||
return Some(mBuilder->DefineScrollLayer(
|
||||
viewId, parent, wr::ToLayoutRect(contentRect),
|
||||
wr::ToLayoutRect(clipBounds), wr::ToLayoutPoint(scrollOffset)));
|
||||
|
Loading…
Reference in New Issue
Block a user