diff --git a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
index 575f9ae239..488d236d20 100644
--- a/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
+++ b/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp
@@ -910,12 +910,12 @@ void CanvasRenderingContext2D::set_filter(String filter)
[&](CSS::FilterOperation::DropShadow const& drop_shadow) {
auto resolution_context = CSS::Length::ResolutionContext::for_layout_node(*layout_node);
- float offset_x = static_cast(drop_shadow.offset_x.resolved(resolution_context).raw_value());
- float offset_y = static_cast(drop_shadow.offset_y.resolved(resolution_context).raw_value());
+ float offset_x = static_cast(drop_shadow.offset_x.resolved(resolution_context).to_px(resolution_context));
+ float offset_y = static_cast(drop_shadow.offset_y.resolved(resolution_context).to_px(resolution_context));
float radius = 0.0f;
if (drop_shadow.radius.has_value()) {
- radius = drop_shadow.radius->resolved(resolution_context).raw_value();
+ radius = static_cast(drop_shadow.radius->resolved(resolution_context).to_px(resolution_context));
};
auto color = drop_shadow.color.value_or(Gfx::Color { 0, 0, 0, 255 });
diff --git a/Tests/LibWeb/Screenshot/images/canvas-filters.png b/Tests/LibWeb/Screenshot/images/canvas-filters.png
index 0958a40b46..6995c914d6 100644
Binary files a/Tests/LibWeb/Screenshot/images/canvas-filters.png and b/Tests/LibWeb/Screenshot/images/canvas-filters.png differ
diff --git a/Tests/LibWeb/Screenshot/input/canvas-filters.html b/Tests/LibWeb/Screenshot/input/canvas-filters.html
index bef88ca2d3..97a1f3ce24 100644
--- a/Tests/LibWeb/Screenshot/input/canvas-filters.html
+++ b/Tests/LibWeb/Screenshot/input/canvas-filters.html
@@ -37,7 +37,7 @@
{id: 'canvas-opacity', filter: 'opacity(50%)'},
{id: 'canvas-saturate', filter: 'saturate(200%)'},
{id: 'canvas-sepia', filter: 'sepia(100%)'},
- {id: 'canvas-drop-shadow', filter: 'drop-shadow(10px 10px 10px rgba(0, 0, 0, 0.5))'},
+ {id: 'canvas-drop-shadow', filter: 'drop-shadow(2em 10px 10px rgba(0, 0, 0, 0.5))'},
];
const img = new Image();