mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:27:45 +00:00
LibWeb: Make ShadowRoot.mode return ShadowRootMode instead of String
This commit is contained in:
parent
34913c48d3
commit
9a7f786262
3 changed files with 6 additions and 9 deletions
|
@ -83,7 +83,7 @@ void Event::append_to_path(EventTarget& invocation_target, JS::GCPtr<EventTarget
|
||||||
if (is<ShadowRoot>(invocation_target_node)) {
|
if (is<ShadowRoot>(invocation_target_node)) {
|
||||||
auto& invocation_target_shadow_root = verify_cast<ShadowRoot>(invocation_target_node);
|
auto& invocation_target_shadow_root = verify_cast<ShadowRoot>(invocation_target_node);
|
||||||
// 4. If invocationTarget is a shadow root whose mode is "closed", then set root-of-closed-tree to true.
|
// 4. If invocationTarget is a shadow root whose mode is "closed", then set root-of-closed-tree to true.
|
||||||
root_of_closed_tree = invocation_target_shadow_root.closed();
|
root_of_closed_tree = invocation_target_shadow_root.mode() == Bindings::ShadowRootMode::Closed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibWeb/Bindings/ShadowRootPrototype.h>
|
||||||
#include <LibWeb/DOM/DocumentFragment.h>
|
#include <LibWeb/DOM/DocumentFragment.h>
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::DOM {
|
||||||
|
@ -14,7 +15,7 @@ class ShadowRoot final : public DocumentFragment {
|
||||||
WEB_PLATFORM_OBJECT(ShadowRoot, DocumentFragment);
|
WEB_PLATFORM_OBJECT(ShadowRoot, DocumentFragment);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool closed() const { return m_closed; }
|
Bindings::ShadowRootMode mode() const { return m_mode; }
|
||||||
|
|
||||||
bool delegates_focus() const { return m_delegates_focus; }
|
bool delegates_focus() const { return m_delegates_focus; }
|
||||||
void set_delegates_focus(bool delegates_focus) { m_delegates_focus = delegates_focus; }
|
void set_delegates_focus(bool delegates_focus) { m_delegates_focus = delegates_focus; }
|
||||||
|
@ -25,9 +26,6 @@ public:
|
||||||
// ^EventTarget
|
// ^EventTarget
|
||||||
virtual EventTarget* get_parent(Event const&) override;
|
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<DeprecatedString> inner_html() const;
|
||||||
WebIDL::ExceptionOr<void> set_inner_html(DeprecatedString const&);
|
WebIDL::ExceptionOr<void> set_inner_html(DeprecatedString const&);
|
||||||
|
|
||||||
|
@ -39,8 +37,8 @@ private:
|
||||||
virtual DeprecatedFlyString node_name() const override { return "#shadow-root"; }
|
virtual DeprecatedFlyString node_name() const override { return "#shadow-root"; }
|
||||||
virtual bool is_shadow_root() const final { return true; }
|
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.
|
// NOTE: The specification doesn't seem to specify a default value for closed. Assuming closed for now.
|
||||||
bool m_closed { false };
|
Bindings::ShadowRootMode m_mode { Bindings::ShadowRootMode::Closed };
|
||||||
bool m_delegates_focus { false };
|
bool m_delegates_focus { false };
|
||||||
bool m_available_to_element_internals { false };
|
bool m_available_to_element_internals { false };
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
// https://dom.spec.whatwg.org/#shadowroot
|
// https://dom.spec.whatwg.org/#shadowroot
|
||||||
[Exposed=Window]
|
[Exposed=Window]
|
||||||
interface ShadowRoot : DocumentFragment {
|
interface ShadowRoot : DocumentFragment {
|
||||||
// FIXME: mode should return a ShadowRootMode
|
readonly attribute ShadowRootMode mode;
|
||||||
readonly attribute DOMString mode;
|
|
||||||
// FIXME: readonly attribute boolean delegatesFocus;
|
// FIXME: readonly attribute boolean delegatesFocus;
|
||||||
// FIXME: readonly attribute SlotAssignmentMode slotAssignment;
|
// FIXME: readonly attribute SlotAssignmentMode slotAssignment;
|
||||||
readonly attribute Element host;
|
readonly attribute Element host;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue