From 38a6b7ad3d21dbcb6ada757b7676503bf07508b3 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 19 Jun 2023 16:50:04 +0200 Subject: [PATCH] LibWeb: Don't assert when flex-item has `align-self: end` We were missing the code to convert this to `align-items: end`. --- Tests/LibWeb/Layout/expected/flex/align-self-end-crash.txt | 4 ++++ Tests/LibWeb/Layout/input/flex/align-self-end-crash.html | 4 ++++ Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp | 2 ++ 3 files changed, 10 insertions(+) create mode 100644 Tests/LibWeb/Layout/expected/flex/align-self-end-crash.txt create mode 100644 Tests/LibWeb/Layout/input/flex/align-self-end-crash.html diff --git a/Tests/LibWeb/Layout/expected/flex/align-self-end-crash.txt b/Tests/LibWeb/Layout/expected/flex/align-self-end-crash.txt new file mode 100644 index 0000000000..4a51759dd0 --- /dev/null +++ b/Tests/LibWeb/Layout/expected/flex/align-self-end-crash.txt @@ -0,0 +1,4 @@ +Viewport <#document> at (0,0) content-size 800x600 children: not-inline + BlockContainer at (0,0) content-size 800x16 [BFC] children: not-inline + Box at (8,8) content-size 784x0 flex-container(row) [FFC] children: not-inline + BlockContainer
at (8,8) content-size 0x0 flex-item [BFC] children: not-inline diff --git a/Tests/LibWeb/Layout/input/flex/align-self-end-crash.html b/Tests/LibWeb/Layout/input/flex/align-self-end-crash.html new file mode 100644 index 0000000000..5eb7a435c0 --- /dev/null +++ b/Tests/LibWeb/Layout/input/flex/align-self-end-crash.html @@ -0,0 +1,4 @@ +
\ No newline at end of file diff --git a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp index fa003852a3..c32c72521f 100644 --- a/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/FlexFormattingContext.cpp @@ -1447,6 +1447,8 @@ CSS::AlignItems FlexFormattingContext::alignment_for_item(Box const& box) const switch (box.computed_values().align_self()) { case CSS::AlignSelf::Auto: return flex_container().computed_values().align_items(); + case CSS::AlignSelf::End: + return CSS::AlignItems::End; case CSS::AlignSelf::Normal: return CSS::AlignItems::Normal; case CSS::AlignSelf::SelfStart: