diff --git a/Libraries/LibWeb/Painting/BorderPainting.cpp b/Libraries/LibWeb/Painting/BorderPainting.cpp index 2529527647f..157ab75fc6f 100644 --- a/Libraries/LibWeb/Painting/BorderPainting.cpp +++ b/Libraries/LibWeb/Painting/BorderPainting.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, Andreas Kling - * Copyright (c) 2021-2023, Sam Atkins + * Copyright (c) 2021-2025, Sam Atkins * Copyright (c) 2022, MacDue * * SPDX-License-Identifier: BSD-2-Clause @@ -20,16 +20,20 @@ static Color light_color_for_inset_and_outset(Color const& color) { auto hsv = color.to_hsv(); if (hsv.value >= dark_light_absolute_value_difference) - return Color::from_hsv(hsv); - return Color::from_hsv({ hsv.hue, hsv.saturation, hsv.value + dark_light_absolute_value_difference }); + return color; + auto result = Color::from_hsv({ hsv.hue, hsv.saturation, hsv.value + dark_light_absolute_value_difference }); + result.set_alpha(color.alpha()); + return result; } static Color dark_color_for_inset_and_outset(Color const& color) { auto hsv = color.to_hsv(); if (hsv.value < dark_light_absolute_value_difference) - return Color::from_hsv(hsv); - return Color::from_hsv({ hsv.hue, hsv.saturation, hsv.value - dark_light_absolute_value_difference }); + return color; + auto result = Color::from_hsv({ hsv.hue, hsv.saturation, hsv.value - dark_light_absolute_value_difference }); + result.set_alpha(color.alpha()); + return result; } Gfx::Color border_color(BorderEdge edge, BordersDataDevicePixels const& borders_data) diff --git a/Tests/LibWeb/Ref/expected/css/transparent-borders-ref.html b/Tests/LibWeb/Ref/expected/css/transparent-borders-ref.html new file mode 100644 index 00000000000..6d8560f1c4f --- /dev/null +++ b/Tests/LibWeb/Ref/expected/css/transparent-borders-ref.html @@ -0,0 +1,17 @@ + + + +
+
+
+
+
+
+
diff --git a/Tests/LibWeb/Ref/input/css/transparent-borders.html b/Tests/LibWeb/Ref/input/css/transparent-borders.html new file mode 100644 index 00000000000..7b2f660283d --- /dev/null +++ b/Tests/LibWeb/Ref/input/css/transparent-borders.html @@ -0,0 +1,18 @@ + + + +
+
+
+
+
+
+