layout: Clamp sticky positioning offset bounds by zero (#39443)

Sticky positioning tries to keep an element visible within the nearest
scrollport. However, the element can't be offset to go beyond its
containing block. We implement this as offset bounds.

The problem was that, if the element would already be overflowing its
containing block before applying the sticky positioning, then we were
forcing it to move inside the containing block. That was wrong, and is
solved by flooring or ceiling the offset bounds by zero.

Testing: Adding new tests

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2025-09-23 09:22:10 +02:00 committed by GitHub
parent b73538a676
commit 16d2e030eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 189 additions and 4 deletions

View file

@ -238242,6 +238242,58 @@
{}
]
],
"position-sticky-bottom-004.html": [
"7439c2795360da76b1448ab098942737cbcc8680",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"position-sticky-bottom-005.html": [
"3d226132a854b0d63c59298e19a1d1f8dbf03536",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"position-sticky-bottom-006.html": [
"675ade1fcbae7a7c5e5749ecfb3d2313f22ae9d1",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"position-sticky-bottom-007.html": [
"f2648f1e003ac16d29c49be5f61f27a2097fe1b9",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square.xht",
"=="
]
],
{}
]
],
"position-sticky-change-top.html": [
"6a327ccd567818c2267d808a890796724384726e",
[