github web-platform-tests/wpt merge_pr_46779

latest releases: merge_pr_49470, epochs/three_hourly/2024-12-03_06H, epochs/six_hourly/2024-12-03_06H...
7 months ago

Part 2 - Fix hypothetical position for fixed-pos elements when scrollbar-gutters are on both edges.

When computing a hypothetical position for a fixed-pos element, we first compute
its position relative to the nearest block container containingBlock, and then
get the offset between containingBlock and the actual fixed-pos containing
block, i.e. the ViewportFrame.

However, using the ViewportFrame's origin (0,0) is incorrect. The fixed-pos
element's origin should exclude the scrollbar or scrollbar-gutter area [1].

We've fixed the containing block's origin for ViewportFrame (bug 728807), which
is used when reflowing the fixed-pos frames. The bug fixed the fixed-pos
element's position when inset value is specified. In this patch, when
computing the hypothetical position, we should also adjust the offset to the
containing block's origin for ViewportFrame so that the origin doesn't include
the scrollbar-gutter area, because we'll add the containing block's origin after
we reflow the fixed-pos frame at [2]. Failing to exclude the scrollbar-gutter
will cause us to shift the fixed-pos position by the scrollbar-gutter twice if
the element does use the hypothetical position as the final position

[1] A recent CSSWG resolution changed this so that top-layer or fullscreen
fixed-pos element cover the scrollbar or scrollbar-gutter. This is bug 1874091.
[2] https://searchfox.org/mozilla-central/rev/94f839e924ba6c69f3e0d062d4c6cc4fee7cad5b/layout/generic/nsAbsoluteContainingBlock.cpp#850-853

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

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1901652
gecko-commit: 66efe1aeeb0171aa8c5d5dc8aba79ab43e755d8a
gecko-reviewers: layout-reviewers, emilio

Don't miss a new wpt release

NewReleases is sending notifications on new releases.