From 2ab078d79b077d288e41d4fe757127174e1b1cca Mon Sep 17 00:00:00 2001 From: Milo van der Tier Date: Sun, 1 Dec 2024 16:07:11 +0100 Subject: [PATCH] LibWeb/CSS: Do not ignore self-start/self-end alignment in flex layout This makes these values the same as `start` and `end`. While this is not entirely correct, it is better than centering which is what we did previously. This fixes misaligned images on https://nos.nl (cherry picked from commit 2ee7e555f24f04ed370630836c556a7dee6dd23a) --- Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index b676a062536..9d17ed05b53 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -1488,11 +1488,15 @@ void FlexFormattingContext::align_all_flex_items_along_the_cross_axis() // Fallthrough case CSS::AlignItems::Start: case CSS::AlignItems::FlexStart: + case CSS::AlignItems::SelfStart: case CSS::AlignItems::Stretch: + // FIXME: 'start', 'flex-start' and 'self-start' have subtly different behavior. + // The same goes for the end values. item.cross_offset = -half_line_size + item.margins.cross_before + item.borders.cross_before + item.padding.cross_before; break; case CSS::AlignItems::End: case CSS::AlignItems::FlexEnd: + case CSS::AlignItems::SelfEnd: item.cross_offset = half_line_size - item.cross_size.value() - item.margins.cross_after - item.borders.cross_after - item.padding.cross_after; break; case CSS::AlignItems::Center: