ladybird/Userland/Libraries/LibWeb/CSS/Parser/StyleBlockRule.h
Sam Atkins 6c03123b2d LibWeb: Give CSS Token and StyleComponentValueRule matching is() funcs
The end goal here is to make the two classes mostly interchangeable, as
the CSS spec requires that the various parser algorithms can take a
stream of either class, and we want to have that functionality without
needing to duplicate all of the code.
2021-07-11 23:19:56 +02:00

36 lines
892 B
C++

/*
* Copyright (c) 2020-2021, the SerenityOS developers.
* Copyright (c) 2021, Sam Atkins <atkinssj@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/Vector.h>
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
#include <LibWeb/CSS/Parser/Token.h>
namespace Web::CSS {
class StyleBlockRule : public RefCounted<StyleBlockRule> {
friend class Parser;
public:
StyleBlockRule();
~StyleBlockRule();
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); }
Vector<StyleComponentValueRule> const& values() const { return m_values; }
String to_string() const;
private:
Token m_token;
Vector<StyleComponentValueRule> m_values;
};
}