diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 030b10ef298..00cebe37399 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -1363,6 +1363,8 @@ RefPtr Parser::parse_single_background_position_x_or_y_value(Toke transaction.commit(); return EdgeStyleValue::create(relative_edge, {}); } + if (value->is_keyword()) + return {}; } } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/parsing/background-position-x-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/parsing/background-position-x-invalid.txt new file mode 100644 index 00000000000..a057c814649 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/parsing/background-position-x-invalid.txt @@ -0,0 +1,14 @@ +Harness status: OK + +Found 9 tests + +9 Pass +Pass e.style['background-position-x'] = "top" should not set the property value +Pass e.style['background-position-x'] = "bottom" should not set the property value +Pass e.style['background-position-x'] = "y-start" should not set the property value +Pass e.style['background-position-x'] = "y-end" should not set the property value +Pass e.style['background-position-x'] = "center 10px" should not set the property value +Pass e.style['background-position-x'] = "20% left" should not set the property value +Pass e.style['background-position-x'] = "right left" should not set the property value +Pass e.style['background-position-x'] = "x-start center" should not set the property value +Pass e.style['background-position-x'] = "left, center right" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/parsing/background-position-y-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/parsing/background-position-y-invalid.txt new file mode 100644 index 00000000000..40d09afca11 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-backgrounds/parsing/background-position-y-invalid.txt @@ -0,0 +1,14 @@ +Harness status: OK + +Found 9 tests + +9 Pass +Pass e.style['background-position-y'] = "left" should not set the property value +Pass e.style['background-position-y'] = "right" should not set the property value +Pass e.style['background-position-y'] = "x-start" should not set the property value +Pass e.style['background-position-y'] = "x-end" should not set the property value +Pass e.style['background-position-y'] = "center 10px" should not set the property value +Pass e.style['background-position-y'] = "20% top" should not set the property value +Pass e.style['background-position-y'] = "bottom top" should not set the property value +Pass e.style['background-position-y'] = "y-start center" should not set the property value +Pass e.style['background-position-y'] = "top, center bottom" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/parsing/background-position-x-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/parsing/background-position-x-invalid.html new file mode 100644 index 00000000000..4acd920c211 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/parsing/background-position-x-invalid.html @@ -0,0 +1,25 @@ + + + + +CSS Backgrounds and Borders Module Level 4: parsing background-position-x with invalid values + + + + + + + + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/parsing/background-position-y-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/parsing/background-position-y-invalid.html new file mode 100644 index 00000000000..cf5ffe933c8 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-backgrounds/parsing/background-position-y-invalid.html @@ -0,0 +1,25 @@ + + + + +CSS Backgrounds and Borders Module Level 4: parsing background-position-y with invalid values + + + + + + + + + +