Skip to content

Truly independent web browser

LibWeb: Skip box shadows with no offset, blur or spread

Tim Ledbetter975a6146ad7e
diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/shadow.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/shadow.rs
index 62bcf48bf9b..99d72dc69e9 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/paint/shadow.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/shadow.rs
@@ -129,6 +129,9 @@ fn paint_box_shadow_layers<O: Observer>(
let offset_y = converter.rounded_device_pixels(geometry.offset_y);
let blur_radius = converter.rounded_device_pixels(geometry.blur_radius);
let spread_distance = converter.rounded_device_pixels(geometry.spread_distance);
+ if offset_x == 0 && offset_y == 0 && blur_radius == 0 && spread_distance == 0 {
+ continue;
+ }
let inner = layer.is_inner();
let device_content_rect = converter.rounded_device_rect(geometry.content_rect);
diff --git a/Tests/LibWeb/Ref/expected/box-shadow-with-no-offset-blur-or-spread-ref.html b/Tests/LibWeb/Ref/expected/box-shadow-with-no-offset-blur-or-spread-ref.html
new file mode 100644
index 00000000000..dd59df37b24
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/box-shadow-with-no-offset-blur-or-spread-ref.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<style>
+ body { background: #303946; }
+</style>
diff --git a/Tests/LibWeb/Ref/input/box-shadow-with-no-offset-blur-or-spread.html b/Tests/LibWeb/Ref/input/box-shadow-with-no-offset-blur-or-spread.html
new file mode 100644
index 00000000000..cd08fbcec46
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/box-shadow-with-no-offset-blur-or-spread.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<link rel="match" href="../expected/box-shadow-with-no-offset-blur-or-spread-ref.html">
+<style>
+ body { background: #303946; }
+ div { width: 200px; height: 100px; margin: 20px; border-radius: 50px; box-shadow: 0 0 0 0 #ffffff; }
+ #corner-shape { corner-shape: squircle; }
+</style>
+<div></div>
+<div id="corner-shape"></div>