2021-09-12 20:05:29 +02:00
|
|
|
/*
|
2023-02-20 18:56:08 +01:00
|
|
|
* Copyright (c) 2021-2023, Andreas Kling <kling@serenityos.org>
|
2021-09-12 20:05:29 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
2024-08-06 12:48:21 +01:00
|
|
|
#include <LibWeb/CSS/Selector.h>
|
2021-09-12 20:05:29 +02:00
|
|
|
|
|
|
|
namespace Web::CSS {
|
|
|
|
|
2021-09-23 12:35:56 +02:00
|
|
|
class ResolvedCSSStyleDeclaration final : public CSSStyleDeclaration {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(ResolvedCSSStyleDeclaration, CSSStyleDeclaration);
|
2023-11-19 19:47:52 +01:00
|
|
|
JS_DECLARE_ALLOCATOR(ResolvedCSSStyleDeclaration);
|
2022-08-07 16:21:26 +02:00
|
|
|
|
2021-09-12 20:05:29 +02:00
|
|
|
public:
|
2024-08-06 12:48:21 +01:00
|
|
|
[[nodiscard]] static JS::NonnullGCPtr<ResolvedCSSStyleDeclaration> create(DOM::Element&, Optional<Selector::PseudoElement::Type> = {});
|
2021-09-12 20:05:29 +02:00
|
|
|
|
2022-03-14 13:21:51 -06:00
|
|
|
virtual ~ResolvedCSSStyleDeclaration() override = default;
|
2021-09-12 20:05:29 +02:00
|
|
|
|
|
|
|
virtual size_t length() const override;
|
2023-09-06 19:07:24 +12:00
|
|
|
virtual String item(size_t index) const override;
|
2023-12-10 12:42:13 +01:00
|
|
|
|
2021-09-12 20:05:29 +02:00
|
|
|
virtual Optional<StyleProperty> property(PropertyID) const override;
|
2022-09-25 17:03:42 +01:00
|
|
|
virtual WebIDL::ExceptionOr<void> set_property(PropertyID, StringView css_text, StringView priority) override;
|
2024-08-04 22:12:31 +01:00
|
|
|
virtual WebIDL::ExceptionOr<void> set_property(StringView property_name, StringView css_text, StringView priority) override;
|
2023-09-06 19:07:24 +12:00
|
|
|
virtual WebIDL::ExceptionOr<String> remove_property(PropertyID) override;
|
2024-08-04 22:12:31 +01:00
|
|
|
virtual WebIDL::ExceptionOr<String> remove_property(StringView property_name) override;
|
2021-09-12 20:05:29 +02:00
|
|
|
|
2023-11-21 10:39:54 +13:00
|
|
|
virtual String serialized() const override;
|
2022-11-05 04:51:05 +00:00
|
|
|
virtual WebIDL::ExceptionOr<void> set_css_text(StringView) override;
|
2021-10-01 19:57:45 +02:00
|
|
|
|
2021-09-12 20:05:29 +02:00
|
|
|
private:
|
2024-08-06 12:48:21 +01:00
|
|
|
explicit ResolvedCSSStyleDeclaration(DOM::Element&, Optional<CSS::Selector::PseudoElement::Type>);
|
2022-09-24 16:34:04 -06:00
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2024-08-14 11:10:54 +01:00
|
|
|
RefPtr<CSSStyleValue const> style_value_for_property(Layout::NodeWithStyle const&, PropertyID) const;
|
2021-09-18 13:14:40 +02:00
|
|
|
|
2022-08-28 13:42:07 +02:00
|
|
|
JS::NonnullGCPtr<DOM::Element> m_element;
|
2024-08-06 12:48:21 +01:00
|
|
|
Optional<CSS::Selector::PseudoElement::Type> m_pseudo_element;
|
2021-09-12 20:05:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|