1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

LibWeb: Break friendship between CSS Block and Parser

This means deviating a little from the spec, so that we create a
complete Block in one go instead of creating an empty one and then
poking at its internals.
This commit is contained in:
Sam Atkins 2022-04-12 16:05:44 +01:00 committed by Andreas Kling
parent 7128e8e2e6
commit f235da27d9
4 changed files with 14 additions and 11 deletions

View file

@ -16,11 +16,12 @@
namespace Web::CSS::Parser {
class Block : public RefCounted<Block> {
friend class Parser;
public:
Block();
Block(Token, Vector<ComponentValue>&&);
static NonnullRefPtr<Block> create(Token token, Vector<ComponentValue>&& values)
{
return adopt_ref(*new Block(move(token), move(values)));
}
~Block();
bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
@ -34,6 +35,7 @@ public:
String to_string() const;
private:
Block(Token, Vector<ComponentValue>&&);
Token m_token;
Vector<ComponentValue> m_values;
};