summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-07-28 17:21:23 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-28 18:55:47 +0200
commit8b55d3d86eb304389fa2557525d13aa4538d81c9 (patch)
treef54a6ff13945517d389c555ce5a32a079d20124d /Libraries/LibWeb
parentc99a3efc5bacbcd38a0da0ed25df53bfe9a4a7bc (diff)
downloadserenity-8b55d3d86eb304389fa2557525d13aa4538d81c9.zip
LibWeb: Move MouseEvent into the UIEvents namespace
Named after the UIEvents specification that houses MouseEvent.
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r--Libraries/LibWeb/Bindings/EventWrapperFactory.cpp2
-rw-r--r--Libraries/LibWeb/CMakeLists.txt2
-rw-r--r--Libraries/LibWeb/CodeGenerators/WrapperGenerator.cpp6
-rw-r--r--Libraries/LibWeb/Frame/EventHandler.cpp15
-rw-r--r--Libraries/LibWeb/PageView.cpp6
-rw-r--r--Libraries/LibWeb/UIEvents/MouseEvent.h (renamed from Libraries/LibWeb/DOM/MouseEvent.h)2
-rw-r--r--Libraries/LibWeb/UIEvents/MouseEvent.idl (renamed from Libraries/LibWeb/DOM/MouseEvent.idl)0
7 files changed, 17 insertions, 16 deletions
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<MouseEventWrapper*>(wrap_impl(global_object, static_cast<DOM::MouseEvent&>(event)));
+ return static_cast<MouseEventWrapper*>(wrap_impl(global_object, static_cast<UIEvents::MouseEvent&>(event)));
return static_cast<EventWrapper*>(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(<LibWeb/DOM/" << interface.name << ".h>)";
out() << "#include <LibWeb/DOM/" << interface.name << ".h>";
- out() << "#else";
+ out() << "#elif __has_include(<LibWeb/HTML/" << interface.name << ".h>)";
out() << "#include <LibWeb/HTML/" << interface.name << ".h>";
+ out() << "#elif __has_include(<LibWeb/UIEvents/" << interface.name << ".h>)";
+ out() << "#include <LibWeb/UIEvents/" << interface.name << ".h>";
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 <LibGUI/Window.h>
#include <LibJS/Runtime/Value.h>
#include <LibWeb/DOM/Document.h>
-#include <LibWeb/HTML/HTMLAnchorElement.h>
-#include <LibWeb/HTML/HTMLIFrameElement.h>
-#include <LibWeb/DOM/MouseEvent.h>
#include <LibWeb/Frame/EventHandler.h>
#include <LibWeb/Frame/Frame.h>
+#include <LibWeb/HTML/HTMLAnchorElement.h>
+#include <LibWeb/HTML/HTMLIFrameElement.h>
#include <LibWeb/Layout/LayoutDocument.h>
#include <LibWeb/PageView.h>
+#include <LibWeb/UIEvents/MouseEvent.h>
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 <LibJS/Runtime/Value.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/DOM/ElementFactory.h>
-#include <LibWeb/HTML/HTMLAnchorElement.h>
-#include <LibWeb/HTML/HTMLImageElement.h>
-#include <LibWeb/DOM/MouseEvent.h>
#include <LibWeb/DOM/Text.h>
#include <LibWeb/Dump.h>
#include <LibWeb/Frame/EventHandler.h>
#include <LibWeb/Frame/Frame.h>
+#include <LibWeb/HTML/HTMLAnchorElement.h>
+#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/Layout/LayoutBreak.h>
#include <LibWeb/Layout/LayoutDocument.h>
#include <LibWeb/Layout/LayoutNode.h>
@@ -53,6 +52,7 @@
#include <LibWeb/PageView.h>
#include <LibWeb/Painting/PaintContext.h>
#include <LibWeb/Parser/HTMLDocumentParser.h>
+#include <LibWeb/UIEvents/MouseEvent.h>
#include <stdio.h>
//#define SELECTION_DEBUG
diff --git a/Libraries/LibWeb/DOM/MouseEvent.h b/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 <LibWeb/DOM/Event.h>
-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
index 4cecda9462..4cecda9462 100644
--- a/Libraries/LibWeb/DOM/MouseEvent.idl
+++ b/Libraries/LibWeb/UIEvents/MouseEvent.idl