From 157896cc0b8416429aceb19fe999a5456e4ca70a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 4 Dec 2020 21:23:04 +0100 Subject: [PATCH] LibWeb: Block layout should account for vertical border space We were not accounting for space occupied by borders when computing the vertical (y) position of blocks. This meant that blocks with wide top/bottom borders could bleed into each other incorrectly. Fix this by using the combined padding+border geometry instead of just the padding when placing blocks on the y axis. --- Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 5c50d20023..4b888bdd7d 100644 --- a/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -499,7 +499,9 @@ void BlockFormattingContext::place_block_level_non_replaced_element_in_normal_fl } if (relevant_sibling) { - y += relevant_sibling->effective_offset().y() + relevant_sibling->height() + relevant_sibling->box_model().padding.bottom.to_px(*relevant_sibling); + y += relevant_sibling->effective_offset().y() + + relevant_sibling->height() + + relevant_sibling->box_model().border_box(*relevant_sibling).bottom; // Collapse top margin with bottom margin of preceding siblings if needed float my_margin_top = box_model.margin.top.to_px(box);