Quellcode durchsuchen

LibWeb: Start generating code for the Window object from IDL :^)

Linus Groh vor 2 Jahren
Ursprung
Commit
c130fd6993

+ 2 - 0
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -1122,6 +1122,8 @@ WebIDL::ExceptionOr<void> Window::initialize_web_interfaces(Badge<WindowEnvironm
     m_location = MUST_OR_THROW_OOM(heap().allocate<Location>(realm, realm));
     m_navigator = MUST_OR_THROW_OOM(heap().allocate<Navigator>(realm, realm));
 
+    MUST_OR_THROW_OOM(Bindings::WindowGlobalMixin::initialize(realm, *this));
+
     // FIXME: These should be native accessors, not properties
     define_native_accessor(realm, "top", top_getter, nullptr, JS::Attribute::Enumerable);
     define_native_accessor(realm, "window", window_getter, {}, JS::Attribute::Enumerable);

+ 3 - 1
Userland/Libraries/LibWeb/HTML/Window.h

@@ -23,6 +23,7 @@
 #include <LibWeb/HTML/Plugin.h>
 #include <LibWeb/HTML/Scripting/ImportMap.h>
 #include <LibWeb/HTML/WindowEventHandlers.h>
+#include <LibWeb/Bindings/WindowGlobalMixin.h>
 
 namespace Web::HTML {
 
@@ -34,7 +35,8 @@ using TimerHandler = Variant<JS::Handle<WebIDL::CallbackType>, DeprecatedString>
 class Window final
     : public DOM::EventTarget
     , public HTML::GlobalEventHandlers
-    , public HTML::WindowEventHandlers {
+    , public HTML::WindowEventHandlers
+    , public Bindings::WindowGlobalMixin {
     WEB_PLATFORM_OBJECT(Window, DOM::EventTarget);
 
 public:

+ 1 - 1
Userland/Libraries/LibWeb/idl_files.cmake

@@ -163,7 +163,7 @@ libweb_js_bindings(HTML/PromiseRejectionEvent)
 libweb_js_bindings(HTML/Storage)
 libweb_js_bindings(HTML/SubmitEvent)
 libweb_js_bindings(HTML/TextMetrics)
-libweb_js_bindings(HTML/Window)
+libweb_js_bindings(HTML/Window GLOBAL)
 libweb_js_bindings(HTML/Worker)
 libweb_js_bindings(HTML/WorkerGlobalScope)
 libweb_js_bindings(HTML/WorkerLocation)