mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 14:57:54 +03:00
LibWeb: Implement RadioNodeList
This interface is used in the interface for HTMLFormControlsCollection as a live view over its matching elements. Currently the "value" attribute for this interface is left unimplemented.
This commit is contained in:
parent
c2bf391f81
commit
daefe744ba
Notes:
sideshowbarker
2024-07-16 20:44:03 +09:00
Author: https://github.com/shannonbooth Commit: https://github.com/SerenityOS/serenity/commit/daefe744ba Pull-request: https://github.com/SerenityOS/serenity/pull/20656 Reviewed-by: https://github.com/awesomekling
@ -50,6 +50,7 @@ static bool is_platform_object(Type const& type)
|
|||||||
"PerformanceMark"sv,
|
"PerformanceMark"sv,
|
||||||
"ReadableStreamBYOBReader"sv,
|
"ReadableStreamBYOBReader"sv,
|
||||||
"ReadableStreamDefaultReader"sv,
|
"ReadableStreamDefaultReader"sv,
|
||||||
|
"RadioNodeList"sv,
|
||||||
"Range"sv,
|
"Range"sv,
|
||||||
"ReadableStream"sv,
|
"ReadableStream"sv,
|
||||||
"Request"sv,
|
"Request"sv,
|
||||||
|
@ -168,6 +168,7 @@ set(SOURCES
|
|||||||
DOM/Position.cpp
|
DOM/Position.cpp
|
||||||
DOM/ProcessingInstruction.cpp
|
DOM/ProcessingInstruction.cpp
|
||||||
DOM/QualifiedName.cpp
|
DOM/QualifiedName.cpp
|
||||||
|
DOM/RadioNodeList.cpp
|
||||||
DOM/Range.cpp
|
DOM/Range.cpp
|
||||||
DOM/ShadowRoot.cpp
|
DOM/ShadowRoot.cpp
|
||||||
DOM/StaticNodeList.cpp
|
DOM/StaticNodeList.cpp
|
||||||
|
32
Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp
Normal file
32
Userland/Libraries/LibWeb/DOM/RadioNodeList.cpp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
|
#include <LibWeb/Bindings/RadioNodeListPrototype.h>
|
||||||
|
#include <LibWeb/DOM/Element.h>
|
||||||
|
#include <LibWeb/DOM/RadioNodeList.h>
|
||||||
|
|
||||||
|
namespace Web::DOM {
|
||||||
|
|
||||||
|
JS::NonnullGCPtr<RadioNodeList> RadioNodeList::create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
|
||||||
|
{
|
||||||
|
return realm.heap().allocate<RadioNodeList>(realm, realm, root, scope, move(filter));
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioNodeList::RadioNodeList(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter)
|
||||||
|
: LiveNodeList(realm, root, scope, move(filter))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RadioNodeList::~RadioNodeList() = default;
|
||||||
|
|
||||||
|
void RadioNodeList::initialize(JS::Realm& realm)
|
||||||
|
{
|
||||||
|
Base::initialize(realm);
|
||||||
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::RadioNodeListPrototype>(realm, "RadioNodeList"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
29
Userland/Libraries/LibWeb/DOM/RadioNodeList.h
Normal file
29
Userland/Libraries/LibWeb/DOM/RadioNodeList.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <LibWeb/DOM/LiveNodeList.h>
|
||||||
|
|
||||||
|
namespace Web::DOM {
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#radionodelist
|
||||||
|
class RadioNodeList : public LiveNodeList {
|
||||||
|
WEB_PLATFORM_OBJECT(RadioNodeList, LiveNodeList);
|
||||||
|
|
||||||
|
public:
|
||||||
|
[[nodiscard]] static JS::NonnullGCPtr<RadioNodeList> create(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter);
|
||||||
|
|
||||||
|
virtual ~RadioNodeList() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
explicit RadioNodeList(JS::Realm& realm, Node& root, Scope scope, Function<bool(Node const&)> filter);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
7
Userland/Libraries/LibWeb/DOM/RadioNodeList.idl
Normal file
7
Userland/Libraries/LibWeb/DOM/RadioNodeList.idl
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#import <DOM/NodeList.idl>
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#radionodelist
|
||||||
|
[Exposed=Window, UseNewAKString]
|
||||||
|
interface RadioNodeList : NodeList {
|
||||||
|
// FIXME: attribute DOMString value;
|
||||||
|
};
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020-2023, Andreas Kling <kling@serenityos.org>
|
* Copyright (c) 2020-2023, Andreas Kling <kling@serenityos.org>
|
||||||
* Copyright (c) 2021, the SerenityOS developers.
|
* Copyright (c) 2021-2023, the SerenityOS developers.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
@ -238,6 +238,7 @@ class ParentNode;
|
|||||||
class Position;
|
class Position;
|
||||||
class ProcessingInstruction;
|
class ProcessingInstruction;
|
||||||
class Range;
|
class Range;
|
||||||
|
class RadioNodeList;
|
||||||
class RegisteredObserver;
|
class RegisteredObserver;
|
||||||
class ShadowRoot;
|
class ShadowRoot;
|
||||||
class StaticNodeList;
|
class StaticNodeList;
|
||||||
|
@ -50,6 +50,7 @@ libweb_js_bindings(DOM/NodeFilter)
|
|||||||
libweb_js_bindings(DOM/NodeIterator)
|
libweb_js_bindings(DOM/NodeIterator)
|
||||||
libweb_js_bindings(DOM/NodeList)
|
libweb_js_bindings(DOM/NodeList)
|
||||||
libweb_js_bindings(DOM/ProcessingInstruction)
|
libweb_js_bindings(DOM/ProcessingInstruction)
|
||||||
|
libweb_js_bindings(DOM/RadioNodeList)
|
||||||
libweb_js_bindings(DOM/Range)
|
libweb_js_bindings(DOM/Range)
|
||||||
libweb_js_bindings(DOM/ShadowRoot)
|
libweb_js_bindings(DOM/ShadowRoot)
|
||||||
libweb_js_bindings(DOM/StaticRange)
|
libweb_js_bindings(DOM/StaticRange)
|
||||||
|
Loading…
Reference in New Issue
Block a user