@@ -7791,40 +7791,41 @@ ErrorOr<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readonl
7791
7791
if (auto maybe_dynamic = TRY (parse_dynamic_value (peek_token)); maybe_dynamic && maybe_dynamic->is_calculated ()) {
7792
7792
(void )tokens.next_token ();
7793
7793
auto & calculated = maybe_dynamic->as_calculated ();
7794
- if (calculated.resolves_to_angle_percentage ()) {
7795
- if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Angle); property.has_value ())
7794
+ // This is a bit sensitive to ordering: `<foo>` and `<percentage>` have to be checked before `<foo-percentage>`.
7795
+ if (calculated.resolves_to_percentage ()) {
7796
+ if (auto property = any_property_accepts_type (property_ids, ValueType::Percentage); property.has_value ())
7796
7797
return PropertyAndValue { *property, calculated };
7797
7798
} else if (calculated.resolves_to_angle ()) {
7798
7799
if (auto property = any_property_accepts_type (property_ids, ValueType::Angle); property.has_value ())
7799
7800
return PropertyAndValue { *property, calculated };
7800
- } else if (calculated.resolves_to_frequency_percentage ()) {
7801
- if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Frequency ); property.has_value ())
7801
+ } else if (calculated.resolves_to_angle_percentage ()) {
7802
+ if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Angle ); property.has_value ())
7802
7803
return PropertyAndValue { *property, calculated };
7803
7804
} else if (calculated.resolves_to_frequency ()) {
7804
7805
if (auto property = any_property_accepts_type (property_ids, ValueType::Frequency); property.has_value ())
7805
7806
return PropertyAndValue { *property, calculated };
7806
- } else if (calculated.resolves_to_number_percentage ()) {
7807
- if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Number ); property.has_value ())
7807
+ } else if (calculated.resolves_to_frequency_percentage ()) {
7808
+ if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Frequency ); property.has_value ())
7808
7809
return PropertyAndValue { *property, calculated };
7809
7810
} else if (calculated.resolves_to_number ()) {
7810
7811
if (property_accepts_numeric) {
7811
7812
auto property_or_resolved = property_accepting_integer.value_or_lazy_evaluated ([property_accepting_number]() { return property_accepting_number.value (); });
7812
7813
return PropertyAndValue { property_or_resolved, calculated };
7813
7814
}
7814
- } else if (calculated.resolves_to_length_percentage ()) {
7815
- if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Length ); property.has_value ())
7815
+ } else if (calculated.resolves_to_number_percentage ()) {
7816
+ if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Number ); property.has_value ())
7816
7817
return PropertyAndValue { *property, calculated };
7817
7818
} else if (calculated.resolves_to_length ()) {
7818
7819
if (auto property = any_property_accepts_type (property_ids, ValueType::Length); property.has_value ())
7819
7820
return PropertyAndValue { *property, calculated };
7820
- } else if (calculated.resolves_to_time_percentage ()) {
7821
- if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Time ); property.has_value ())
7821
+ } else if (calculated.resolves_to_length_percentage ()) {
7822
+ if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Length ); property.has_value ())
7822
7823
return PropertyAndValue { *property, calculated };
7823
7824
} else if (calculated.resolves_to_time ()) {
7824
7825
if (auto property = any_property_accepts_type (property_ids, ValueType::Time); property.has_value ())
7825
7826
return PropertyAndValue { *property, calculated };
7826
- } else if (calculated.resolves_to_percentage ()) {
7827
- if (auto property = any_property_accepts_type (property_ids, ValueType::Percentage ); property.has_value ())
7827
+ } else if (calculated.resolves_to_time_percentage ()) {
7828
+ if (auto property = any_property_accepts_type_percentage (property_ids, ValueType::Time ); property.has_value ())
7828
7829
return PropertyAndValue { *property, calculated };
7829
7830
}
7830
7831
}
0 commit comments