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

LibWeb: Make ShadowRoot.mode return ShadowRootMode instead of String

This commit is contained in:
Karol Kosek 2023-01-28 20:31:56 +01:00 committed by Andreas Kling
parent 34913c48d3
commit 9a7f786262
3 changed files with 6 additions and 9 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include <LibWeb/Bindings/ShadowRootPrototype.h>
#include <LibWeb/DOM/DocumentFragment.h>
namespace Web::DOM {
@ -14,7 +15,7 @@ class ShadowRoot final : public DocumentFragment {
WEB_PLATFORM_OBJECT(ShadowRoot, DocumentFragment);
public:
bool closed() const { return m_closed; }
Bindings::ShadowRootMode mode() const { return m_mode; }
bool delegates_focus() const { return m_delegates_focus; }
void set_delegates_focus(bool delegates_focus) { m_delegates_focus = delegates_focus; }
@ -25,9 +26,6 @@ public:
// ^EventTarget
virtual EventTarget* get_parent(Event const&) override;
// NOTE: This is intended for the JS bindings.
DeprecatedString mode() const { return m_closed ? "closed" : "open"; }
WebIDL::ExceptionOr<DeprecatedString> inner_html() const;
WebIDL::ExceptionOr<void> set_inner_html(DeprecatedString const&);
@ -39,8 +37,8 @@ private:
virtual DeprecatedFlyString node_name() const override { return "#shadow-root"; }
virtual bool is_shadow_root() const final { return true; }
// NOTE: The specification doesn't seem to specify a default value for closed. Assuming false for now.
bool m_closed { false };
// NOTE: The specification doesn't seem to specify a default value for closed. Assuming closed for now.
Bindings::ShadowRootMode m_mode { Bindings::ShadowRootMode::Closed };
bool m_delegates_focus { false };
bool m_available_to_element_internals { false };
};