Refactor scrolls on the window object (#29680)

Refactor the scrolling and scrollable area calculation on the window
object, to make it better match the specification. This has some mild
changes to behavior, but in general things work the same as they did
before. This is mainly preparation for properly handling viewport
propagation of the `overflow` property but seems to fix a few issues as
well.

There is one new failure in Layout 2020 regarding `position: sticky`,
but this isn't a big deal because there is no support for `position:
sticky` in Layout 2020 yet.

Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
This commit is contained in:
Martin Robinson 2023-09-15 12:57:54 +02:00 committed by GitHub
parent 0b86d65798
commit abca586e0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 128 additions and 118 deletions

View file

@ -167,6 +167,15 @@ impl Fragment {
}
}
pub fn scrolling_area(&self, containing_block: &PhysicalRect<Length>) -> PhysicalRect<Length> {
match self {
Fragment::Box(fragment) | Fragment::Float(fragment) => fragment
.scrollable_overflow(containing_block)
.translate(containing_block.origin.to_vector()),
_ => self.scrollable_overflow(containing_block),
}
}
pub fn scrollable_overflow(
&self,
containing_block: &PhysicalRect<Length>,