LibWeb: Refactor Element.attachShadow() after spec changes

The bulk of this function is moved to a new "attach a shadow root"
helper, designed to be used both from here and the HTML parser.
This commit is contained in:
Andreas Kling 2024-06-25 09:42:51 +02:00 committed by Andreas Kling
commit 043ad0eb76
Notes: sideshowbarker 2024-07-17 04:34:25 +09:00
4 changed files with 95 additions and 26 deletions

View file

@ -33,6 +33,8 @@ struct ShadowRootInit {
Bindings::ShadowRootMode mode;
bool delegates_focus = false;
Bindings::SlotAssignmentMode slot_assignment { Bindings::SlotAssignmentMode::Named };
bool clonable = false;
bool serializable = false;
};
// https://w3c.github.io/csswg-drafts/cssom-view-1/#dictdef-scrollintoviewoptions
@ -126,6 +128,7 @@ public:
DOMTokenList* class_list();
WebIDL::ExceptionOr<JS::NonnullGCPtr<ShadowRoot>> attach_shadow(ShadowRootInit init);
WebIDL::ExceptionOr<void> attach_a_shadow_root(Bindings::ShadowRootMode mode, bool clonable, bool serializable, bool delegates_focus, Bindings::SlotAssignmentMode slot_assignment);
JS::GCPtr<ShadowRoot> shadow_root() const;
WebIDL::ExceptionOr<bool> matches(StringView selectors) const;