summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@gmail.com>2021-07-28 16:29:11 +0100
committerAndreas Kling <kling@serenityos.org>2021-07-31 00:18:11 +0200
commit21c59efbb9531fcc8f1fb352a74e1daf96060687 (patch)
tree0154a55fbcc6bd441d7e67e1316c8c896e68a6a0 /Userland/Libraries/LibWeb
parentd6668dbc5620284e908ed604b93493b1e8e1315a (diff)
downloadserenity-21c59efbb9531fcc8f1fb352a74e1daf96060687.zip
LibWeb: Treat CSS calc() values as "builtin_or_dynamic"
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp6
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.h2
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.h15
3 files changed, 8 insertions, 15 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 5972f4335f..c1acefa746 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -1386,7 +1386,7 @@ Optional<float> Parser::try_parse_float(StringView string)
return is_negative ? -value : value;
}
-RefPtr<StyleValue> Parser::parse_keyword_or_custom_value(ParsingContext const&, StyleComponentValueRule const& component_value)
+RefPtr<StyleValue> Parser::parse_builtin_or_dynamic_value(ParsingContext const& context, StyleComponentValueRule const& component_value)
{
if (component_value.is(Token::Type::Ident)) {
auto ident = component_value.token().ident();
@@ -1804,8 +1804,8 @@ RefPtr<StyleValue> Parser::parse_css_value(ParsingContext const& context, Proper
}
}
- if (auto keyword_or_custom = parse_keyword_or_custom_value(context, component_value))
- return keyword_or_custom;
+ if (auto builtin_or_dynamic = parse_builtin_or_dynamic_value(context, component_value))
+ return builtin_or_dynamic;
if (auto length = parse_length_value(context, component_value))
return length;
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
index fa7d47f6b2..183ed8d37a 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
@@ -169,7 +169,7 @@ private:
static Optional<Length> parse_length(ParsingContext const&, StyleComponentValueRule const&);
static Optional<URL> parse_url_function(ParsingContext const&, StyleComponentValueRule const&);
- static RefPtr<StyleValue> parse_keyword_or_custom_value(ParsingContext const&, StyleComponentValueRule const&);
+ static RefPtr<StyleValue> parse_builtin_or_dynamic_value(ParsingContext const&, StyleComponentValueRule const&);
static RefPtr<StyleValue> parse_length_value(ParsingContext const&, StyleComponentValueRule const&);
static RefPtr<StyleValue> parse_numeric_value(ParsingContext const&, StyleComponentValueRule const&);
static RefPtr<StyleValue> parse_identifier_value(ParsingContext const&, StyleComponentValueRule const&);
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index 5501772d59..52fe6fa632 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h
@@ -241,20 +241,13 @@ public:
bool is_length() const { return type() == Type::Length; }
bool is_custom_property() const { return type() == Type::CustomProperty; }
bool is_numeric() const { return type() == Type::Numeric; }
- bool is_value_list() const
- {
- return type() == Type::ValueList;
- }
-
- bool is_builtin_or_dynamic() const
- {
- return is_inherit() || is_initial() || is_custom_property();
- }
+ bool is_value_list() const { return type() == Type::ValueList; }
bool is_box_shadow() const { return type() == Type::BoxShadow; }
+ bool is_calculated() const { return type() == Type::Calculated; }
- bool is_calculated() const
+ bool is_builtin_or_dynamic() const
{
- return type() == Type::Calculated;
+ return is_inherit() || is_initial() || is_custom_property() || is_calculated();
}
virtual String to_string() const = 0;