@@ -4719,31 +4719,35 @@ ErrorOr<RefPtr<StyleValue>> Parser::parse_border_value(Vector<ComponentValue> co
4719
4719
RefPtr<StyleValue> border_color;
4720
4720
RefPtr<StyleValue> border_style;
4721
4721
4722
- for (auto const & part : component_values) {
4723
- auto value = TRY (parse_css_value (part));
4724
- if (!value)
4722
+ auto remaining_longhands = Vector { PropertyID::BorderWidth, PropertyID::BorderColor, PropertyID::BorderStyle };
4723
+
4724
+ auto tokens = TokenStream { component_values };
4725
+ while (tokens.has_next_token ()) {
4726
+ auto property_and_value = TRY (parse_css_value_for_properties (remaining_longhands, tokens));
4727
+ if (!property_and_value.style_value )
4725
4728
return nullptr ;
4729
+ auto & value = property_and_value.style_value ;
4730
+ remove_property (remaining_longhands, property_and_value.property );
4726
4731
4727
- if ( property_accepts_value (PropertyID::BorderWidth, *value) ) {
4728
- if (border_width)
4729
- return nullptr ;
4732
+ switch (property_and_value. property ) {
4733
+ case PropertyID::BorderWidth: {
4734
+ VERIFY (!border_width) ;
4730
4735
border_width = value.release_nonnull ();
4731
4736
continue ;
4732
4737
}
4733
- if (property_accepts_value (PropertyID::BorderColor, *value)) {
4734
- if (border_color)
4735
- return nullptr ;
4738
+ case PropertyID::BorderColor: {
4739
+ VERIFY (!border_color);
4736
4740
border_color = value.release_nonnull ();
4737
4741
continue ;
4738
4742
}
4739
- if (property_accepts_value (PropertyID::BorderStyle, *value)) {
4740
- if (border_style)
4741
- return nullptr ;
4743
+ case PropertyID::BorderStyle: {
4744
+ VERIFY (!border_style);
4742
4745
border_style = value.release_nonnull ();
4743
4746
continue ;
4744
4747
}
4745
-
4746
- return nullptr ;
4748
+ default :
4749
+ VERIFY_NOT_REACHED ();
4750
+ }
4747
4751
}
4748
4752
4749
4753
if (!border_width)
0 commit comments