mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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.
This commit is contained in:
parent
9edc2c664f
commit
30ab348116
17 changed files with 114 additions and 135 deletions
|
@ -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!(),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue