2021-03-09 17:36:21 +01:00
|
|
|
/*
|
2021-04-28 22:46:44 +02:00
|
|
|
* Copyright (c) 2020-2021, the SerenityOS developers.
|
2021-09-03 11:14:37 +01:00
|
|
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
2021-03-09 17:36:21 +01:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-03-09 17:36:21 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-07-01 14:13:48 +01:00
|
|
|
#include <AK/RefCounted.h>
|
2021-03-09 17:36:21 +01:00
|
|
|
#include <AK/Vector.h>
|
2021-07-01 14:54:27 +01:00
|
|
|
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
|
2021-03-09 17:36:21 +01:00
|
|
|
#include <LibWeb/CSS/Parser/Token.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2021-07-01 14:13:48 +01:00
|
|
|
class StyleBlockRule : public RefCounted<StyleBlockRule> {
|
2021-03-09 17:36:21 +01:00
|
|
|
friend class Parser;
|
|
|
|
|
|
|
|
public:
|
|
|
|
StyleBlockRule();
|
2021-12-03 12:12:44 +00:00
|
|
|
explicit StyleBlockRule(Token token, Vector<StyleComponentValueRule>&& values)
|
2022-03-13 17:14:06 +01:00
|
|
|
: m_token(move(token))
|
2021-12-03 12:12:44 +00:00
|
|
|
, m_values(move(values))
|
|
|
|
{
|
|
|
|
}
|
2021-03-09 17:36:21 +01:00
|
|
|
~StyleBlockRule();
|
|
|
|
|
2021-07-03 15:06:53 +01:00
|
|
|
bool is_curly() const { return m_token.is(Token::Type::OpenCurly); }
|
|
|
|
bool is_paren() const { return m_token.is(Token::Type::OpenParen); }
|
|
|
|
bool is_square() const { return m_token.is(Token::Type::OpenSquare); }
|
2021-06-30 16:27:37 +01:00
|
|
|
|
2021-12-03 12:12:44 +00:00
|
|
|
Token const& token() const { return m_token; }
|
|
|
|
|
2021-07-01 14:54:27 +01:00
|
|
|
Vector<StyleComponentValueRule> const& values() const { return m_values; }
|
2021-06-30 16:27:37 +01:00
|
|
|
|
2021-03-09 17:36:21 +01:00
|
|
|
String to_string() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Token m_token;
|
2021-07-01 14:54:27 +01:00
|
|
|
Vector<StyleComponentValueRule> m_values;
|
2021-03-09 17:36:21 +01:00
|
|
|
};
|
|
|
|
}
|