mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibWeb: Move StyleFunctionRule code into StyleFunctionRule.cpp
This commit is contained in:
parent
d2b8686ae4
commit
084780a0a2
3 changed files with 39 additions and 24 deletions
|
@ -46,6 +46,7 @@ set(SOURCES
|
|||
CSS/MediaQueryList.cpp
|
||||
CSS/Parser/ComponentValue.cpp
|
||||
CSS/Parser/Parser.cpp
|
||||
CSS/Parser/StyleFunctionRule.cpp
|
||||
CSS/Parser/StyleRules.cpp
|
||||
CSS/Parser/Token.cpp
|
||||
CSS/Parser/Tokenizer.cpp
|
||||
|
|
38
Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.cpp
Normal file
38
Userland/Libraries/LibWeb/CSS/Parser/StyleFunctionRule.cpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/CSS/Parser/StyleFunctionRule.h>
|
||||
#include <LibWeb/CSS/Serialize.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
StyleFunctionRule::StyleFunctionRule(String name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
StyleFunctionRule::StyleFunctionRule(String name, Vector<Parser::ComponentValue>&& values)
|
||||
: m_name(move(name))
|
||||
, m_values(move(values))
|
||||
{
|
||||
}
|
||||
|
||||
StyleFunctionRule::~StyleFunctionRule() = default;
|
||||
|
||||
String StyleFunctionRule::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
serialize_an_identifier(builder, m_name);
|
||||
builder.append("(");
|
||||
builder.join(" ", m_values);
|
||||
builder.append(")");
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
}
|
|
@ -39,18 +39,6 @@ StyleBlockRule::~StyleBlockRule() = default;
|
|||
Declaration::Declaration() = default;
|
||||
Declaration::~Declaration() = default;
|
||||
|
||||
StyleFunctionRule::StyleFunctionRule(String name)
|
||||
: m_name(move(name))
|
||||
{
|
||||
}
|
||||
|
||||
StyleFunctionRule::StyleFunctionRule(String name, Vector<Parser::ComponentValue>&& values)
|
||||
: m_name(move(name))
|
||||
, m_values(move(values))
|
||||
{
|
||||
}
|
||||
StyleFunctionRule::~StyleFunctionRule() = default;
|
||||
|
||||
template<class SeparatorType, class CollectionType>
|
||||
void append_with_to_string(StringBuilder& builder, SeparatorType& separator, CollectionType& collection)
|
||||
{
|
||||
|
@ -123,16 +111,4 @@ String Declaration::to_string() const
|
|||
|
||||
return builder.to_string();
|
||||
}
|
||||
|
||||
String StyleFunctionRule::to_string() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
||||
serialize_an_identifier(builder, m_name);
|
||||
builder.append("(");
|
||||
append_with_to_string(builder, " ", m_values);
|
||||
builder.append(")");
|
||||
|
||||
return builder.to_string();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue