mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:37:34 +00:00
LibWeb: Add more CSS Token factory methods
The way we currently deal with `attr()` means having to manufacture Tokens, so we need a way to do that from StyleComputer.
This commit is contained in:
parent
9735f474a2
commit
6f45df5ced
1 changed files with 17 additions and 1 deletions
|
@ -151,7 +151,7 @@ public:
|
||||||
Position const& start_position() const { return m_start_position; }
|
Position const& start_position() const { return m_start_position; }
|
||||||
Position const& end_position() const { return m_end_position; }
|
Position const& end_position() const { return m_end_position; }
|
||||||
|
|
||||||
static Token of_string(FlyString str)
|
static Token create_string(FlyString str)
|
||||||
{
|
{
|
||||||
Token token;
|
Token token;
|
||||||
token.m_type = Type::String;
|
token.m_type = Type::String;
|
||||||
|
@ -184,6 +184,22 @@ public:
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Token create_ident(FlyString ident)
|
||||||
|
{
|
||||||
|
Token token;
|
||||||
|
token.m_type = Type::Ident;
|
||||||
|
token.m_value = move(ident);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Token create_url(FlyString url)
|
||||||
|
{
|
||||||
|
Token token;
|
||||||
|
token.m_type = Type::Url;
|
||||||
|
token.m_value = move(url);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Type m_type { Type::Invalid };
|
Type m_type { Type::Invalid };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue