mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibWeb: Don't crash with invalid transform-origin values
This commit is contained in:
parent
0e3386bb4c
commit
b8f78e3bc1
|
|
@ -3907,14 +3907,14 @@ RefPtr<CSSStyleValue const> Parser::parse_transform_origin_value(TokenStream<Com
|
|||
auto second_value = to_axis_offset(parse_css_value_for_property(PropertyID::TransformOrigin, tokens));
|
||||
auto third_value = parse_length_value(tokens);
|
||||
|
||||
if (!first_value.has_value() || !second_value.has_value())
|
||||
return nullptr;
|
||||
|
||||
if ((first_value->offset->is_length() || first_value->offset->is_percentage()) && second_value->axis == Axis::X)
|
||||
return nullptr;
|
||||
if ((second_value->offset->is_length() || second_value->offset->is_percentage()) && first_value->axis == Axis::Y)
|
||||
return nullptr;
|
||||
|
||||
if (!first_value.has_value() || !second_value.has_value())
|
||||
return nullptr;
|
||||
|
||||
if (!third_value)
|
||||
third_value = zero_value;
|
||||
|
||||
|
|
|
|||
1
Tests/LibWeb/Text/expected/invalid-transform-origin.txt
Normal file
1
Tests/LibWeb/Text/expected/invalid-transform-origin.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
PASS (didn't crash)
|
||||
8
Tests/LibWeb/Text/input/invalid-transform-origin.html
Normal file
8
Tests/LibWeb/Text/input/invalid-transform-origin.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="include.js"></script>
|
||||
<div style="transform-origin: bad value"></div>
|
||||
<script>
|
||||
test(() => {
|
||||
println("PASS (didn't crash)");
|
||||
});
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user