diff --git a/Userland/Libraries/LibWeb/DOM/Event.cpp b/Userland/Libraries/LibWeb/DOM/Event.cpp index c1704ec0b9..ef7f358391 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.cpp +++ b/Userland/Libraries/LibWeb/DOM/Event.cpp @@ -58,4 +58,10 @@ void Event::init_event(const String& type, bool bubbles, bool cancelable) initialize(type, bubbles, cancelable); } +// https://dom.spec.whatwg.org/#dom-event-timestamp +double Event::time_stamp() const +{ + return m_time_stamp; +} + } diff --git a/Userland/Libraries/LibWeb/DOM/Event.h b/Userland/Libraries/LibWeb/DOM/Event.h index 85c1e9aa58..b8a2e55add 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.h +++ b/Userland/Libraries/LibWeb/DOM/Event.h @@ -58,6 +58,8 @@ public: virtual ~Event() { } + double time_stamp() const; + const FlyString& type() const { return m_type; } void set_type(const StringView& type) { m_type = type; } @@ -142,6 +144,8 @@ public: void init_event(const String&, bool, bool); + void set_time_stamp(double time_stamp) { m_time_stamp = time_stamp; } + protected: explicit Event(FlyString const& type) : m_type(type) @@ -183,6 +187,8 @@ private: Path m_path; TouchTargetList m_touch_target_list; + double m_time_stamp { 0 }; + void set_cancelled_flag(); }; diff --git a/Userland/Libraries/LibWeb/DOM/Event.idl b/Userland/Libraries/LibWeb/DOM/Event.idl index 18d45c0d49..1819a70dce 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.idl +++ b/Userland/Libraries/LibWeb/DOM/Event.idl @@ -21,6 +21,7 @@ interface Event { readonly attribute boolean composed; readonly attribute boolean isTrusted; + readonly attribute double timeStamp; undefined initEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false);