summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/Parser
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-01-14 20:49:06 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-20 00:04:10 +0100
commitf75e796909d4e841c73973b278187b7efdc22d55 (patch)
treecdca98f7068679afe9253497e5110c0defd27141 /Userland/Libraries/LibWeb/CSS/Parser
parent2a3abf09ff4c3cd6439ba995da5d90c948b931c6 (diff)
downloadserenity-f75e796909d4e841c73973b278187b7efdc22d55.zip
LibWeb: Convert border-radii from Length to LengthPercentage :^)
The visit_lengths() code is a bit awkward but we'll clean that up later.
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/Parser')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 813d17c314..3f8ba8c4f5 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -3009,18 +3009,18 @@ RefPtr<StyleValue> Parser::parse_border_value(Vector<StyleComponentValueRule> co
RefPtr<StyleValue> Parser::parse_border_radius_value(Vector<StyleComponentValueRule> const& component_values)
{
if (component_values.size() == 2) {
- auto horizontal = parse_length(component_values[0]);
- auto vertical = parse_length(component_values[1]);
- if (horizontal.has_value() && vertical.has_value())
- return BorderRadiusStyleValue::create(horizontal.value(), vertical.value());
+ auto horizontal = parse_dimension(component_values[0]);
+ auto vertical = parse_dimension(component_values[1]);
+ if (horizontal.has_value() && horizontal->is_length_percentage() && vertical.has_value() && vertical->is_length_percentage())
+ return BorderRadiusStyleValue::create(horizontal->length_percentage(), vertical->length_percentage());
return nullptr;
}
if (component_values.size() == 1) {
- auto radius = parse_length(component_values[0]);
- if (radius.has_value())
- return BorderRadiusStyleValue::create(radius.value(), radius.value());
+ auto radius = parse_dimension(component_values[0]);
+ if (radius.has_value() && radius->is_length_percentage())
+ return BorderRadiusStyleValue::create(radius->length_percentage(), radius->length_percentage());
return nullptr;
}