diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 896253fe0b7..935827bb5f3 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -4432,7 +4432,7 @@ RefPtr Parser::parse_filter_value_list_value(TokenStreamis_calculated() && blur_radius->value().raw_value() < 0)) return {}; return if_no_more_tokens_return(FilterOperation::Blur { blur_radius.value() }); } else if (filter_token == FilterToken::DropShadow) { @@ -4498,6 +4498,12 @@ RefPtr Parser::parse_filter_value_list_value(TokenStreamis_percentage() && amount->percentage().value() < 0) + return {}; + if (amount->is_number() && amount->number().value() < 0) + return {}; + } return if_no_more_tokens_return(FilterOperation::Color { filter_token_to_operation(filter_token), amount }); } }; diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/backdrop-filter-parsing-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/backdrop-filter-parsing-invalid.txt new file mode 100644 index 00000000000..56b4a41a3f4 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/backdrop-filter-parsing-invalid.txt @@ -0,0 +1,30 @@ +Harness status: OK + +Found 25 tests + +25 Pass +Pass e.style['backdrop-filter'] = "auto" should not set the property value +Pass e.style['backdrop-filter'] = "none hue-rotate(0deg)" should not set the property value +Pass e.style['backdrop-filter'] = "blur(10)" should not set the property value +Pass e.style['backdrop-filter'] = "blur(-100px)" should not set the property value +Pass e.style['backdrop-filter'] = "brightness(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "brightness(30px)" should not set the property value +Pass e.style['backdrop-filter'] = "contrast(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "contrast(30px)" should not set the property value +Pass e.style['backdrop-filter'] = "drop-shadow(10 20)" should not set the property value +Pass e.style['backdrop-filter'] = "drop-shadow(10% 20%)" should not set the property value +Pass e.style['backdrop-filter'] = "drop-shadow(1px)" should not set the property value +Pass e.style['backdrop-filter'] = "drop-shadow(1px 2px 3px 4px)" should not set the property value +Pass e.style['backdrop-filter'] = "drop-shadow(rgb(4, 5, 6))" should not set the property value +Pass e.style['backdrop-filter'] = "drop-shadow()" should not set the property value +Pass e.style['backdrop-filter'] = "grayscale(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "grayscale(30px)" should not set the property value +Pass e.style['backdrop-filter'] = "hue-rotate(90)" should not set the property value +Pass e.style['backdrop-filter'] = "invert(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "invert(30px)" should not set the property value +Pass e.style['backdrop-filter'] = "opacity(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "opacity(30px)" should not set the property value +Pass e.style['backdrop-filter'] = "saturate(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "saturate(30px)" should not set the property value +Pass e.style['backdrop-filter'] = "sepia(-20)" should not set the property value +Pass e.style['backdrop-filter'] = "sepia(30px)" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-parsing-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-parsing-invalid.txt new file mode 100644 index 00000000000..1574292daec --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/filter-effects/parsing/filter-parsing-invalid.txt @@ -0,0 +1,30 @@ +Harness status: OK + +Found 25 tests + +25 Pass +Pass e.style['filter'] = "auto" should not set the property value +Pass e.style['filter'] = "none hue-rotate(0deg)" should not set the property value +Pass e.style['filter'] = "blur(10)" should not set the property value +Pass e.style['filter'] = "blur(-100px)" should not set the property value +Pass e.style['filter'] = "brightness(-20)" should not set the property value +Pass e.style['filter'] = "brightness(30px)" should not set the property value +Pass e.style['filter'] = "contrast(-20)" should not set the property value +Pass e.style['filter'] = "contrast(30px)" should not set the property value +Pass e.style['filter'] = "drop-shadow(10 20)" should not set the property value +Pass e.style['filter'] = "drop-shadow(10% 20%)" should not set the property value +Pass e.style['filter'] = "drop-shadow(1px)" should not set the property value +Pass e.style['filter'] = "drop-shadow(1px 2px 3px 4px)" should not set the property value +Pass e.style['filter'] = "drop-shadow(rgb(4, 5, 6))" should not set the property value +Pass e.style['filter'] = "drop-shadow()" should not set the property value +Pass e.style['filter'] = "grayscale(-20)" should not set the property value +Pass e.style['filter'] = "grayscale(30px)" should not set the property value +Pass e.style['filter'] = "hue-rotate(90)" should not set the property value +Pass e.style['filter'] = "invert(-20)" should not set the property value +Pass e.style['filter'] = "invert(30px)" should not set the property value +Pass e.style['filter'] = "opacity(-20)" should not set the property value +Pass e.style['filter'] = "opacity(30px)" should not set the property value +Pass e.style['filter'] = "saturate(-20)" should not set the property value +Pass e.style['filter'] = "saturate(30px)" should not set the property value +Pass e.style['filter'] = "sepia(-20)" should not set the property value +Pass e.style['filter'] = "sepia(30px)" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/parsing/backdrop-filter-parsing-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/parsing/backdrop-filter-parsing-invalid.html new file mode 100644 index 00000000000..342680b0c98 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/parsing/backdrop-filter-parsing-invalid.html @@ -0,0 +1,54 @@ + + + + +Filter Effects Module Level 2: parsing backdrop-filter with invalid values + + + + + + + + + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/parsing/filter-parsing-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/parsing/filter-parsing-invalid.html new file mode 100644 index 00000000000..8ab3d98dced --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/filter-effects/parsing/filter-parsing-invalid.html @@ -0,0 +1,54 @@ + + + + +Filter Effects Module Level 1: parsing filter with invalid values + + + + + + + + + + +