diff --git a/Tests/LibWeb/Ref/reference/images/svg-axis-aligned-lines-ref.png b/Tests/LibWeb/Ref/reference/images/svg-axis-aligned-lines-ref.png
new file mode 100644
index 0000000000..2672a5cc5f
Binary files /dev/null and b/Tests/LibWeb/Ref/reference/images/svg-axis-aligned-lines-ref.png differ
diff --git a/Tests/LibWeb/Ref/reference/svg-axis-aligned-lines-ref.html b/Tests/LibWeb/Ref/reference/svg-axis-aligned-lines-ref.html
new file mode 100644
index 0000000000..190e998677
--- /dev/null
+++ b/Tests/LibWeb/Ref/reference/svg-axis-aligned-lines-ref.html
@@ -0,0 +1,9 @@
+
+
diff --git a/Tests/LibWeb/Ref/svg-axis-aligned-lines.html b/Tests/LibWeb/Ref/svg-axis-aligned-lines.html
new file mode 100644
index 0000000000..f37349d900
--- /dev/null
+++ b/Tests/LibWeb/Ref/svg-axis-aligned-lines.html
@@ -0,0 +1,11 @@
+
+
+
+
diff --git a/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp b/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp
index c82e55180b..dc3b8c6c69 100644
--- a/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp
+++ b/Userland/Libraries/LibWeb/Painting/RecordingPainter.cpp
@@ -97,6 +97,8 @@ void RecordingPainter::stroke_path(StrokePathUsingColorParams params)
{
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type();
+ // Increase path bounding box by `thickness` to account for stroke.
+ path_bounding_rect.inflate(params.thickness, params.thickness);
push_command(StrokePathUsingColor {
.path_bounding_rect = path_bounding_rect,
.path = params.path,
@@ -110,6 +112,8 @@ void RecordingPainter::stroke_path(StrokePathUsingPaintStyleParams params)
{
auto aa_translation = state().translation.map(params.translation.value_or(Gfx::FloatPoint {}));
auto path_bounding_rect = params.path.bounding_box().translated(aa_translation).to_type();
+ // Increase path bounding box by `thickness` to account for stroke.
+ path_bounding_rect.inflate(params.thickness, params.thickness);
push_command(StrokePathUsingPaintStyle {
.path_bounding_rect = path_bounding_rect,
.path = params.path,