Serenity Operating System
1/*
2 * Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org>
3 *
4 * SPDX-License-Identifier: BSD-2-Clause
5 */
6
7#pragma once
8
9#include <LibWeb/CSS/CSSStyleDeclaration.h>
10
11namespace Web::CSS {
12
13class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration {
14 WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration);
15
16public:
17 static WebIDL::ExceptionOr<JS::NonnullGCPtr<ResolvedCSSStyleDeclaration>> create(DOM::Element& element);
18
19 virtual ~ResolvedCSSStyleDeclaration() override = default;
20
21 virtual size_t length() const override;
22 virtual DeprecatedString item(size_t index) const override;
23 virtual Optional<StyleProperty> property(PropertyID) const override;
24 virtual WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority) override;
25 virtual WebIDL::ExceptionOr<DeprecatedString> remove_property(PropertyID) override;
26
27 virtual DeprecatedString serialized() const override;
28 virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
29
30private:
31 explicit ResolvedCSSStyleDeclaration(DOM::Element&);
32
33 virtual void visit_edges(Cell::Visitor&) override;
34
35 RefPtr<StyleValue const> style_value_for_property(Layout::NodeWithStyle const&, PropertyID) const;
36
37 JS::NonnullGCPtr<DOM::Element> m_element;
38};
39
40}