Correct rendering of floated root

Fix two issues around floating a root element:

1. In the StackingContext code handle the case where a root element is a
   Float fragment and not a Box fragment. This fixes a debug assertion
   failure in the css/CSS2/float/float-root.html test.
2. When initializing the SequentialLayoutState, use the containing block
   width as the maximum inline float placement position instead of
   infinity. This fixes the rendering of css/CSS2/float/float-root.html.

Note that css/CSS2/float/float-root.html was passing before, because
both the test and reference were subject to the same bug. This fixes a
couple other tests as well.
This commit is contained in:
Martin Robinson 2023-06-14 13:00:09 +02:00
parent ffccc5c88b
commit 4cb4332602
No known key found for this signature in database
GPG key ID: D56AA4FA55EFE6F8
8 changed files with 17 additions and 31 deletions

View file

@ -464,7 +464,7 @@ impl PlacedFloat {
impl FloatPlacement {
fn place(floats: Vec<FloatInput>) -> FloatPlacement {
let mut float_context = FloatContext::new();
let mut float_context = FloatContext::new(Length::new(f32::INFINITY));
let mut placed_floats = vec![];
for float in floats {
let ceiling = Length::new(float.ceiling as f32);