diff --git a/Libraries/LibWeb/CSS/CSSNumericType.cpp b/Libraries/LibWeb/CSS/CSSNumericType.cpp index 40780b5cefd..7064acb0324 100644 --- a/Libraries/LibWeb/CSS/CSSNumericType.cpp +++ b/Libraries/LibWeb/CSS/CSSNumericType.cpp @@ -5,11 +5,9 @@ */ #include "CSSNumericType.h" -#include #include #include #include -#include #include #include @@ -374,26 +372,47 @@ Optional CSSNumericType::entry_with_value_1_while_all_ return result; } +static bool matches(CSSNumericType::BaseType base_type, ValueType value_type) +{ + switch (base_type) { + case CSSNumericType::BaseType::Length: + return value_type == ValueType::Length; + case CSSNumericType::BaseType::Angle: + return value_type == ValueType::Angle; + case CSSNumericType::BaseType::Time: + return value_type == ValueType::Time; + case CSSNumericType::BaseType::Frequency: + return value_type == ValueType::Frequency; + case CSSNumericType::BaseType::Resolution: + return value_type == ValueType::Resolution; + case CSSNumericType::BaseType::Flex: + return value_type == ValueType::Flex; + case CSSNumericType::BaseType::Percent: + return value_type == ValueType::Percentage; + case CSSNumericType::BaseType::__Count: + default: + return false; + } +} + // https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue-match -bool CSSNumericType::matches_dimension(BaseType type) const +bool CSSNumericType::matches_dimension(BaseType type, Optional percentages_resolve_as) const { // A type matches if its only non-zero entry is «[ "length" → 1 ]». // Similarly for ,