1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

LibWeb: Stop using weird Length::resolved() in {Block,}FormattingContext

This commit is contained in:
Andreas Kling 2023-05-06 18:41:03 +02:00
parent 07815dacf8
commit 6ccb77a9b8
2 changed files with 10 additions and 10 deletions

View file

@ -171,8 +171,8 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
auto try_compute_width = [&](auto const& a_width) { auto try_compute_width = [&](auto const& a_width) {
CSS::Length width = a_width; CSS::Length width = a_width;
margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve);
margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve);
CSSPixels total_px = computed_values.border_left().width + computed_values.border_right().width; CSSPixels total_px = computed_values.border_left().width + computed_values.border_right().width;
for (auto& value : { margin_left, CSS::Length::make_px(padding_left), width, CSS::Length::make_px(padding_right), margin_right }) { for (auto& value : { margin_left, CSS::Length::make_px(padding_left), width, CSS::Length::make_px(padding_right), margin_right }) {
total_px += value.to_px(box); total_px += value.to_px(box);
@ -279,8 +279,8 @@ void BlockFormattingContext::compute_width_for_floating_box(Box const& box, Avai
if (!available_space.width.is_definite()) if (!available_space.width.is_definite())
width_of_containing_block_as_length_for_resolve = CSS::Length::make_px(0); width_of_containing_block_as_length_for_resolve = CSS::Length::make_px(0);
auto margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); auto margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve);
auto margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); auto margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve);
auto const padding_left = computed_values.padding().left().to_px(box, width_of_containing_block); auto const padding_left = computed_values.padding().left().to_px(box, width_of_containing_block);
auto const padding_right = computed_values.padding().right().to_px(box, width_of_containing_block); auto const padding_right = computed_values.padding().right().to_px(box, width_of_containing_block);
@ -362,8 +362,8 @@ CSSPixels BlockFormattingContext::compute_width_for_table_wrapper(Box const& box
auto zero_value = CSS::Length::make_px(0); auto zero_value = CSS::Length::make_px(0);
auto margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); auto margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length_for_resolve);
auto margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box); auto margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length_for_resolve);
// If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'. // If 'margin-left', or 'margin-right' are computed as 'auto', their used value is '0'.
if (margin_left.is_auto()) if (margin_left.is_auto())

View file

@ -429,8 +429,8 @@ CSSPixels FormattingContext::compute_width_for_replaced_element(LayoutState cons
auto width_of_containing_block = available_space.width.to_px(); auto width_of_containing_block = available_space.width.to_px();
auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block); auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block);
auto margin_left = box.computed_values().margin().left().resolved(box, width_of_containing_block_as_length).resolved(box); auto margin_left = box.computed_values().margin().left().resolved(box, width_of_containing_block_as_length);
auto margin_right = box.computed_values().margin().right().resolved(box, width_of_containing_block_as_length).resolved(box); auto margin_right = box.computed_values().margin().right().resolved(box, width_of_containing_block_as_length);
// A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'. // A computed value of 'auto' for 'margin-left' or 'margin-right' becomes a used value of '0'.
if (margin_left.is_auto()) if (margin_left.is_auto())
@ -531,8 +531,8 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
auto computed_right = computed_values.inset().right(); auto computed_right = computed_values.inset().right();
auto try_compute_width = [&](auto const& a_width) { auto try_compute_width = [&](auto const& a_width) {
margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length).resolved(box); margin_left = computed_values.margin().left().resolved(box, width_of_containing_block_as_length);
margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length).resolved(box); margin_right = computed_values.margin().right().resolved(box, width_of_containing_block_as_length);
auto left = computed_values.inset().left().to_px(box, width_of_containing_block); auto left = computed_values.inset().left().to_px(box, width_of_containing_block);
auto right = computed_values.inset().right().to_px(box, width_of_containing_block); auto right = computed_values.inset().right().to_px(box, width_of_containing_block);