mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb/CSS: Expose method for parsing a type of StyleValue
In a few places, user code wants to parse a `<color>` or `<length>` etc, but we didn't have a way to do so, so they would do something similar-ish instead, like parse the value of the `color` property. Let's make that available instead.
This commit is contained in:
parent
fd559341e3
commit
7aef3245ea
Notes:
github-actions[bot]
2025-11-14 09:56:40 +00:00
Author: https://github.com/AtkinsSJ
Commit: 7aef3245ea
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6811
Reviewed-by: https://github.com/lpas
3 changed files with 16 additions and 0 deletions
|
|
@ -80,6 +80,13 @@ RefPtr<CSS::StyleValue const> parse_css_value(CSS::Parser::ParsingParams const&
|
|||
return CSS::Parser::Parser::create(context, string).parse_as_css_value(property_id);
|
||||
}
|
||||
|
||||
RefPtr<CSS::StyleValue const> parse_css_type(CSS::Parser::ParsingParams const& context, StringView string, CSS::ValueType value_type)
|
||||
{
|
||||
if (string.is_empty())
|
||||
return nullptr;
|
||||
return CSS::Parser::Parser::create(context, string).parse_as_type(value_type);
|
||||
}
|
||||
|
||||
RefPtr<CSS::StyleValue const> parse_css_descriptor(CSS::Parser::ParsingParams const& parsing_params, CSS::AtRuleID at_rule_id, CSS::DescriptorID descriptor_id, StringView string)
|
||||
{
|
||||
if (string.is_empty())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue