mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibWeb: Implement the Screen interface
https://drafts.csswg.org/cssom-view/#the-screen-interface
This commit is contained in:
parent
e8739ddab7
commit
340e1f4b28
10 changed files with 138 additions and 0 deletions
|
@ -40,6 +40,7 @@
|
|||
#include <LibWeb/Bindings/NavigatorObject.h>
|
||||
#include <LibWeb/Bindings/NodeWrapperFactory.h>
|
||||
#include <LibWeb/Bindings/PerformanceWrapper.h>
|
||||
#include <LibWeb/Bindings/ScreenWrapper.h>
|
||||
#include <LibWeb/Bindings/WindowObject.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
|
@ -67,6 +68,7 @@ void WindowObject::initialize_global_object()
|
|||
define_property("self", this, JS::Attribute::Enumerable);
|
||||
define_native_property("document", document_getter, document_setter, JS::Attribute::Enumerable);
|
||||
define_native_property("performance", performance_getter, nullptr, JS::Attribute::Enumerable);
|
||||
define_native_property("screen", screen_getter, nullptr, JS::Attribute::Enumerable);
|
||||
define_native_property("innerWidth", inner_width_getter, nullptr, JS::Attribute::Enumerable);
|
||||
define_native_property("innerHeight", inner_height_getter, nullptr, JS::Attribute::Enumerable);
|
||||
define_native_function("alert", alert);
|
||||
|
@ -371,6 +373,14 @@ JS_DEFINE_NATIVE_GETTER(WindowObject::performance_getter)
|
|||
return wrap(global_object, impl->performance());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_GETTER(WindowObject::screen_getter)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
if (!impl)
|
||||
return {};
|
||||
return wrap(global_object, impl->screen());
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_GETTER(WindowObject::event_getter)
|
||||
{
|
||||
auto* impl = impl_from(vm, global_object);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue