mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibWeb: Move StyleBlockRule code into StyleBlockRule.cpp
This commit is contained in:
parent
e0b2ebcc7b
commit
624df40e20
4 changed files with 33 additions and 19 deletions
|
@ -47,6 +47,7 @@ set(SOURCES
|
||||||
CSS/Parser/ComponentValue.cpp
|
CSS/Parser/ComponentValue.cpp
|
||||||
CSS/Parser/Function.cpp
|
CSS/Parser/Function.cpp
|
||||||
CSS/Parser/Parser.cpp
|
CSS/Parser/Parser.cpp
|
||||||
|
CSS/Parser/StyleBlockRule.cpp
|
||||||
CSS/Parser/StyleRules.cpp
|
CSS/Parser/StyleRules.cpp
|
||||||
CSS/Parser/Token.cpp
|
CSS/Parser/Token.cpp
|
||||||
CSS/Parser/Tokenizer.cpp
|
CSS/Parser/Tokenizer.cpp
|
||||||
|
|
31
Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.cpp
Normal file
31
Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.cpp
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* 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/StyleBlockRule.h>
|
||||||
|
|
||||||
|
namespace Web::CSS {
|
||||||
|
|
||||||
|
StyleBlockRule::StyleBlockRule() = default;
|
||||||
|
StyleBlockRule::StyleBlockRule(Token token, Vector<Parser::ComponentValue>&& values)
|
||||||
|
: m_token(move(token))
|
||||||
|
, m_values(move(values))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
StyleBlockRule::~StyleBlockRule() = default;
|
||||||
|
|
||||||
|
String StyleBlockRule::to_string() const
|
||||||
|
{
|
||||||
|
StringBuilder builder;
|
||||||
|
|
||||||
|
builder.append(m_token.bracket_string());
|
||||||
|
builder.join(" ", m_values);
|
||||||
|
builder.append(m_token.bracket_mirror_string());
|
||||||
|
|
||||||
|
return builder.to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -20,11 +20,7 @@ class StyleBlockRule : public RefCounted<StyleBlockRule> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StyleBlockRule();
|
StyleBlockRule();
|
||||||
explicit StyleBlockRule(Token token, Vector<Parser::ComponentValue>&& values)
|
StyleBlockRule(Token, Vector<Parser::ComponentValue>&&);
|
||||||
: m_token(move(token))
|
|
||||||
, m_values(move(values))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
~StyleBlockRule();
|
~StyleBlockRule();
|
||||||
|
|
||||||
bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
|
bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
|
||||||
|
|
|
@ -33,9 +33,6 @@ StyleRule::StyleRule(StyleRule::Type type)
|
||||||
}
|
}
|
||||||
StyleRule::~StyleRule() = default;
|
StyleRule::~StyleRule() = default;
|
||||||
|
|
||||||
StyleBlockRule::StyleBlockRule() = default;
|
|
||||||
StyleBlockRule::~StyleBlockRule() = default;
|
|
||||||
|
|
||||||
Declaration::Declaration() = default;
|
Declaration::Declaration() = default;
|
||||||
Declaration::~Declaration() = default;
|
Declaration::~Declaration() = default;
|
||||||
|
|
||||||
|
@ -87,17 +84,6 @@ String StyleRule::to_string() const
|
||||||
return builder.to_string();
|
return builder.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
String StyleBlockRule::to_string() const
|
|
||||||
{
|
|
||||||
StringBuilder builder;
|
|
||||||
|
|
||||||
builder.append(m_token.bracket_string());
|
|
||||||
append_with_to_string(builder, " ", m_values);
|
|
||||||
builder.append(m_token.bracket_mirror_string());
|
|
||||||
|
|
||||||
return builder.to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
String Declaration::to_string() const
|
String Declaration::to_string() const
|
||||||
{
|
{
|
||||||
StringBuilder builder;
|
StringBuilder builder;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue