mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-16 05:51:55 +00:00
LibWeb: Clamp grayscale, invert, filter and opacity filter values to 1
This commit is contained in:
parent
e5f21b2f9c
commit
e73438e82c
Notes:
github-actions[bot]
2025-04-04 16:13:46 +00:00
Author: https://github.com/tcl3
Commit: e73438e82c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4222
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 18 additions and 12 deletions
|
@ -4432,6 +4432,12 @@ RefPtr<CSSStyleValue> Parser::parse_filter_value_list_value(TokenStream<Componen
|
|||
return {};
|
||||
if (amount->is_number() && amount->number().value() < 0)
|
||||
return {};
|
||||
if (first_is_one_of(filter_token, FilterToken::Grayscale, FilterToken::Invert, FilterToken::Opacity, FilterToken::Sepia)) {
|
||||
if (amount->is_percentage() && amount->percentage().value() > 100)
|
||||
amount = Percentage { 100 };
|
||||
if (amount->is_number() && amount->number().value() > 1)
|
||||
amount = Number { Number::Type::Integer, 1.0 };
|
||||
}
|
||||
}
|
||||
return if_no_more_tokens_return(FilterOperation::Color { filter_token_to_operation(filter_token), amount.value_or(Number { Number::Type::Integer, 1 }) });
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue