mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibWeb: Reject invalid background-position-*
property values
This commit is contained in:
parent
764b80a1cc
commit
dc58c11217
Notes:
github-actions[bot]
2025-03-14 15:09:22 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/dc58c112174 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3916 Reviewed-by: https://github.com/AtkinsSJ ✅
5 changed files with 80 additions and 0 deletions
|
@ -1363,6 +1363,8 @@ RefPtr<CSSStyleValue> Parser::parse_single_background_position_x_or_y_value(Toke
|
|||
transaction.commit();
|
||||
return EdgeStyleValue::create(relative_edge, {});
|
||||
}
|
||||
if (value->is_keyword())
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Backgrounds and Borders Module Level 4: parsing background-position-x with invalid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-x">
|
||||
<meta name="assert" content="background-position-x supports only the grammar '[ center | [ left | right | x-start | x-end ]? <length-percentage>? ]#'.">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_invalid_value("background-position-x", "top");
|
||||
test_invalid_value("background-position-x", "bottom");
|
||||
test_invalid_value("background-position-x", "y-start");
|
||||
test_invalid_value("background-position-x", "y-end");
|
||||
test_invalid_value("background-position-x", "center 10px");
|
||||
test_invalid_value("background-position-x", "20% left");
|
||||
test_invalid_value("background-position-x", "right left");
|
||||
test_invalid_value("background-position-x", "x-start center");
|
||||
test_invalid_value("background-position-x", "left, center right");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,25 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>CSS Backgrounds and Borders Module Level 4: parsing background-position-y with invalid values</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-y">
|
||||
<meta name="assert" content="background-position-y supports only the grammar '[ center | [ top | bottom | y-start | y-end ]? <length-percentage>? ]#'.">
|
||||
<script src="../../../resources/testharness.js"></script>
|
||||
<script src="../../../resources/testharnessreport.js"></script>
|
||||
<script src="../../../css/support/parsing-testcommon.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
test_invalid_value("background-position-y", "left");
|
||||
test_invalid_value("background-position-y", "right");
|
||||
test_invalid_value("background-position-y", "x-start");
|
||||
test_invalid_value("background-position-y", "x-end");
|
||||
test_invalid_value("background-position-y", "center 10px");
|
||||
test_invalid_value("background-position-y", "20% top");
|
||||
test_invalid_value("background-position-y", "bottom top");
|
||||
test_invalid_value("background-position-y", "y-start center");
|
||||
test_invalid_value("background-position-y", "top, center bottom");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Reference in a new issue