mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:17:45 +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);
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
JS_DECLARE_NATIVE_SETTER(document_setter);
|
||||
|
||||
JS_DECLARE_NATIVE_GETTER(performance_getter);
|
||||
JS_DECLARE_NATIVE_GETTER(screen_getter);
|
||||
|
||||
JS_DECLARE_NATIVE_GETTER(event_getter);
|
||||
|
||||
|
|
|
@ -217,6 +217,8 @@
|
|||
#include <LibWeb/Bindings/SVGPathElementPrototype.h>
|
||||
#include <LibWeb/Bindings/SVGSVGElementConstructor.h>
|
||||
#include <LibWeb/Bindings/SVGSVGElementPrototype.h>
|
||||
#include <LibWeb/Bindings/ScreenConstructor.h>
|
||||
#include <LibWeb/Bindings/ScreenPrototype.h>
|
||||
#include <LibWeb/Bindings/ShadowRootConstructor.h>
|
||||
#include <LibWeb/Bindings/ShadowRootPrototype.h>
|
||||
#include <LibWeb/Bindings/StyleSheetConstructor.h>
|
||||
|
@ -336,6 +338,7 @@
|
|||
ADD_WINDOW_OBJECT_INTERFACE(Performance) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(PerformanceTiming) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(ProgressEvent) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(Screen) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(ShadowRoot) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(StyleSheet) \
|
||||
ADD_WINDOW_OBJECT_INTERFACE(StyleSheetList) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue