1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:38:11 +00:00

LibWeb: Remove some unnecessary is_replaced() checks in BFC

BFC::compute_width() has a short-circuit path for replaced elements.
This commit is contained in:
Andreas Kling 2020-12-11 22:31:29 +01:00
parent 67732df034
commit 552ba1b0a3

View file

@ -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