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

LibWeb: Zero out margins if width is not 'auto' in BFC's compute_width

Reverse the condition to satisfy the spec comment. Probably a typo.
A 3 year old typo! :^)
This commit is contained in:
0GreenClover0 2023-05-05 02:58:49 +02:00 committed by Andreas Kling
parent 0d808f6dcb
commit 8bb2663a22
3 changed files with 22 additions and 1 deletions

View file

@ -181,7 +181,7 @@ void BlockFormattingContext::compute_width(Box const& box, AvailableSpace const&
if (!box.is_inline()) {
// 10.3.3 Block-level, non-replaced elements in normal flow
// If 'width' is not 'auto' and 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' (plus any of 'margin-left' or 'margin-right' that are not 'auto') is larger than the width of the containing block, then any 'auto' values for 'margin-left' or 'margin-right' are, for the following rules, treated as zero.
if (width.is_auto() && total_px > width_of_containing_block) {
if (!width.is_auto() && total_px > width_of_containing_block) {
if (margin_left.is_auto())
margin_left = zero_value;
if (margin_right.is_auto())