mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibWeb: Fix width calculation for floating replaced elements
The path for floating, replaced elements must not fall through to the path taken for floating, non-replaced elements. The former works like inline replaced elements, while the latter uses a completely different algorithm which doesn't account for intrinsic ratio. Falling through overrides the correct value computed by the former. Fixes #19061.
This commit is contained in:
parent
7cc20f4cb5
commit
1e526af430
3 changed files with 11 additions and 5 deletions
|
@ -137,10 +137,16 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
|
|||
// FIXME: This const_cast is gross.
|
||||
const_cast<ReplacedBox&>(replaced).prepare_for_replaced_layout();
|
||||
compute_width_for_block_level_replaced_element_in_normal_flow(replaced, remaining_available_space);
|
||||
// NOTE: We don't return here.
|
||||
if (box.is_floating()) {
|
||||
// 10.3.6 Floating, replaced elements:
|
||||
// https://www.w3.org/TR/CSS22/visudet.html#float-replaced-width
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (box.is_floating()) {
|
||||
// 10.3.5 Floating, non-replaced elements:
|
||||
// https://www.w3.org/TR/CSS22/visudet.html#float-width
|
||||
compute_width_for_floating_box(box, available_space);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue