mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
LibWeb/HTML: Port Window.frames to IDL
This commit is contained in:
parent
437a7c977e
commit
dcff775ab1
Notes:
sideshowbarker
2024-07-17 09:39:38 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/dcff775ab1 Pull-request: https://github.com/SerenityOS/serenity/pull/17752 Reviewed-by: https://github.com/awesomekling
3 changed files with 12 additions and 11 deletions
|
@ -1092,7 +1092,6 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
|
||||||
|
|
||||||
// FIXME: These should be native accessors, not properties
|
// FIXME: These should be native accessors, not properties
|
||||||
define_native_accessor(realm, "top", top_getter, nullptr, JS::Attribute::Enumerable);
|
define_native_accessor(realm, "top", top_getter, nullptr, JS::Attribute::Enumerable);
|
||||||
define_native_accessor(realm, "frames", frames_getter, {}, JS::Attribute::Enumerable);
|
|
||||||
define_native_accessor(realm, "parent", parent_getter, {}, JS::Attribute::Enumerable);
|
define_native_accessor(realm, "parent", parent_getter, {}, JS::Attribute::Enumerable);
|
||||||
define_native_accessor(realm, "document", document_getter, {}, JS::Attribute::Enumerable);
|
define_native_accessor(realm, "document", document_getter, {}, JS::Attribute::Enumerable);
|
||||||
define_native_accessor(realm, "frameElement", frame_element_getter, {}, JS::Attribute::Enumerable);
|
define_native_accessor(realm, "frameElement", frame_element_getter, {}, JS::Attribute::Enumerable);
|
||||||
|
@ -1216,6 +1215,13 @@ JS::NonnullGCPtr<WindowProxy> Window::self() const
|
||||||
return verify_cast<WindowProxy>(relevant_realm(*this).global_environment().global_this_value());
|
return verify_cast<WindowProxy>(relevant_realm(*this).global_environment().global_this_value());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://html.spec.whatwg.org/multipage/window-object.html#dom-frames
|
||||||
|
JS::NonnullGCPtr<WindowProxy> Window::frames() const
|
||||||
|
{
|
||||||
|
// The window, frames, and self getter steps are to return this's relevant realm.[[GlobalEnv]].[[GlobalThisValue]].
|
||||||
|
return verify_cast<WindowProxy>(relevant_realm(*this).global_environment().global_this_value());
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator
|
// https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator
|
||||||
JS::NonnullGCPtr<Navigator> Window::navigator() const
|
JS::NonnullGCPtr<Navigator> Window::navigator() const
|
||||||
{
|
{
|
||||||
|
@ -1536,14 +1542,6 @@ JS_DEFINE_NATIVE_FUNCTION(Window::top_getter)
|
||||||
return browsing_context->top_level_browsing_context().window_proxy();
|
return browsing_context->top_level_browsing_context().window_proxy();
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/window-object.html#dom-frames
|
|
||||||
JS_DEFINE_NATIVE_FUNCTION(Window::frames_getter)
|
|
||||||
{
|
|
||||||
auto* impl = TRY(impl_from(vm));
|
|
||||||
// The window, frames, and self getter steps are to return this's relevant realm.[[GlobalEnv]].[[GlobalThisValue]].
|
|
||||||
return &relevant_realm(*impl).global_environment().global_this_value();
|
|
||||||
}
|
|
||||||
|
|
||||||
JS_DEFINE_NATIVE_FUNCTION(Window::parent_getter)
|
JS_DEFINE_NATIVE_FUNCTION(Window::parent_getter)
|
||||||
{
|
{
|
||||||
auto* impl = TRY(impl_from(vm));
|
auto* impl = TRY(impl_from(vm));
|
||||||
|
|
|
@ -143,6 +143,8 @@ public:
|
||||||
JS::NonnullGCPtr<WindowProxy> window() const;
|
JS::NonnullGCPtr<WindowProxy> window() const;
|
||||||
JS::NonnullGCPtr<WindowProxy> self() const;
|
JS::NonnullGCPtr<WindowProxy> self() const;
|
||||||
|
|
||||||
|
JS::NonnullGCPtr<WindowProxy> frames() const;
|
||||||
|
|
||||||
JS::NonnullGCPtr<Navigator> navigator() const;
|
JS::NonnullGCPtr<Navigator> navigator() const;
|
||||||
|
|
||||||
void alert(String const& message = {});
|
void alert(String const& message = {});
|
||||||
|
@ -243,8 +245,6 @@ private:
|
||||||
JS_DECLARE_NATIVE_FUNCTION(inner_width_getter);
|
JS_DECLARE_NATIVE_FUNCTION(inner_width_getter);
|
||||||
JS_DECLARE_NATIVE_FUNCTION(inner_height_getter);
|
JS_DECLARE_NATIVE_FUNCTION(inner_height_getter);
|
||||||
|
|
||||||
JS_DECLARE_NATIVE_FUNCTION(frames_getter);
|
|
||||||
|
|
||||||
JS_DECLARE_NATIVE_FUNCTION(parent_getter);
|
JS_DECLARE_NATIVE_FUNCTION(parent_getter);
|
||||||
|
|
||||||
JS_DECLARE_NATIVE_FUNCTION(device_pixel_ratio_getter);
|
JS_DECLARE_NATIVE_FUNCTION(device_pixel_ratio_getter);
|
||||||
|
|
|
@ -9,6 +9,9 @@ interface Window : EventTarget {
|
||||||
[LegacyUnforgeable] readonly attribute WindowProxy window;
|
[LegacyUnforgeable] readonly attribute WindowProxy window;
|
||||||
[Replaceable] readonly attribute WindowProxy self;
|
[Replaceable] readonly attribute WindowProxy self;
|
||||||
|
|
||||||
|
// other browsing contexts
|
||||||
|
[Replaceable] readonly attribute WindowProxy frames;
|
||||||
|
|
||||||
// the user agent
|
// the user agent
|
||||||
readonly attribute Navigator navigator;
|
readonly attribute Navigator navigator;
|
||||||
[ImplementedAs=navigator] readonly attribute Navigator clientInformation; // legacy alias of .navigator
|
[ImplementedAs=navigator] readonly attribute Navigator clientInformation; // legacy alias of .navigator
|
||||||
|
|
Loading…
Reference in a new issue