2021-03-09 13:36:21 -03:00
|
|
|
/*
|
2021-04-28 17:46:44 -03:00
|
|
|
* Copyright (c) 2020-2021, the SerenityOS developers.
|
2021-09-03 07:14:37 -03:00
|
|
|
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
2021-03-09 13:36:21 -03:00
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-03-09 13:36:21 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-07-01 12:49:33 -03:00
|
|
|
#include <AK/RefCounted.h>
|
2021-03-09 13:36:21 -03:00
|
|
|
#include <AK/Vector.h>
|
2021-07-01 10:13:48 -03:00
|
|
|
#include <LibWeb/CSS/Parser/StyleBlockRule.h>
|
2021-06-29 13:03:25 -03:00
|
|
|
#include <LibWeb/CSS/Parser/StyleComponentValueRule.h>
|
2021-03-09 13:36:21 -03:00
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
|
2021-07-03 09:36:33 -03:00
|
|
|
class StyleRule : public RefCounted<StyleRule> {
|
2021-03-09 13:36:21 -03:00
|
|
|
friend class Parser;
|
|
|
|
|
|
|
|
|
|
public:
|
2021-07-03 09:36:33 -03:00
|
|
|
enum class Type {
|
|
|
|
|
At,
|
|
|
|
|
Qualified,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StyleRule(Type);
|
|
|
|
|
~StyleRule();
|
2021-07-01 10:13:48 -03:00
|
|
|
|
|
|
|
|
Vector<StyleComponentValueRule> const& prelude() const { return m_prelude; }
|
|
|
|
|
StyleBlockRule const& block() const { return *m_block; }
|
|
|
|
|
|
2021-03-09 13:36:21 -03:00
|
|
|
String to_string() const;
|
|
|
|
|
|
|
|
|
|
private:
|
2021-07-03 09:36:33 -03:00
|
|
|
Type const m_type;
|
|
|
|
|
String m_name; // At-rules only
|
2021-06-29 13:03:25 -03:00
|
|
|
Vector<StyleComponentValueRule> m_prelude;
|
2021-07-01 10:13:48 -03:00
|
|
|
RefPtr<StyleBlockRule> m_block;
|
2021-03-09 13:36:21 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|