mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
layout: Fix propagation of overflow
to viewport (#39173)
This patch refactors the logic for propagating overflow to the viewport, fixing various issues: - Now we won't propagate from the root element if it has no box. Note the fix isn't observable in Servo because we lack scrollbars. - If the first `<body>` element has no box, we won't keep searching for other `<body>` elements. This deviates from the spec, but aligns us with other browsers. - We won't propagate from the `<body>` if it has no box. We were already handling `display: none` but not `display: contents`. This deviates from the spec, but aligns us with other browsers. Also, when we flag the root or `<body>` as having propagated `overflow` to the viewport, we retrieve the `LayoutBoxBase`. Therefore, now we get the computed style from the `LayoutBoxBase` in a single operation, instead of first retrieving the style from the DOM element and then getting the `LayoutBoxBase` from the box. Testing: Adding more tests. We were only failing one of them, but it's hard to test the fixes given that we don't show scrollbars. The tests that were already passing are useful too, e.g. Firefox fails one of them. Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
22fbb3458b
commit
4451ce0ef1
12 changed files with 296 additions and 69 deletions
|
@ -421,7 +421,7 @@ impl TableLevelBox {
|
|||
}
|
||||
}
|
||||
|
||||
pub(crate) fn with_base_mut<T>(&mut self, callback: impl Fn(&mut LayoutBoxBase) -> T) -> T {
|
||||
pub(crate) fn with_base_mut<T>(&mut self, callback: impl FnOnce(&mut LayoutBoxBase) -> T) -> T {
|
||||
match self {
|
||||
TableLevelBox::Caption(caption) => callback(&mut caption.borrow_mut().context.base),
|
||||
TableLevelBox::Cell(cell) => callback(&mut cell.borrow_mut().base),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue