1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

LibWeb: Add range-checking to property_accepts_value()

For `number` and `integer` types, you can add a range afterwards to add
a range check, using similar syntax to that used in the CSS specs. For
example:

```json
"font-weight": {
  ...
  "valid-types": [
    "number [1,1000]"
  ],
  ...
}
```

This limits any numbers to the range `1 <= n <= 1000`.
This commit is contained in:
Sam Atkins 2021-09-23 12:45:08 +01:00 committed by Andreas Kling
parent e262596ee1
commit b927972da7
4 changed files with 31 additions and 3 deletions

View file

@ -290,8 +290,11 @@ public:
return is_builtin() || is_custom_property() || is_calculated();
}
float as_number() const;
virtual String to_string() const = 0;
virtual Length to_length() const { return {}; }
virtual Color to_color(Layout::NodeWithStyle const&) const { return {}; }
CSS::ValueID to_identifier() const;