ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

LibWeb: Reject invalid CSS `background` property values

Open tcl3 opened this issue 8 months ago • 1 comments

Fixes 12 WPT subtests in the css/css-backgrounds directory.

tcl3 avatar Mar 12 '25 14:03 tcl3

A couple of commit titles you've written "selector" when you want "property".

We generate some bounds-checking code for properties (in PropertyID.h) that you can use in some of these, though not all of them:

bool property_accepts_angle(PropertyID, Angle const&);
bool property_accepts_flex(PropertyID, Flex const&);
bool property_accepts_frequency(PropertyID, Frequency const&);
bool property_accepts_integer(PropertyID, i64 const&);
bool property_accepts_length(PropertyID, Length const&);
bool property_accepts_number(PropertyID, double const&);
bool property_accepts_percentage(PropertyID, Percentage const&);
bool property_accepts_resolution(PropertyID, Resolution const&);
bool property_accepts_time(PropertyID, Time const&);

For example, the border-radius and background-position-* parsing could use property_accepts_length() and property_accepts_percentage(). Though the shadow one can't, currently.

AtkinsSJ avatar Mar 12 '25 14:03 AtkinsSJ