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