mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
LibWeb: Make event dispatching spec-compliant
Specification: https://dom.spec.whatwg.org/#concept-event-dispatch This also introduces shadow roots due to it being a requirement of the event dispatcher. However, it does not introduce the full shadow DOM, that can be left for future work. This changes some event dispatches which require certain attributes to be initialised to a value.
This commit is contained in:
parent
819f099a8e
commit
e8b3a65581
Notes:
sideshowbarker
2024-07-19 01:18:46 +09:00
Author: https://github.com/Lubrsi
Commit: e8b3a65581
Pull-request: https://github.com/SerenityOS/serenity/pull/4131
Reviewed-by: https://github.com/awesomekling
32 changed files with 858 additions and 54 deletions
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/TypeCasts.h>
|
||||
#include <LibWeb/UIEvents/UIEvent.h>
|
||||
|
||||
namespace Web::UIEvents {
|
||||
|
|
@ -39,24 +40,25 @@ public:
|
|||
return adopt(*new MouseEvent(event_name, offset_x, offset_y));
|
||||
}
|
||||
|
||||
virtual ~MouseEvent() override { }
|
||||
virtual ~MouseEvent() override;
|
||||
|
||||
i32 offset_x() const { return m_offset_x; }
|
||||
i32 offset_y() const { return m_offset_y; }
|
||||
|
||||
protected:
|
||||
MouseEvent(const FlyString& event_name, i32 offset_x, i32 offset_y)
|
||||
: UIEvent(event_name)
|
||||
, m_offset_x(offset_x)
|
||||
, m_offset_y(offset_y)
|
||||
{
|
||||
}
|
||||
MouseEvent(const FlyString& event_name, i32 offset_x, i32 offset_y);
|
||||
|
||||
private:
|
||||
virtual bool is_mouse_event() const override { return true; }
|
||||
|
||||
void set_event_characteristics();
|
||||
|
||||
i32 m_offset_x { 0 };
|
||||
i32 m_offset_y { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
AK_BEGIN_TYPE_TRAITS(Web::UIEvents::MouseEvent)
|
||||
static bool is_type(const Web::DOM::Event& event) { return event.is_mouse_event(); }
|
||||
AK_END_TYPE_TRAITS()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue