1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:37:45 +00:00

LibWeb: Add direct StyleComponentValueRule constructors

Rather than passing a ComponentType, and then manually modifying the
data fields, we now create them initialized.

The constructor that takes a Token is intentionally left implicit,
so that we can automatically convert when using the TokenStream later.
This commit is contained in:
Sam Atkins 2021-07-03 14:54:19 +01:00 committed by Andreas Kling
parent 82d12b170a
commit 8671d79ba4
3 changed files with 22 additions and 20 deletions

View file

@ -35,8 +35,19 @@ StyleRule::~StyleRule() { }
StyleBlockRule::StyleBlockRule() { }
StyleBlockRule::~StyleBlockRule() { }
StyleComponentValueRule::StyleComponentValueRule(ComponentType type)
: m_type(type)
StyleComponentValueRule::StyleComponentValueRule(Token token)
: m_type(StyleComponentValueRule::ComponentType::Token)
, m_token(token)
{
}
StyleComponentValueRule::StyleComponentValueRule(NonnullRefPtr<StyleFunctionRule> function)
: m_type(StyleComponentValueRule::ComponentType::Function)
, m_function(function)
{
}
StyleComponentValueRule::StyleComponentValueRule(NonnullRefPtr<StyleBlockRule> block)
: m_type(StyleComponentValueRule::ComponentType::Block)
, m_block(block)
{
}
StyleComponentValueRule::~StyleComponentValueRule() { }