mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibWeb: Move MouseEvent into the UIEvents namespace
Named after the UIEvents specification that houses MouseEvent.
This commit is contained in:
parent
c99a3efc5b
commit
8b55d3d86e
Notes:
sideshowbarker
2024-07-19 04:30:30 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8b55d3d86eb
7 changed files with 17 additions and 16 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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})
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
|
||||
namespace Web::DOM {
|
||||
namespace Web::UIEvents {
|
||||
|
||||
class MouseEvent final : public DOM::Event {
|
||||
public:
|
Loading…
Add table
Reference in a new issue