@@ -3950,44 +3950,44 @@ RefPtr<StyleValue> Parser::parse_filter_value_list_value(TokenStream<ComponentVa
3950
3950
// blur( <length>? )
3951
3951
if (!tokens.has_next_token ())
3952
3952
return Filter::Blur {};
3953
- auto blur_radius = parse_length (tokens.next_token ());
3953
+ auto blur_radius = parse_length (tokens);
3954
+ tokens.skip_whitespace ();
3954
3955
if (!blur_radius.has_value ())
3955
3956
return {};
3956
- return if_no_more_tokens_return (Filter::Blur { *blur_radius });
3957
+ // FIXME: Support calculated radius
3958
+ return if_no_more_tokens_return (Filter::Blur { blur_radius->value () });
3957
3959
} else if (filter_token == FilterToken::DropShadow) {
3958
3960
if (!tokens.has_next_token ())
3959
3961
return {};
3960
- auto next_token = [&]() -> auto & {
3961
- auto & token = tokens.next_token ();
3962
- tokens.skip_whitespace ();
3963
- return token;
3964
- };
3965
3962
// drop-shadow( [ <color>? && <length>{2,3} ] )
3966
3963
// Note: The following code is a little awkward to allow the color to be before or after the lengths.
3967
- auto & first_param = next_token ();
3968
- Optional<Length> maybe_radius = {};
3969
- auto maybe_color = parse_color (first_param);
3970
- auto x_offset = parse_length (maybe_color.has_value () ? next_token () : first_param);
3964
+ Optional<LengthOrCalculated> maybe_radius = {};
3965
+ auto maybe_color = parse_color (tokens.peek_token ());
3966
+ if (maybe_color.has_value ())
3967
+ (void )tokens.next_token ();
3968
+ auto x_offset = parse_length (tokens);
3969
+ tokens.skip_whitespace ();
3971
3970
if (!x_offset.has_value () || !tokens.has_next_token ()) {
3972
3971
return {};
3973
3972
}
3974
- auto y_offset = parse_length (next_token () );
3973
+ auto y_offset = parse_length (tokens );
3975
3974
if (!y_offset.has_value ()) {
3976
3975
return {};
3977
3976
}
3978
3977
if (tokens.has_next_token ()) {
3979
- auto & token = next_token ();
3980
- maybe_radius = parse_length (token);
3978
+ maybe_radius = parse_length (tokens);
3981
3979
if (!maybe_color.has_value () && (!maybe_radius.has_value () || tokens.has_next_token ())) {
3982
- maybe_color = parse_color (!maybe_radius.has_value () ? token : next_token ());
3980
+ maybe_color = parse_color (tokens.next_token ());
3981
+ tokens.skip_whitespace ();
3983
3982
if (!maybe_color.has_value ()) {
3984
3983
return {};
3985
3984
}
3986
3985
} else if (!maybe_radius.has_value ()) {
3987
3986
return {};
3988
3987
}
3989
3988
}
3990
- return if_no_more_tokens_return (Filter::DropShadow { *x_offset, *y_offset, maybe_radius, maybe_color });
3989
+ // FIXME: Support calculated offsets and radius
3990
+ return if_no_more_tokens_return (Filter::DropShadow { x_offset->value (), y_offset->value (), maybe_radius.map ([](auto & it) { return it.value (); }), maybe_color });
3991
3991
} else if (filter_token == FilterToken::HueRotate) {
3992
3992
// hue-rotate( [ <angle> | <zero> ]? )
3993
3993
if (!tokens.has_next_token ())
0 commit comments