diff --git a/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp b/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp index cb0db37954..88f4d900fb 100644 --- a/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp +++ b/Libraries/LibWeb/Bindings/EventWrapperFactory.cpp @@ -33,7 +33,7 @@ namespace Bindings { EventWrapper* wrap(JS::GlobalObject& global_object, DOM::Event& event) { if (event.is_mouse_event()) - return static_cast(wrap_impl(global_object, static_cast(event))); + return static_cast(wrap_impl(global_object, static_cast(event))); return static_cast(wrap_impl(global_object, event)); } diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 704d0a040d..61cce0f1db 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -166,7 +166,6 @@ libweb_js_wrapper(DOM/DocumentType) libweb_js_wrapper(DOM/Element) libweb_js_wrapper(DOM/Event) libweb_js_wrapper(DOM/EventTarget) -libweb_js_wrapper(DOM/MouseEvent) libweb_js_wrapper(DOM/Node) libweb_js_wrapper(HTML/CanvasRenderingContext2D) libweb_js_wrapper(HTML/HTMLAnchorElement) @@ -191,6 +190,7 @@ libweb_js_wrapper(HTML/HTMLTableElement) libweb_js_wrapper(HTML/HTMLTableRowElement) libweb_js_wrapper(HTML/HTMLTitleElement) libweb_js_wrapper(HTML/ImageData) +libweb_js_wrapper(UIEvents/MouseEvent) get_property(WRAPPER_SOURCES GLOBAL PROPERTY wrapper_sources) set(SOURCES ${SOURCES} ${WRAPPER_SOURCES}) diff --git a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp index 4d2375c0f6..9595f282b2 100644 --- a/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp +++ b/Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp @@ -325,7 +325,7 @@ int main(int argc, char** argv) return 1; } - if (namespace_ == "DOM") { + if (namespace_ == "DOM" || namespace_ == "UIEvents") { StringBuilder builder; builder.append(namespace_); builder.append("::"); @@ -411,8 +411,10 @@ static void generate_header(const IDL::Interface& interface) // FIXME: This is very strange. out() << "#if __has_include()"; out() << "#include "; - out() << "#else"; + out() << "#elif __has_include()"; out() << "#include "; + out() << "#elif __has_include()"; + out() << "#include "; out() << "#endif"; if (wrapper_base_class != "Wrapper") diff --git a/Libraries/LibWeb/Frame/EventHandler.cpp b/Libraries/LibWeb/Frame/EventHandler.cpp index c6a340a4ef..a7a607d539 100644 --- a/Libraries/LibWeb/Frame/EventHandler.cpp +++ b/Libraries/LibWeb/Frame/EventHandler.cpp @@ -28,13 +28,13 @@ #include #include #include -#include -#include -#include #include #include +#include +#include #include #include +#include namespace Web { @@ -85,7 +85,7 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button return false; } auto offset = compute_mouse_event_offset(position, *result.layout_node); - node->dispatch_event(DOM::MouseEvent::create("mouseup", offset.x(), offset.y())); + node->dispatch_event(UIEvents::MouseEvent::create("mouseup", offset.x(), offset.y())); handled_event = true; } @@ -119,7 +119,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt } auto offset = compute_mouse_event_offset(position, *result.layout_node); - node->dispatch_event(DOM::MouseEvent::create("mousedown", offset.x(), offset.y())); + node->dispatch_event(UIEvents::MouseEvent::create("mousedown", offset.x(), offset.y())); if (!layout_root()) return true; @@ -153,8 +153,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt layout_root()->selection().set({ result.layout_node, result.index_in_node }, {}); dump_selection("MouseDown"); m_in_mouse_selection = true; - } - else if (button == GUI::MouseButton::Right) { + } else if (button == GUI::MouseButton::Right) { page_client.page_did_request_context_menu(m_frame.to_main_frame_position(position)); } } @@ -192,7 +191,7 @@ bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned butt is_hovering_link = true; } auto offset = compute_mouse_event_offset(position, *result.layout_node); - node->dispatch_event(DOM::MouseEvent::create("mousemove", offset.x(), offset.y())); + node->dispatch_event(UIEvents::MouseEvent::create("mousemove", offset.x(), offset.y())); if (!layout_root()) return true; } diff --git a/Libraries/LibWeb/PageView.cpp b/Libraries/LibWeb/PageView.cpp index 9d53c97257..4a08bdef45 100644 --- a/Libraries/LibWeb/PageView.cpp +++ b/Libraries/LibWeb/PageView.cpp @@ -38,13 +38,12 @@ #include #include #include -#include -#include -#include #include #include #include #include +#include +#include #include #include #include @@ -53,6 +52,7 @@ #include #include #include +#include #include //#define SELECTION_DEBUG diff --git a/Libraries/LibWeb/DOM/MouseEvent.h b/Libraries/LibWeb/UIEvents/MouseEvent.h similarity index 98% rename from Libraries/LibWeb/DOM/MouseEvent.h rename to Libraries/LibWeb/UIEvents/MouseEvent.h index f60d3d2f6f..0121c2eef6 100644 --- a/Libraries/LibWeb/DOM/MouseEvent.h +++ b/Libraries/LibWeb/UIEvents/MouseEvent.h @@ -28,7 +28,7 @@ #include -namespace Web::DOM { +namespace Web::UIEvents { class MouseEvent final : public DOM::Event { public: diff --git a/Libraries/LibWeb/DOM/MouseEvent.idl b/Libraries/LibWeb/UIEvents/MouseEvent.idl similarity index 100% rename from Libraries/LibWeb/DOM/MouseEvent.idl rename to Libraries/LibWeb/UIEvents/MouseEvent.idl