From 4cc3c41269e17f0446a0072c561a8bfd48050b60 Mon Sep 17 00:00:00 2001 From: Zaggy1024 Date: Mon, 11 Sep 2023 21:36:18 -0500 Subject: [PATCH] LibWeb: Allow calculated values for `background-size` dimensions This fixes the sizing of the arrow icons displayed to the left of parent sections on a table of contents on Wikipedia articles, which are sized using the equation `calc(max(0.75em, 12px))`. Now, the icon will not expand past the edges of the box they are within, avoiding clipping the edges of the arrows. --- Tests/LibWeb/Ref/assets/2x2checkerboard.png | Bin 0 -> 129 bytes Tests/LibWeb/Ref/background-size-calc.html | 15 +++++++++++++++ .../Ref/reference/background-size-calc-ref.html | 14 ++++++++++++++ Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 2 ++ 4 files changed, 31 insertions(+) create mode 100644 Tests/LibWeb/Ref/assets/2x2checkerboard.png create mode 100644 Tests/LibWeb/Ref/background-size-calc.html create mode 100644 Tests/LibWeb/Ref/reference/background-size-calc-ref.html diff --git a/Tests/LibWeb/Ref/assets/2x2checkerboard.png b/Tests/LibWeb/Ref/assets/2x2checkerboard.png new file mode 100644 index 0000000000000000000000000000000000000000..83b96959786fe2d113d98c3a500871cfc77ee3a6 GIT binary patch literal 129 zcmeAS@N?(olHy`uVBq!ia0y~yU|<4a4mJh`hN5k}Dhvz^jKx9jP7LeL$-HD>U|>mi z^mSxl*x1kgCy|wbfq}EYBeIx*f$s + + + + + + diff --git a/Tests/LibWeb/Ref/reference/background-size-calc-ref.html b/Tests/LibWeb/Ref/reference/background-size-calc-ref.html new file mode 100644 index 0000000000..00a8db96ce --- /dev/null +++ b/Tests/LibWeb/Ref/reference/background-size-calc-ref.html @@ -0,0 +1,14 @@ + + + + + + diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 148e7b1bd3..4fbba0574f 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -3169,6 +3169,8 @@ RefPtr Parser::parse_single_background_size_value(TokenStream