Bladeren bron

LibWeb: Use calculate_inner_width to compute min and max widths

Use calculate_inner_width that consider box-sizing in compute_width
to resolve min_width and max_width.
Aliaksandr Kalenik 2 jaren geleden
bovenliggende
commit
7c00619e47
1 gewijzigde bestanden met toevoegingen van 2 en 2 verwijderingen
  1. 2 2
      Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp

+ 2 - 2
Userland/Libraries/LibWeb/Layout/BlockFormattingContext.cpp

@@ -194,7 +194,7 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
     // 2. The tentative used width is greater than 'max-width', the rules above are applied again,
     //    but this time using the computed value of 'max-width' as the computed value for 'width'.
     if (!computed_values.max_width().is_none()) {
-        auto max_width = computed_values.max_width().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box);
+        auto max_width = calculate_inner_width(box, available_space.width, computed_values.max_width());
         if (used_width.to_px(box) > max_width.to_px(box)) {
             used_width = try_compute_width(max_width);
         }
@@ -203,7 +203,7 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
     // 3. If the resulting width is smaller than 'min-width', the rules above are applied again,
     //    but this time using the value of 'min-width' as the computed value for 'width'.
     if (!computed_values.min_width().is_auto()) {
-        auto min_width = computed_values.min_width().resolved(box, width_of_containing_block_as_length_for_resolve).resolved(box);
+        auto min_width = calculate_inner_width(box, available_space.width, computed_values.min_width());
         if (used_width.to_px(box) < min_width.to_px(box)) {
             used_width = try_compute_width(min_width);
         }