diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-06-21 08:31:55 +0200 |
---|---|---|
committer | Oriol Brufau <obrufau@igalia.com> | 2023-06-22 01:55:21 +0200 |
commit | 30ab348116a90e47f2fbb97a0f393c181cbdb175 (patch) | |
tree | 392de665307a300d225e11fee6ce5ef93e808735 /components/layout_2020/positioned.rs | |
parent | 9edc2c664fc4b5e04d8805107369ca0f20081771 (diff) | |
download | servo-30ab348116a90e47f2fbb97a0f393c181cbdb175.tar.gz servo-30ab348116a90e47f2fbb97a0f393c181cbdb175.zip |
Properly position absolutes with static insets that are children of floats
Previously, final float positions were calculated when their parents
were positioned. This prevented proper positioning of absolute children
of floats with static insets, because they accumulate offsets as they
are hoisted up the tree.
This change moves the final float positioning to
`PlacementState::place_fragment` for the float itself so that it happens
before any insets are updated for hoisted descendants. In addition to
simplifying the code, this makes it a bit more efficient. Finally,
floats are taken into account when updating static insets of hoisted
boxes.
Fixes #29826.
Diffstat (limited to 'components/layout_2020/positioned.rs')
-rw-r--r-- | components/layout_2020/positioned.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/components/layout_2020/positioned.rs b/components/layout_2020/positioned.rs index 446bef4811d..b1ab687a4e9 100644 --- a/components/layout_2020/positioned.rs +++ b/components/layout_2020/positioned.rs @@ -167,8 +167,8 @@ impl PositioningContext { parent_fragment: &Fragment, ) { let fragment_rect = match &parent_fragment { - Fragment::Box(b) => &b.content_rect, - Fragment::AbsoluteOrFixedPositioned(_) | Fragment::Float(_) => return, + Fragment::Box(b) | Fragment::Float(b) => &b.content_rect, + Fragment::AbsoluteOrFixedPositioned(_) => return, Fragment::Anonymous(a) => &a.rect, _ => unreachable!(), }; |