2021-02-21 13:45:26 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-21 13:45:26 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/RefCounted.h>
|
|
|
|
#include <AK/String.h>
|
2021-09-29 19:41:46 +02:00
|
|
|
#include <LibWeb/Bindings/Wrappable.h>
|
2021-03-13 20:11:33 +01:00
|
|
|
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
2021-02-21 13:45:26 +02:00
|
|
|
#include <LibWeb/CSS/Selector.h>
|
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2021-09-29 19:41:46 +02:00
|
|
|
class CSSRule
|
|
|
|
: public RefCounted<CSSRule>
|
|
|
|
, public Bindings::Wrappable {
|
2021-02-21 13:45:26 +02:00
|
|
|
public:
|
2021-09-29 19:41:46 +02:00
|
|
|
using WrapperType = Bindings::CSSRuleWrapper;
|
|
|
|
|
2021-02-21 13:45:26 +02:00
|
|
|
virtual ~CSSRule();
|
|
|
|
|
|
|
|
enum class Type : u32 {
|
|
|
|
Style,
|
|
|
|
Import,
|
|
|
|
Media,
|
2021-10-08 17:48:14 +01:00
|
|
|
Supports,
|
2021-02-21 13:45:26 +02:00
|
|
|
__Count,
|
|
|
|
};
|
|
|
|
|
|
|
|
virtual StringView class_name() const = 0;
|
|
|
|
virtual Type type() const = 0;
|
|
|
|
|
2021-10-01 19:57:45 +02:00
|
|
|
String css_text() const;
|
|
|
|
void set_css_text(StringView);
|
|
|
|
|
2021-03-18 21:50:52 +01:00
|
|
|
template<typename T>
|
|
|
|
bool fast_is() const = delete;
|
|
|
|
|
2021-10-01 19:57:45 +02:00
|
|
|
protected:
|
|
|
|
virtual String serialized() const = 0;
|
2021-02-21 13:45:26 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|