mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 10:48:41 +00:00
LibWeb/HTML: Convert drop-shadow() lengths to pixels
Using the raw value meant that 1em would be incorrectly treated as 1px, for example. I've updated our canvas-filters test to demonstrate this - without the code change this would instead have an x-offset of 2px.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
0321d1392c
commit
d7ea949d2f
@@ -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<float>(drop_shadow.offset_x.resolved(resolution_context).raw_value());
|
||||
float offset_y = static_cast<float>(drop_shadow.offset_y.resolved(resolution_context).raw_value());
|
||||
float offset_x = static_cast<float>(drop_shadow.offset_x.resolved(resolution_context).to_px(resolution_context));
|
||||
float offset_y = static_cast<float>(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<float>(drop_shadow.radius->resolved(resolution_context).to_px(resolution_context));
|
||||
};
|
||||
|
||||
auto color = drop_shadow.color.value_or(Gfx::Color { 0, 0, 0, 255 });
|
||||
|
||||
Reference in New Issue
Block a user