Truly independent web browser
LibWeb: Distribute flex free space without losing rounding remainders
Andreas Klingbbe4476a5147
diff --git a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rsindex 6877a210851..bdbe030613b 100644--- a/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs+++ b/Libraries/LibWeb/Rust/src/layout/flex_formatting_context.rs@@ -1606,15 +1606,22 @@ impl<'pass> FlexFormattingContext<'pass> {// For every unfrozen item on the line,// find the ratio of the item’s flex grow factor to the sum of the flex grow factors of all unfrozen items on the line.let sum = self.sum_of_unfrozen_flex_factors(line_index);+ // NB: Each item takes the part of the free space between the running sums of the ratios before and+ // after it, so that rounding the fractions does not make the items overflow or underfill the+ // line.+ let mut cumulative_factor = 0.0;+ let mut distributed = CssPixels::default();for item_position in 0..item_count {let index = self.flex_lines[line_index].items[item_position];if self.flex_items[index].frozen {continue;}- let ratio = self.flex_items[index].flex_factor / sum;+ cumulative_factor += self.flex_items[index].flex_factor;+ let distributed_including_item = arithmetic_free_space.scaled(cumulative_factor / sum);// Set the item’s target main size to its flex base size plus a fraction of the remaining free space proportional to the ratio.self.flex_items[index].target_main_size =- self.flex_items[index].flex_base_size + arithmetic_free_space.scaled(ratio);+ self.flex_items[index].flex_base_size + (distributed_including_item - distributed);+ distributed = distributed_including_item;}} else {// If using the flex shrink factor@@ -1629,22 +1636,29 @@ impl<'pass> FlexFormattingContext<'pass> {self.flex_items[index].flex_factor * self.flex_items[index].flex_base_size.to_double();}let sum = self.sum_of_unfrozen_scaled_shrink_factors(line_index);+ // NB: As when growing, each item takes the part of the free space between the running sums of the+ // ratios before and after it.+ let mut cumulative_ratio = 0.0;+ let mut distributed = CssPixels::default();for item_position in 0..item_count {let index = self.flex_lines[line_index].items[item_position];if self.flex_items[index].frozen {continue;}- let ratio = if sum == 0.0 {- 1.0- } else {- self.flex_items[index].scaled_flex_shrink_factor / sum- };// Find the ratio of the item’s scaled flex shrink factor to the sum of the scaled flex shrink factors of all unfrozen items on the line.// Set the item’s target main size to its flex base size minus a fraction of the absolute value of the remaining free space proportional to the ratio.// (Note this may result in a negative inner main size; it will be corrected in the next step.)+ if sum == 0.0 {+ self.flex_items[index].target_main_size =+ self.flex_items[index].flex_base_size - abs(arithmetic_free_space);+ continue;+ }+ cumulative_ratio += self.flex_items[index].scaled_flex_shrink_factor / sum;+ let distributed_including_item = abs(arithmetic_free_space).scaled(cumulative_ratio);self.flex_items[index].target_main_size =- self.flex_items[index].flex_base_size - abs(arithmetic_free_space).scaled(ratio);+ self.flex_items[index].flex_base_size - (distributed_including_item - distributed);+ distributed = distributed_including_item;}}}@@ -2189,14 +2203,17 @@ impl<'pass> FlexFormattingContext<'pass> {let remaining = self.flex_lines[line_index].remaining_free_space;if remaining.is_some_and(|value| value > CssPixels::default()) && auto_margins > 0 {- let size = remaining.unwrap() / auto_margins;+ let distribution = SpaceDistribution::new(remaining.unwrap(), auto_margins, 0, 1);+ let mut auto_margin_index = 0;for item_position in 0..item_count {let index = self.flex_lines[line_index].items[item_position];if self.flex_items[index].margins.main_before_is_auto {- self.set_main_axis_first_margin(index, size);+ self.set_main_axis_first_margin(index, distribution.space_after(auto_margin_index));+ auto_margin_index += 1;}if self.flex_items[index].margins.main_after_is_auto {- self.set_main_axis_second_margin(index, size);+ self.set_main_axis_second_margin(index, distribution.space_after(auto_margin_index));+ auto_margin_index += 1;}}} else {@@ -2212,7 +2229,8 @@ impl<'pass> FlexFormattingContext<'pass> {}// 12.2.- let mut space_between_items = CssPixels::default();+ // NB: The free space that justify-content distributes around the items.+ let mut space_distribution = SpaceDistribution::default();let mut initial_offset = CssPixels::default();let number_of_items = item_count;let justify = self.style(self.run.box_).justify_content();@@ -2243,30 +2261,27 @@ impl<'pass> FlexFormattingContext<'pass> {if self.is_direction_reverse() {initial_offset = self.inner_main_size_used(self.container_used());}- if let Some(free_space) = remaining- && number_of_items > 1- {- space_between_items = (free_space / (number_of_items - 1)).max(CssPixels::default());- }+ let free_space = remaining.unwrap_or_default().max(CssPixels::default());+ space_distribution = SpaceDistribution::new(free_space, number_of_items - 1, 0, 1);}justify_content::SPACE_AROUND => {- if let Some(free_space) = remaining {- space_between_items = (free_space / number_of_items).max(CssPixels::default());- }+ let free_space = remaining.unwrap_or_default().max(CssPixels::default());+ space_distribution = SpaceDistribution::new(free_space, number_of_items * 2, 1, 2);+ let leading_space = space_distribution.space_before(0);initial_offset = if self.is_direction_reverse() {- self.inner_main_size_used(self.container_used()) - space_between_items / 2+ self.inner_main_size_used(self.container_used()) - leading_space} else {- space_between_items / 2+ leading_space};}justify_content::SPACE_EVENLY => {- if let Some(free_space) = remaining {- space_between_items = (free_space / (number_of_items + 1)).max(CssPixels::default());- }+ let free_space = remaining.unwrap_or_default().max(CssPixels::default());+ space_distribution = SpaceDistribution::new(free_space, number_of_items + 1, 1, 1);+ let leading_space = space_distribution.space_before(0);initial_offset = if self.is_direction_reverse() {- self.inner_main_size_used(self.container_used()) - space_between_items+ self.inner_main_size_used(self.container_used()) - leading_space} else {- space_between_items+ leading_space};}_ => unreachable!("invalid justify-content"),@@ -2314,7 +2329,7 @@ impl<'pass> FlexFormattingContext<'pass> {+ item.margins.main_after+ item.borders.main_after+ item.padding.main_after- + space_between_items;+ + space_distribution.space_after(iteration_position);if !direction_reverse && cursor_right {if position < item_count - 1 {amount += main_gap;@@ -2486,7 +2501,8 @@ impl<'pass> FlexFormattingContext<'pass> {// CSS-FLEXBOX-2: Account for gap between flex lines.sum += self.cross_gap() * self.flex_lines.len().wrapping_sub(1);let mut start = CssPixels::default();- let mut gap_size = CssPixels::default();+ // NB: The leftover free space that align-content distributes around the lines.+ let mut space_distribution = SpaceDistribution::default();let mut place_backwards = false;let mut iterate_backwards = false;match self.style(self.run.box_).align_content() {@@ -2522,7 +2538,7 @@ impl<'pass> FlexFormattingContext<'pass> {}let leftover = container_cross_size - sum;if leftover >= CssPixels::default() && self.flex_lines.len() > 1 {- gap_size = leftover / (self.flex_lines.len() - 1);+ space_distribution = SpaceDistribution::new(leftover, self.flex_lines.len() - 1, 0, 1);}}align_content::SPACE_AROUND => {@@ -2532,9 +2548,9 @@ impl<'pass> FlexFormattingContext<'pass> {// If the leftover free-space is negative this value is identical to center.start = container_cross_size / 2 - sum / 2;} else {- gap_size = leftover / self.flex_lines.len();+ space_distribution = SpaceDistribution::new(leftover, self.flex_lines.len() * 2, 1, 2);// The spacing between the first/last lines and the flex container edges is half the size of the spacing between flex lines.- start = gap_size / 2;+ start = space_distribution.space_before(0);}}align_content::SPACE_EVENLY => {@@ -2544,9 +2560,9 @@ impl<'pass> FlexFormattingContext<'pass> {// If the leftover free-space is negative this value is identical to center.start = container_cross_size / 2 - sum / 2;} else {- gap_size = leftover / (self.flex_lines.len() + 1);+ space_distribution = SpaceDistribution::new(leftover, self.flex_lines.len() + 1, 1, 1);// The spacing between the first/last lines and the flex container edges is the size of the spacing between flex lines.- start = gap_size;+ start = space_distribution.space_before(0);}}align_content::NORMAL | align_content::STRETCH => {@@ -2575,7 +2591,8 @@ impl<'pass> FlexFormattingContext<'pass> {self.flex_items[index].cross_offset += center;}// CSS-FLEXBOX-2: Account for gap between flex lines.- let amount = self.flex_lines[line_index].cross_size + gap_size + cross_gap;+ let amount =+ self.flex_lines[line_index].cross_size + space_distribution.space_after(iteration_index) + cross_gap;if place_backwards {start -= amount;} else {@@ -3722,6 +3739,42 @@ impl<'pass> FlexFormattingContext<'pass> {}}+/// Free space split into equal shares, placed before a run of boxes and between them. Each share is rounded such that+/// the shares add up to the whole space, instead of losing the rounding remainder of every share.+#[derive(Clone, Copy, Default)]+struct SpaceDistribution {+ space: CssPixels,+ shares: usize,+ shares_before_first_box: usize,+ shares_between_boxes: usize,+}++impl SpaceDistribution {+ fn new(space: CssPixels, shares: usize, shares_before_first_box: usize, shares_between_boxes: usize) -> Self {+ Self {+ space,+ shares,+ shares_before_first_box,+ shares_between_boxes,+ }+ }++ /// The space placed before the box at the given position in the run.+ fn space_before(self, position: usize) -> CssPixels {+ if self.shares == 0 {+ return CssPixels::default();+ }+ let count = (self.shares_before_first_box + position * self.shares_between_boxes).min(self.shares);+ let raw = i64::from(self.space.raw_value()) * count as i64 / self.shares as i64;+ CssPixels::from_raw(raw as i32)+ }++ /// The space placed between the box at the given position and the next one.+ fn space_after(self, position: usize) -> CssPixels {+ self.space_before(position + 1) - self.space_before(position)+ }+}+fn abs(value: CssPixels) -> CssPixels {if value < CssPixels::default() { -value } else { value }}diff --git a/Tests/LibWeb/Layout/expected/flex-auto.txt b/Tests/LibWeb/Layout/expected/flex-auto.txtindex b5c28374695..693111a4905 100644--- a/Tests/LibWeb/Layout/expected/flex-auto.txt+++ b/Tests/LibWeb/Layout/expected/flex-auto.txt@@ -10,14 +10,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [176.671875,10] flex-item [0+1+0 164.671875 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline+ BlockContainer <div.box> at [176.671875,10] flex-item [0+1+0 164.65625 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 1, rect: [176.671875,10 8.8125x16] baseline: 12.796875"2"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [343.34375,10] flex-item [0+1+0 164.671875 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [343.34375,10 9.09375x16] baseline: 12.796875+ BlockContainer <div.box> at [343.328125,10] flex-item [0+1+0 164.671875 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 1, rect: [343.328125,10 9.09375x16] baseline: 12.796875"3"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex-column-constrained-nowrap.txt b/Tests/LibWeb/Layout/expected/flex-column-constrained-nowrap.txtindex dddfd7d8dcb..740d30a9c67 100644--- a/Tests/LibWeb/Layout/expected/flex-column-constrained-nowrap.txt+++ b/Tests/LibWeb/Layout/expected/flex-column-constrained-nowrap.txt@@ -10,14 +10,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [10,93.328125] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline+ BlockContainer <div.box> at [10,93.328125] flex-item [0+1+0 100 0+1+0] [0+1+0 81.34375 0+1+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 1, rect: [10,93.328125 8.8125x16] baseline: 12.796875"2"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [10,176.65625] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [10,176.65625 9.09375x16] baseline: 12.796875+ BlockContainer <div.box> at [10,176.671875] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 1, rect: [10,176.671875 9.09375x16] baseline: 12.796875"3"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex-column-height-constrained-width-constrained.txt b/Tests/LibWeb/Layout/expected/flex-column-height-constrained-width-constrained.txtindex b281bb92cde..bb710db54e1 100644--- a/Tests/LibWeb/Layout/expected/flex-column-height-constrained-width-constrained.txt+++ b/Tests/LibWeb/Layout/expected/flex-column-height-constrained-width-constrained.txt@@ -10,14 +10,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [10,93.328125] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline+ BlockContainer <div.box> at [10,93.328125] flex-item [0+1+0 100 0+1+0] [0+1+0 81.34375 0+1+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 1, rect: [10,93.328125 8.8125x16] baseline: 12.796875"2"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [10,176.65625] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [10,176.65625 9.09375x16] baseline: 12.796875+ BlockContainer <div.box> at [10,176.671875] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 1, rect: [10,176.671875 9.09375x16] baseline: 12.796875"3"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex-column-height-constrained.txt b/Tests/LibWeb/Layout/expected/flex-column-height-constrained.txtindex ae47449de2b..37fbc9718a7 100644--- a/Tests/LibWeb/Layout/expected/flex-column-height-constrained.txt+++ b/Tests/LibWeb/Layout/expected/flex-column-height-constrained.txt@@ -10,14 +10,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [10,93.328125] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline+ BlockContainer <div.box> at [10,93.328125] flex-item [0+1+0 100 0+1+0] [0+1+0 81.34375 0+1+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 1, rect: [10,93.328125 8.8125x16] baseline: 12.796875"2"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [10,176.65625] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [10,176.65625 9.09375x16] baseline: 12.796875+ BlockContainer <div.box> at [10,176.671875] flex-item [0+1+0 100 0+1+0] [0+1+0 81.328125 0+1+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 1, rect: [10,176.671875 9.09375x16] baseline: 12.796875"3"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex-container-constrained-nowrap.txt b/Tests/LibWeb/Layout/expected/flex-container-constrained-nowrap.txtindex de14e71ec89..e459a37bee6 100644--- a/Tests/LibWeb/Layout/expected/flex-container-constrained-nowrap.txt+++ b/Tests/LibWeb/Layout/expected/flex-container-constrained-nowrap.txt@@ -10,14 +10,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [93.328125,10] flex-item [0+1+0 81.328125 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline+ BlockContainer <div.box> at [93.328125,10] flex-item [0+1+0 81.34375 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 1, rect: [93.328125,10 8.8125x16] baseline: 12.796875"2"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [176.65625,10] flex-item [0+1+0 81.328125 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [176.65625,10 9.09375x16] baseline: 12.796875+ BlockContainer <div.box> at [176.671875,10] flex-item [0+1+0 81.328125 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 1, rect: [176.671875,10 9.09375x16] baseline: 12.796875"3"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex-container-width-constrained.txt b/Tests/LibWeb/Layout/expected/flex-container-width-constrained.txtindex c278131c807..69b8b6543f8 100644--- a/Tests/LibWeb/Layout/expected/flex-container-width-constrained.txt+++ b/Tests/LibWeb/Layout/expected/flex-container-width-constrained.txt@@ -10,14 +10,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [93.328125,10] flex-item [0+1+0 81.328125 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline+ BlockContainer <div.box> at [93.328125,10] flex-item [0+1+0 81.34375 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 1, rect: [93.328125,10 8.8125x16] baseline: 12.796875"2"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div.box> at [176.65625,10] flex-item [0+1+0 81.328125 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 1, rect: [176.65625,10 9.09375x16] baseline: 12.796875+ BlockContainer <div.box> at [176.671875,10] flex-item [0+1+0 81.328125 0+1+0] [0+1+0 100 0+1+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 1, rect: [176.671875,10 9.09375x16] baseline: 12.796875"3"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex/aspect-ratio-with-percentage-width-and-height.txt b/Tests/LibWeb/Layout/expected/flex/aspect-ratio-with-percentage-width-and-height.txtindex 4eb3402f57d..d255d2c86b3 100644--- a/Tests/LibWeb/Layout/expected/flex/aspect-ratio-with-percentage-width-and-height.txt+++ b/Tests/LibWeb/Layout/expected/flex/aspect-ratio-with-percentage-width-and-height.txt@@ -9,14 +9,14 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenTextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div> at [84.671875,18] flex-item [0+5+0 56.671875 0+5+0] [0+5+0 56.671875 0+5+0] [BFC] children: inline+ BlockContainer <div> at [84.671875,18] flex-item [0+5+0 56.65625 0+5+0] [0+5+0 56.65625 0+5+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 3, rect: [84.671875,18 27.640625x16] baseline: 12.796875"bar"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlineTextNode <#text> (not painted)- BlockContainer <div> at [151.34375,18] flex-item [0+5+0 56.671875 0+5+0] [0+5+0 56.671875 0+5+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 3, rect: [151.34375,18 27.203125x16] baseline: 12.796875+ BlockContainer <div> at [151.328125,18] flex-item [0+5+0 56.671875 0+5+0] [0+5+0 56.671875 0+5+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 3, rect: [151.328125,18 27.203125x16] baseline: 12.796875"baz"TextNode <#text> (not painted)BlockContainer <(anonymous)> (not painted) [BFC] children: inlinediff --git a/Tests/LibWeb/Layout/expected/flex/reverse-flex-layout-with-space-between-and-space-around.txt b/Tests/LibWeb/Layout/expected/flex/reverse-flex-layout-with-space-between-and-space-around.txtindex 92e5a56923e..e4ba6b9097e 100644--- a/Tests/LibWeb/Layout/expected/flex/reverse-flex-layout-with-space-between-and-space-around.txt+++ b/Tests/LibWeb/Layout/expected/flex/reverse-flex-layout-with-space-between-and-space-around.txt@@ -6,12 +6,12 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenfrag 0 from TextNode start: 0, length: 4, rect: [12.609375,8 30.078125x16] baseline: 12.796875"Well"TextNode <#text> (not painted)- BlockContainer <div.inner> at [51.921875,8] flex-item [0+0+0 36.84375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 5, rect: [51.921875,8 36.84375x16] baseline: 12.796875+ BlockContainer <div.inner> at [51.9375,8] flex-item [0+0+0 36.84375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 5, rect: [51.9375,8 36.84375x16] baseline: 12.796875"hello"TextNode <#text> (not painted)- BlockContainer <div.inner> at [98,8] flex-item [0+0+0 55.359375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 7, rect: [98,8 55.359375x16] baseline: 12.796875+ BlockContainer <div.inner> at [98.015625,8] flex-item [0+0+0 55.359375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 7, rect: [98.015625,8 55.359375x16] baseline: 12.796875"friends"TextNode <#text> (not painted)BlockContainer <(anonymous)> at [8,158] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inline@@ -21,12 +21,12 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenfrag 0 from TextNode start: 0, length: 4, rect: [123.3125,158 30.078125x16] baseline: 12.796875"Well"TextNode <#text> (not painted)- BlockContainer <div.inner> at [77.234375,158] flex-item [0+0+0 36.84375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 5, rect: [77.234375,158 36.84375x16] baseline: 12.796875+ BlockContainer <div.inner> at [77.21875,158] flex-item [0+0+0 36.84375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 5, rect: [77.21875,158 36.84375x16] baseline: 12.796875"hello"TextNode <#text> (not painted)- BlockContainer <div.inner> at [12.640625,158] flex-item [0+0+0 55.359375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline- frag 0 from TextNode start: 0, length: 7, rect: [12.640625,158 55.359375x16] baseline: 12.796875+ BlockContainer <div.inner> at [12.625,158] flex-item [0+0+0 55.359375 0+0+0] [0+0+0 150 0+0+0] [BFC] children: inline+ frag 0 from TextNode start: 0, length: 7, rect: [12.625,158 55.359375x16] baseline: 12.796875"friends"TextNode <#text> (not painted)BlockContainer <(anonymous)> at [8,308] [0+0+0 784 0+0+0] [0+0+0 0 0+0+0] children: inlinediff --git a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txtindex b7903c071b8..393173421fc 100644--- a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt+++ b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt@@ -28,22 +28,22 @@ CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=PaintScrollBar@s0/e0CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[25,164 33x7] track_rect=[23,164 76x9] expanded_gutter_rect=[23,158 76x15] expanded_thumb_rect=[25,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=falsePaintScrollBar@s0/e0-CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s3 rect=[125.328125,22 93.328125x152]-CompositorScrollNode@s0/e0 scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[126,23 92x150] min_scroll_offset=[0,0] max_scroll_offset=[108.671875,150] is_viewport=false+CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s3 rect=[125.328125,22 93.34375x152]+CompositorScrollNode@s0/e0 scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[126,23 92x150] min_scroll_offset=[0,0] max_scroll_offset=[108.65625,150] is_viewport=falseFillRoundedRectRing@s0/e0 rect=[125,22 94x152] widths=[1,1,1,1] color=rgb(0, 0, 255)CompositorWheelHitTestTarget@s3/c1/e0 target_scroll_node_index=s3 rect=[126.328125,23 200x300]FillRect@s3/c1/e0 rect=[126,23 200x300] color=rgb(144, 238, 144)DrawGlyphRun@s3/c1/e0 rect=[126,23 66x16] translation=[126.328125,35.796875] color=rgb(0, 0, 0)CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[209,25 7x73] track_rect=[209,23 9x150] expanded_gutter_rect=[203,23 15x150] expanded_thumb_rect=[205,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=falsePaintScrollBar@s0/e0-CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[128,164 33x7] track_rect=[126,164 77x9] expanded_gutter_rect=[126,158 77x15] expanded_thumb_rect=[128,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false+CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[128,164 33x7] track_rect=[126,164 77x9] expanded_gutter_rect=[126,158 77x15] expanded_thumb_rect=[128,160 33x11] scroll_size=0.36180615473109 expanded_scroll_size=0.36180615473109 min_scroll_offset=0 max_scroll_offset=108.65625 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=falsePaintScrollBar@s0/e0-CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s4 rect=[228.65625,22 93.328125x152]+CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s4 rect=[228.67188,22 93.328125x152]CompositorScrollNode@s0/e0 scroll_node_index=s4 parent_scroll_node_index=s0 scrollport_rect=[230,23 91x150] min_scroll_offset=[0,0] max_scroll_offset=[108.671875,150] is_viewport=falseFillRoundedRectRing@s0/e0 rect=[229,22 93x152] widths=[1,1,1,1] color=rgb(0, 0, 255)-CompositorWheelHitTestTarget@s4/c2/e0 target_scroll_node_index=s4 rect=[229.65625,23 200x300]+CompositorWheelHitTestTarget@s4/c2/e0 target_scroll_node_index=s4 rect=[229.67188,23 200x300]FillRect@s4/c2/e0 rect=[230,23 200x300] color=rgb(173, 216, 230)-DrawGlyphRun@s4/c2/e0 rect=[229,23 67x16] translation=[229.65625,35.796875] color=rgb(0, 0, 0)+DrawGlyphRun@s4/c2/e0 rect=[229,23 67x16] translation=[229.67188,35.796875] color=rgb(0, 0, 0)CompositorScrollbar@s0/e0 scroll_node_index=s4 gutter_rect=[0,0 0x0] thumb_rect=[312,25 7x73] track_rect=[312,23 9x150] expanded_gutter_rect=[306,23 15x150] expanded_thumb_rect=[308,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=falsePaintScrollBar@s0/e0CompositorScrollbar@s0/e0 scroll_node_index=s4 gutter_rect=[0,0 0x0] thumb_rect=[232,164 33x7] track_rect=[230,164 76x9] expanded_gutter_rect=[230,158 76x15] expanded_thumb_rect=[232,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=falsediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/align-content-rounding.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/align-content-rounding.txtindex 2461ebe1d5a..9b06d914b89 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/align-content-rounding.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/align-content-rounding.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail The last item should match the end edge.\ No newline at end of file+1 Pass+Pass The last item should match the end edge.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/flex-rounding.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/flex-rounding.txtindex 7d5e6569b24..dc0c57395fd 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/flex-rounding.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/flex-rounding.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail The last item shouldn't overflow the flexbox.\ No newline at end of file+1 Pass+Pass The last item shouldn't overflow the flexbox.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/justify-content-rounding.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/justify-content-rounding.txtindex 2461ebe1d5a..9b06d914b89 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/justify-content-rounding.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/justify-content-rounding.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail The last item should match the end edge.\ No newline at end of file+1 Pass+Pass The last item should match the end edge.\ No newline at end of filediff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/main-axis-margin-rounding.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/main-axis-margin-rounding.txtindex 2461ebe1d5a..9b06d914b89 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/main-axis-margin-rounding.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-flexbox/main-axis-margin-rounding.txt@@ -2,5 +2,5 @@ Harness status: OKFound 1 tests-1 Fail-Fail The last item should match the end edge.\ No newline at end of file+1 Pass+Pass The last item should match the end edge.\ No newline at end of file