ladybird/Userland/Libraries/LibWeb/CSS/CSSRule.h
Andreas Kling 3db847c64a LibWeb: Implement CSSRule and CSSStyleDeclaration serialization
There are a handful of FIXME's here, but this seems generally good.
Note that CSS *values* don't get serialized in a spec-compliant way
since we currently rely on StyleValue::to_string() which is ad-hoc.
2021-10-01 20:17:15 +02:00

45 lines
839 B
C++

/*
* Copyright (c) 2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/String.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/CSS/CSSStyleDeclaration.h>
#include <LibWeb/CSS/Selector.h>
namespace Web::CSS {
class CSSRule
: public RefCounted<CSSRule>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::CSSRuleWrapper;
virtual ~CSSRule();
enum class Type : u32 {
Style,
Import,
Media,
__Count,
};
virtual StringView class_name() const = 0;
virtual Type type() const = 0;
String css_text() const;
void set_css_text(StringView);
template<typename T>
bool fast_is() const = delete;
protected:
virtual String serialized() const = 0;
};
}