1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:28:11 +00:00

LibWeb: Add Event.timeStamp

Note that the value is always 0 for now. Actually initializing the time
stamp is left as a FIXME.
This commit is contained in:
Andreas Kling 2021-10-11 18:17:23 +02:00
parent f952db1a1f
commit f188e48c3c
3 changed files with 13 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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();
};

View file

@ -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);