mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-04 17:33:04 +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:
parent
0321d1392c
commit
d7ea949d2f
Notes:
github-actions[bot]
2025-01-24 12:57:22 +00:00
Author: https://github.com/AtkinsSJ
Commit: d7ea949d2f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3348
Reviewed-by: https://github.com/gmta ✅
3 changed files with 4 additions and 4 deletions
|
@ -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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue