1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWeb: Fix bogus percentage vertical padding with box-sizing:border-box

The padding-top and padding-bottom properties are relative to the
*width* of the containing block, not the height.

It's funny how we keep making this same mistake again and again. :^)
This commit is contained in:
Andreas Kling 2023-03-10 11:32:29 +01:00
parent 07f6ee9e73
commit 24d5a9d7df
Notes: sideshowbarker 2024-07-16 23:06:34 +09:00
3 changed files with 42 additions and 2 deletions

View file

@ -1283,8 +1283,10 @@ CSS::Length FormattingContext::calculate_inner_height(Layout::Box const& box, Av
auto& computed_values = box.computed_values();
if (computed_values.box_sizing() == CSS::BoxSizing::BorderBox) {
auto const padding_top = computed_values.padding().top().resolved(box, height_of_containing_block_as_length_for_resolve).resolved(box);
auto const padding_bottom = computed_values.padding().bottom().resolved(box, height_of_containing_block_as_length_for_resolve).resolved(box);
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 inner_height = height.resolved(box, height_of_containing_block_as_length_for_resolve).resolved(box).to_px(box)
- computed_values.border_top().width