summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-05-24 17:15:12 +0100
committerAndreas Kling <kling@serenityos.org>2023-05-25 06:36:10 +0200
commita7a61c4cd9579705c934b7fa35567b097b4b6623 (patch)
tree1682224490b1dc04fbc984e9b2e80788b9b693a4
parent2da15f987fe3931f8ba2af56a8e9d3d21fc8c0e2 (diff)
downloadserenity-a7a61c4cd9579705c934b7fa35567b097b4b6623.zip
LibWeb: Use new StyleValue parsing for overflow
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp20
1 files changed, 6 insertions, 14 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index ffcc604ec1..84fda93a61 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -5979,28 +5979,20 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_list_style_value(Vector<ComponentValue
ErrorOr<RefPtr<StyleValue>> Parser::parse_overflow_value(Vector<ComponentValue> const& component_values)
{
+ auto tokens = TokenStream { component_values };
if (component_values.size() == 1) {
- auto maybe_value = TRY(parse_css_value(component_values.first()));
+ auto maybe_value = TRY(parse_css_value_for_property(PropertyID::Overflow, tokens));
if (!maybe_value)
return nullptr;
- auto value = maybe_value.release_nonnull();
- if (property_accepts_value(PropertyID::Overflow, *value))
- return OverflowStyleValue::create(value, value);
- return nullptr;
+ return OverflowStyleValue::create(*maybe_value, *maybe_value);
}
if (component_values.size() == 2) {
- auto maybe_x_value = TRY(parse_css_value(component_values[0]));
- auto maybe_y_value = TRY(parse_css_value(component_values[1]));
-
+ auto maybe_x_value = TRY(parse_css_value_for_property(PropertyID::OverflowX, tokens));
+ auto maybe_y_value = TRY(parse_css_value_for_property(PropertyID::OverflowY, tokens));
if (!maybe_x_value || !maybe_y_value)
return nullptr;
- auto x_value = maybe_x_value.release_nonnull();
- auto y_value = maybe_y_value.release_nonnull();
- if (!property_accepts_value(PropertyID::OverflowX, x_value) || !property_accepts_value(PropertyID::OverflowY, y_value)) {
- return nullptr;
- }
- return OverflowStyleValue::create(x_value, y_value);
+ return OverflowStyleValue::create(maybe_x_value.release_nonnull(), maybe_y_value.release_nonnull());
}
return nullptr;