mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Do not hoist floated fragments
Instead of hoisting floated fragments to be siblings of the fragment created by their containing block formatting context, keep them in "normal" fragment tree position and adjust their positioning to be relative to the containing block. This means that float fragments follow the existing invariants of the fragment tree and properly handle hit testing, painting order, and relative positioning. The tradeoff here is more complexity tracking the containing block offsets from the block formatting context (including handling collapsed margins), but less complexity dealing with hoisting / shared ownership in addition to the correctness benefits. Some tests are failing now because this change revealed some additional shortcomings with clearing block formatting context content size past the end of their contained floats. This will be fixed in a followup change. Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
cdec48328e
commit
25f6cc04a2
22 changed files with 250 additions and 296 deletions
|
@ -440,14 +440,12 @@ impl FragmentTree {
|
|||
}
|
||||
|
||||
let fragment_relative_rect = match fragment {
|
||||
Fragment::Box(fragment) => fragment
|
||||
Fragment::Box(fragment) | Fragment::Float(fragment) => fragment
|
||||
.border_rect()
|
||||
.to_physical(fragment.style.writing_mode, &containing_block),
|
||||
Fragment::Text(fragment) => fragment
|
||||
.rect
|
||||
.to_physical(fragment.parent_style.writing_mode, &containing_block),
|
||||
Fragment::HoistedFloat(_) |
|
||||
Fragment::Float |
|
||||
Fragment::AbsoluteOrFixedPositioned(_) |
|
||||
Fragment::Image(_) |
|
||||
Fragment::IFrame(_) |
|
||||
|
@ -521,15 +519,13 @@ impl FragmentTree {
|
|||
}
|
||||
|
||||
scroll_area = match fragment {
|
||||
Fragment::Box(fragment) => fragment
|
||||
Fragment::Box(fragment) | Fragment::Float(fragment) => fragment
|
||||
.scrollable_overflow(&containing_block)
|
||||
.translate(containing_block.origin.to_vector()),
|
||||
Fragment::Text(_) |
|
||||
Fragment::AbsoluteOrFixedPositioned(_) |
|
||||
Fragment::Image(_) |
|
||||
Fragment::IFrame(_) |
|
||||
Fragment::Float |
|
||||
Fragment::HoistedFloat(_) |
|
||||
Fragment::Anonymous(_) => return None,
|
||||
};
|
||||
None::<()>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue