diff --git a/Tests/LibWeb/Layout/expected/css-calc-border-width.txt b/Tests/LibWeb/Layout/expected/css-calc-border-width.txt
new file mode 100644
index 0000000000..870ce8ebbd
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/css-calc-border-width.txt
@@ -0,0 +1,4 @@
+Viewport <#document> at (0,0) content-size 800x600 children: not-inline
+ BlockContainer at (0,0) content-size 800x600 [BFC] children: not-inline
+ BlockContainer
at (8,8) content-size 784x120 children: not-inline
+ BlockContainer at (18,18) content-size 100x100 children: not-inline
diff --git a/Tests/LibWeb/Layout/input/css-calc-border-width.html b/Tests/LibWeb/Layout/input/css-calc-border-width.html
new file mode 100644
index 0000000000..0002da9422
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/css-calc-border-width.html
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index 930a82d801..14a4212bc9 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -7791,40 +7791,41 @@ ErrorOr
Parser::parse_css_value_for_properties(Readonl
if (auto maybe_dynamic = TRY(parse_dynamic_value(peek_token)); maybe_dynamic && maybe_dynamic->is_calculated()) {
(void)tokens.next_token();
auto& calculated = maybe_dynamic->as_calculated();
- if (calculated.resolves_to_angle_percentage()) {
- if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Angle); property.has_value())
+ // This is a bit sensitive to ordering: `` and `` have to be checked before ``.
+ if (calculated.resolves_to_percentage()) {
+ if (auto property = any_property_accepts_type(property_ids, ValueType::Percentage); property.has_value())
return PropertyAndValue { *property, calculated };
} else if (calculated.resolves_to_angle()) {
if (auto property = any_property_accepts_type(property_ids, ValueType::Angle); property.has_value())
return PropertyAndValue { *property, calculated };
- } else if (calculated.resolves_to_frequency_percentage()) {
- if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Frequency); property.has_value())
+ } else if (calculated.resolves_to_angle_percentage()) {
+ if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Angle); property.has_value())
return PropertyAndValue { *property, calculated };
} else if (calculated.resolves_to_frequency()) {
if (auto property = any_property_accepts_type(property_ids, ValueType::Frequency); property.has_value())
return PropertyAndValue { *property, calculated };
- } else if (calculated.resolves_to_number_percentage()) {
- if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Number); property.has_value())
+ } else if (calculated.resolves_to_frequency_percentage()) {
+ if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Frequency); property.has_value())
return PropertyAndValue { *property, calculated };
} else if (calculated.resolves_to_number()) {
if (property_accepts_numeric) {
auto property_or_resolved = property_accepting_integer.value_or_lazy_evaluated([property_accepting_number]() { return property_accepting_number.value(); });
return PropertyAndValue { property_or_resolved, calculated };
}
- } else if (calculated.resolves_to_length_percentage()) {
- if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Length); property.has_value())
+ } else if (calculated.resolves_to_number_percentage()) {
+ if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Number); property.has_value())
return PropertyAndValue { *property, calculated };
} else if (calculated.resolves_to_length()) {
if (auto property = any_property_accepts_type(property_ids, ValueType::Length); property.has_value())
return PropertyAndValue { *property, calculated };
- } else if (calculated.resolves_to_time_percentage()) {
- if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Time); property.has_value())
+ } else if (calculated.resolves_to_length_percentage()) {
+ if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Length); property.has_value())
return PropertyAndValue { *property, calculated };
} else if (calculated.resolves_to_time()) {
if (auto property = any_property_accepts_type(property_ids, ValueType::Time); property.has_value())
return PropertyAndValue { *property, calculated };
- } else if (calculated.resolves_to_percentage()) {
- if (auto property = any_property_accepts_type(property_ids, ValueType::Percentage); property.has_value())
+ } else if (calculated.resolves_to_time_percentage()) {
+ if (auto property = any_property_accepts_type_percentage(property_ids, ValueType::Time); property.has_value())
return PropertyAndValue { *property, calculated };
}
}