1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

LibWeb: Remove early resolve to auto while calculating border-box width

`Length::resolved(Node&)` transforms infinite values to "auto".

Following transformations:
Infinite (Length) -> "auto" -> 0 (px)
cause border-box width to be resolved in zero when it should be inf px.

Removing `Length::resolved(Node&)` makes it work right:
Infinite (Length) -> Infinite (px)

Fixes #18649
This commit is contained in:
Aliaksandr Kalenik 2023-05-05 09:45:19 +03:00 committed by Andreas Kling
parent 2d2d2539b4
commit 34b1186272
3 changed files with 22 additions and 6 deletions

View file

@ -1291,10 +1291,10 @@ CSS::Length FormattingContext::calculate_inner_width(Layout::Box const& box, Ava
auto& computed_values = box.computed_values();
if (computed_values.box_sizing() == CSS::BoxSizing::BorderBox) {
auto const padding_left = computed_values.padding().left().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box);
auto const padding_right = computed_values.padding().right().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box);
auto const padding_left = computed_values.padding().left().resolved(box, width_of_containing_block_as_length_for_resolve);
auto const padding_right = computed_values.padding().right().resolved(box, width_of_containing_block_as_length_for_resolve);
auto inner_width = width.resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box).to_px(box)
auto inner_width = width.resolved(box, width_of_containing_block_as_length_for_resolve).to_px(box)
- computed_values.border_left().width
- padding_left.to_px(box)
- computed_values.border_right().width
@ -1317,10 +1317,10 @@ CSS::Length FormattingContext::calculate_inner_height(Layout::Box const& box, Av
if (computed_values.box_sizing() == CSS::BoxSizing::BorderBox) {
auto width_of_containing_block = CSS::Length::make_px(containing_block_width_for(box));
auto const padding_top = computed_values.padding().top().resolved(box, width_of_containing_block).resolved(box);
auto const padding_bottom = computed_values.padding().bottom().resolved(box, width_of_containing_block).resolved(box);
auto const padding_top = computed_values.padding().top().resolved(box, width_of_containing_block);
auto const padding_bottom = computed_values.padding().bottom().resolved(box, width_of_containing_block);
auto inner_height = height.resolved(box, height_of_containing_block_as_length_for_resolve).resolved(box).to_px(box)
auto inner_height = height.resolved(box, height_of_containing_block_as_length_for_resolve).to_px(box)
- computed_values.border_top().width
- padding_top.to_px(box)
- computed_values.border_bottom().width