1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:07:45 +00:00

LibWeb: Implement adoptedStyleSheets attribute for Document

https://drafts.csswg.org/cssom/#dom-documentorshadowroot-adoptedstylesheets

The attribute implementation for ShadowRoot is currently missing
because we do not yet distinguish between the style sheets of
ShadowRoot and Document, and we need to address the issue first.
This commit is contained in:
Aliaksandr Kalenik 2024-03-07 23:36:52 +01:00 committed by Andreas Kling
parent fceba6a257
commit 7c322ec710
6 changed files with 171 additions and 2 deletions

View file

@ -34,6 +34,7 @@
#include <LibWeb/HTML/SharedImageRequest.h>
#include <LibWeb/HTML/VisibilityState.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
#include <LibWeb/WebIDL/ObservableArray.h>
namespace Web::DOM {
@ -131,6 +132,8 @@ public:
CSS::StyleSheetList& style_sheets();
CSS::StyleSheetList const& style_sheets() const;
void for_each_css_style_sheet(Function<void(CSS::CSSStyleSheet&)>&& callback) const;
CSS::StyleSheetList* style_sheets_for_bindings() { return &style_sheets(); }
virtual FlyString node_name() const override { return "#document"_fly_string; }
@ -598,6 +601,9 @@ public:
[[nodiscard]] bool has_active_resize_observations();
[[nodiscard]] bool has_skipped_resize_observations();
JS::NonnullGCPtr<WebIDL::ObservableArray> adopted_style_sheets() const;
WebIDL::ExceptionOr<void> set_adopted_style_sheets(JS::Value);
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
@ -832,6 +838,8 @@ private:
bool m_design_mode_enabled { false };
bool m_needs_to_resolve_paint_only_properties { true };
mutable JS::GCPtr<WebIDL::ObservableArray> m_adopted_style_sheets;
};
template<>