mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
LibWeb: Set blur filter radius to 0px if omitted
This commit is contained in:
parent
2ee86d1e18
commit
e5f21b2f9c
Notes:
github-actions[bot]
2025-04-04 16:13:53 +00:00
Author: https://github.com/tcl3
Commit: e5f21b2f9c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4222
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 6 additions and 12 deletions
|
@ -15,11 +15,7 @@ namespace Web::CSS {
|
||||||
|
|
||||||
float FilterOperation::Blur::resolved_radius(Layout::Node const& node) const
|
float FilterOperation::Blur::resolved_radius(Layout::Node const& node) const
|
||||||
{
|
{
|
||||||
if (radius.has_value())
|
return radius.resolved({ .length_resolution_context = Length::ResolutionContext::for_layout_node(node) })->to_px(node).to_float();
|
||||||
return radius->resolved({ .length_resolution_context = Length::ResolutionContext::for_layout_node(node) })->to_px(node).to_float();
|
|
||||||
|
|
||||||
// Default value when omitted is 0px.
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float FilterOperation::HueRotate::angle_degrees(Layout::Node const& node) const
|
float FilterOperation::HueRotate::angle_degrees(Layout::Node const& node) const
|
||||||
|
@ -56,9 +52,7 @@ String FilterValueListStyleValue::to_string(SerializationMode) const
|
||||||
builder.append(' ');
|
builder.append(' ');
|
||||||
filter_function.visit(
|
filter_function.visit(
|
||||||
[&](FilterOperation::Blur const& blur) {
|
[&](FilterOperation::Blur const& blur) {
|
||||||
builder.append("blur("sv);
|
builder.appendff("blur({}"sv, blur.radius.to_string());
|
||||||
if (blur.radius.has_value())
|
|
||||||
builder.append(blur.radius->to_string());
|
|
||||||
},
|
},
|
||||||
[&](FilterOperation::DropShadow const& drop_shadow) {
|
[&](FilterOperation::DropShadow const& drop_shadow) {
|
||||||
builder.appendff("drop-shadow("sv);
|
builder.appendff("drop-shadow("sv);
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace Web::CSS {
|
||||||
namespace FilterOperation {
|
namespace FilterOperation {
|
||||||
|
|
||||||
struct Blur {
|
struct Blur {
|
||||||
Optional<LengthOrCalculated> radius;
|
LengthOrCalculated radius { Length::make_px(0) };
|
||||||
float resolved_radius(Layout::Node const&) const;
|
float resolved_radius(Layout::Node const&) const;
|
||||||
bool operator==(Blur const&) const = default;
|
bool operator==(Blur const&) const = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,11 +2,11 @@ Harness status: OK
|
||||||
|
|
||||||
Found 34 tests
|
Found 34 tests
|
||||||
|
|
||||||
17 Pass
|
18 Pass
|
||||||
17 Fail
|
16 Fail
|
||||||
Pass Property filter value 'none'
|
Pass Property filter value 'none'
|
||||||
Pass Property filter value 'blur(100px)'
|
Pass Property filter value 'blur(100px)'
|
||||||
Fail Property filter value 'blur()'
|
Pass Property filter value 'blur()'
|
||||||
Pass Property filter value 'brightness(0)'
|
Pass Property filter value 'brightness(0)'
|
||||||
Fail Property filter value 'brightness(300%)'
|
Fail Property filter value 'brightness(300%)'
|
||||||
Pass Property filter value 'brightness()'
|
Pass Property filter value 'brightness()'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue