mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibWeb: Add helper functions to create CSS parser tokens
These will be used when resolving calc() values in StyleComputer. It's indeed strange that calc() resolves to tokens, but it's how the engine currently handles those things. There is room for improvement.
This commit is contained in:
parent
ab9aa9da0d
commit
f14ad0e8c1
1 changed files with 16 additions and 0 deletions
|
@ -159,6 +159,22 @@ public:
|
|||
return token;
|
||||
}
|
||||
|
||||
static Token create_number(float value)
|
||||
{
|
||||
Token token;
|
||||
token.m_type = Type::Number;
|
||||
token.m_number_value = Number(Number::Type::Number, value);
|
||||
return token;
|
||||
}
|
||||
|
||||
static Token create_percentage(float value)
|
||||
{
|
||||
Token token;
|
||||
token.m_type = Type::Percentage;
|
||||
token.m_number_value = Number(Number::Type::Number, value);
|
||||
return token;
|
||||
}
|
||||
|
||||
private:
|
||||
Type m_type { Type::Invalid };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue