From 552ba1b0a3793f5abc02a4eec347a9f78d5b9592 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 11 Dec 2020 22:31:29 +0100 Subject: [PATCH] LibWeb: Remove some unnecessary is_replaced() checks in BFC BFC::compute_width() has a short-circuit path for replaced elements. --- Libraries/LibWeb/Layout/BlockFormattingContext.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/Layout/BlockFormattingContext.cpp b/Libraries/LibWeb/Layout/BlockFormattingContext.cpp index 64c06198ed..6691d4c637 100644 --- a/Libraries/LibWeb/Layout/BlockFormattingContext.cpp +++ b/Libraries/LibWeb/Layout/BlockFormattingContext.cpp @@ -117,7 +117,7 @@ void BlockFormattingContext::compute_width(Box& box) total_px += value.to_px(box); } - if (!box.is_replaced() && !box.is_inline()) { + 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) { @@ -154,7 +154,7 @@ void BlockFormattingContext::compute_width(Box& box) margin_right = half_of_the_underflow; } } - } else if (!box.is_replaced() && box.is_inline_block()) { + } else if (box.is_inline_block()) { // 10.3.9 'Inline-block', non-replaced elements in normal flow