diff --git a/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp b/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp index 27ff81fc7a6..d363b4f7387 100644 --- a/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.cpp @@ -15,11 +15,7 @@ namespace Web::CSS { 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(); - - // Default value when omitted is 0px. - return 0; + return radius.resolved({ .length_resolution_context = Length::ResolutionContext::for_layout_node(node) })->to_px(node).to_float(); } float FilterOperation::HueRotate::angle_degrees(Layout::Node const& node) const @@ -56,9 +52,7 @@ String FilterValueListStyleValue::to_string(SerializationMode) const builder.append(' '); filter_function.visit( [&](FilterOperation::Blur const& blur) { - builder.append("blur("sv); - if (blur.radius.has_value()) - builder.append(blur.radius->to_string()); + builder.appendff("blur({}"sv, blur.radius.to_string()); }, [&](FilterOperation::DropShadow const& drop_shadow) { builder.appendff("drop-shadow("sv); diff --git a/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h b/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h index a2f87c43823..43f269c72ea 100644 --- a/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h +++ b/Libraries/LibWeb/CSS/StyleValues/FilterValueListStyleValue.h @@ -21,7 +21,7 @@ namespace Web::CSS { namespace FilterOperation { struct Blur { - Optional radius; + LengthOrCalculated radius { Length::make_px(0) }; float resolved_radius(Layout::Node const&) const; bool operator==(Blur const&) const = default; }; diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-computed.txt b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-computed.txt index 3ed60d237ee..e3a4fbc47e9 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-computed.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-computed.txt @@ -2,11 +2,11 @@ Harness status: OK Found 34 tests -17 Pass -17 Fail +18 Pass +16 Fail Pass Property filter value 'none' Pass Property filter value 'blur(100px)' -Fail Property filter value 'blur()' +Pass Property filter value 'blur()' Pass Property filter value 'brightness(0)' Fail Property filter value 'brightness(300%)' Pass Property filter value 'brightness()'