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 16:49:33 +01:00
|
|
|
#include <AK/RefCounted.h>
|
2021-03-09 17:36:21 +01:00
|
|
|
#include <AK/Vector.h>
|
2021-07-01 14:13:48 +01:00
|
|
|
#include <LibWeb/CSS/Parser/StyleBlockRule.h>
|
2021-06-29 17:03:25 +01:00
|
|
|
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
|
2021-03-09 17:36:21 +01:00
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2021-07-03 13:36:33 +01:00
|
|
|
class StyleRule : public RefCounted<StyleRule> {
|
2021-03-09 17:36:21 +01:00
|
|
|
friend class Parser;
|
|
|
|
|
|
|
|
public:
|
2021-07-03 13:36:33 +01:00
|
|
|
enum class Type {
|
|
|
|
At,
|
|
|
|
Qualified,
|
|
|
|
};
|
|
|
|
|
|
|
|
StyleRule(Type);
|
|
|
|
~StyleRule();
|
2021-07-01 14:13:48 +01:00
|
|
|
|
|
|
|
Vector<StyleComponentValueRule> const& prelude() const { return m_prelude; }
|
2022-03-20 19:05:55 +01:00
|
|
|
RefPtr<StyleBlockRule const> block() const { return m_block; }
|
2021-07-01 14:13:48 +01:00
|
|
|
|
2021-03-09 17:36:21 +01:00
|
|
|
String to_string() const;
|
|
|
|
|
|
|
|
private:
|
2021-07-03 13:36:33 +01:00
|
|
|
Type const m_type;
|
|
|
|
String m_name; // At-rules only
|
2021-06-29 17:03:25 +01:00
|
|
|
Vector<StyleComponentValueRule> m_prelude;
|
2021-07-01 14:13:48 +01:00
|
|
|
RefPtr<StyleBlockRule> m_block;
|
2021-03-09 17:36:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|