Skip to content

Truly independent web browser

LibWeb+Meta: Implement EventCounts in Rust

Shannon Booth4ff07c6713b7
diff --git a/Libraries/LibWeb/Bindings/Rust/src/bindings/global_object.rs b/Libraries/LibWeb/Bindings/Rust/src/bindings/global_object.rs
index 3c0b50d3269..0782d060b32 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/bindings/global_object.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/bindings/global_object.rs
@@ -9,7 +9,7 @@
use core::ffi::c_void;
use core::ptr::NonNull;
-use libjs_rust::api::{Gc, MarkedVec, Object, Trace, Vm};
+use libjs_rust::api::{Gc, MarkedVec, Object, Realm, Trace, Vm};
use liburl_rust::Url;
use crate::bindings::cpp_cell::CppCell;
@@ -20,6 +20,7 @@ unsafe extern "C" {
fn web_bindings_window_from_global_object(global_object: *mut c_void) -> *mut c_void;
fn web_bindings_for_each_active_window(ctx: *mut c_void, on_window: unsafe extern "C" fn(*mut c_void, *mut c_void));
fn web_bindings_window_associated_document(window: *mut c_void) -> *mut c_void;
+ fn web_bindings_window_realm(window: *mut c_void) -> *mut c_void;
fn web_bindings_window_page_id(window: *mut c_void) -> u64;
fn web_bindings_window_has_transient_activation(window: *mut c_void) -> bool;
fn web_bindings_window_as_event_target(window: *mut c_void) -> *mut c_void;
@@ -96,10 +97,26 @@ pub(crate) fn active_windows(vm: &Vm) -> MarkedVec<'_, CppWindow> {
}
impl CppWindow {
+ /// # Safety
+ ///
+ /// `window` must be a live Window.
+ pub(crate) unsafe fn from_raw(window: *mut c_void) -> Self {
+ // SAFETY: The caller passes a live Window.
+ Self(unsafe { CppCell::from_raw(window) })
+ }
+
pub(crate) fn as_ptr(&self) -> *mut c_void {
self.0.as_ptr()
}
+ /// https://html.spec.whatwg.org/multipage/webappapis.html#concept-relevant-realm
+ pub(crate) fn realm(&self) -> Gc<Realm> {
+ // SAFETY: The Window is live, and LibWeb returns its live relevant realm.
+ let realm = unsafe { web_bindings_window_realm(self.0.as_ptr()) };
+ // SAFETY: The realm is live.
+ unsafe { Gc::from_non_null(NonNull::new(realm.cast()).expect("a Window has a relevant realm")) }
+ }
+
/// The Window as an EventTarget.
pub(crate) fn as_event_target(&self) -> CppEventTarget {
// SAFETY: The Window is live, and LibWeb returns it as an EventTarget.
diff --git a/Libraries/LibWeb/Bindings/Rust/src/bindings/realm_data.rs b/Libraries/LibWeb/Bindings/Rust/src/bindings/realm_data.rs
index cb63b6cccd7..e10d5e781a8 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/bindings/realm_data.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/bindings/realm_data.rs
@@ -17,6 +17,7 @@ use libjs_rust::api::{EmbedderCell, EmbedderClass, EmbedderValue, FunctionObject
use crate::bindings::interface::Ref;
use crate::bindings::services::web_bindings_wrapper_world;
+use crate::event_timing::event_counts::EventCounts;
use crate::performance_timeline::performance_timeline::PerformanceTimelineRef;
use crate::web_assembly::tag::Tag;
@@ -52,6 +53,8 @@ pub(crate) struct RealmData {
pub(crate) performance_timeline: Cell<Option<PerformanceTimelineRef>>,
/// https://w3c.github.io/performance-timeline/#supportedentrytypes-attribute
pub(crate) performance_observer_supported_entry_types: Cell<Option<Gc<Object>>>,
+ /// https://w3c.github.io/event-timing/#sec-modifications-HTML
+ pub(crate) event_counts: Cell<Option<Ref<EventCounts>>>,
}
static REALM_DATA_CLASS: EmbedderClass<RealmData> = EmbedderClass::new("RealmData");
diff --git a/Libraries/LibWeb/Bindings/Rust/src/event_timing/event_counts.rs b/Libraries/LibWeb/Bindings/Rust/src/event_timing/event_counts.rs
new file mode 100644
index 00000000000..d50c7669663
--- /dev/null
+++ b/Libraries/LibWeb/Bindings/Rust/src/event_timing/event_counts.rs
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+//! EventCounts, https://w3c.github.io/event-timing/#sec-event-counts
+
+use core::cell::RefCell;
+use core::ffi::c_void;
+
+use ak::{Utf16FlyString, Utf16String};
+use libjs_rust::api::{Gc, Map, Trace, Value, Vm};
+
+use crate::bindings::CallContext;
+use crate::bindings::conversions::ToJs;
+use crate::bindings::global_object::CppWindow;
+use crate::bindings::interface::{Ref, Wrappable, allocate};
+use crate::bindings::maplike::Maplike;
+use crate::bindings::realm_data::realm_data;
+
+unsafe extern "C" {
+ fn web_event_timing_for_each_event_type_considered_for_event_timing(
+ context: *mut c_void,
+ callback: unsafe extern "C" fn(*mut c_void, usize),
+ );
+}
+
+/// https://w3c.github.io/event-timing/#sec-event-counts
+#[derive(Trace)]
+#[gc(crate = libjs_rust)]
+pub(crate) struct EventCounts {
+ #[gc(untraced)]
+ entries: RefCell<Vec<(Utf16String, u64)>>,
+}
+
+impl Wrappable for EventCounts {}
+
+impl EventCounts {
+ // https://w3c.github.io/event-timing/#sec-modifications-HTML
+ fn create(vm: &Vm) -> Ref<Self> {
+ // Upon construction of a Performance object whose relevant global object is a Window, its eventCounts must be
+ // initialized to a map containing 0s for all event types that the user agent supports from the list described in
+ // Events exposed.
+ unsafe extern "C" fn append(context: *mut c_void, event_type: usize) {
+ // SAFETY: The context is the list below, and LibWeb lends a live fly string for the call.
+ let entries = unsafe { &mut *context.cast::<Vec<(Utf16String, u64)>>() };
+ entries.push((unsafe { Utf16FlyString::from_raw_borrowed(event_type) }.into(), 0));
+ }
+ let mut entries = Vec::new();
+ // SAFETY: The list outlives the call.
+ unsafe { web_event_timing_for_each_event_type_considered_for_event_timing((&raw mut entries).cast(), append) };
+ allocate(vm, |_| Self {
+ entries: RefCell::new(entries),
+ })
+ }
+
+ fn increment(&self, event_type: &Utf16String) {
+ let mut entries = self.entries.borrow_mut();
+ let entry = entries
+ .iter_mut()
+ .find(|entry| &entry.0 == event_type)
+ .expect("eventCounts contains every event type considered for Event Timing");
+ entry.1 += 1;
+ }
+}
+
+impl Maplike for EventCounts {
+ fn map_entries(&self, cx: &CallContext) -> Gc<Map> {
+ let map_entries = Map::create(cx.vm(), cx.realm());
+ for (key, value) in &*self.entries.borrow() {
+ let key = key.clone().to_js(cx).expect("a string converts to a JS value");
+ let value = value.to_js(cx).expect("an unsigned long long converts to a JS value");
+ map_entries.map_set(cx.vm(), key, value);
+ }
+ map_entries
+ }
+
+ fn map_value(&self, cx: &CallContext, key: &Utf16String) -> Option<Value> {
+ let entries = self.entries.borrow();
+ let entry = entries.iter().find(|entry| &entry.0 == key)?;
+ Some(entry.1.to_js(cx).expect("an unsigned long long converts to a JS value"))
+ }
+}
+
+impl CppWindow {
+ // https://w3c.github.io/event-timing/#sec-modifications-HTML
+ pub(crate) fn event_counts(&self, vm: &Vm) -> Ref<EventCounts> {
+ let data = realm_data(vm, self.realm());
+ // NB: The eventCounts of a Window are created along with its Performance object, which is when they are first
+ // asked for.
+ if let Some(event_counts) = data.event_counts.get() {
+ return event_counts;
+ }
+ let event_counts = EventCounts::create(vm);
+ data.event_counts.set(Some(event_counts));
+ event_counts
+ }
+}
+
+/// https://w3c.github.io/event-timing/#sec-modifications-HTML
+///
+/// # Safety
+///
+/// `vm` must be the live VM, `window` a live Window, and `event_type` a live Utf16FlyString of an event type considered
+/// for Event Timing.
+#[unsafe(no_mangle)]
+pub unsafe extern "C" fn web_rust_event_timing_increment_event_count(
+ vm: *mut c_void,
+ window: *mut c_void,
+ event_type: usize,
+) {
+ // SAFETY: The caller passes the live VM and a live Window, and lends the fly string.
+ let (vm, window, event_type) = unsafe {
+ (
+ &*vm.cast::<Vm>(),
+ CppWindow::from_raw(window),
+ Utf16String::from(Utf16FlyString::from_raw_borrowed(event_type)),
+ )
+ };
+ window.event_counts(vm).increment(&event_type);
+}
diff --git a/Libraries/LibWeb/Bindings/Rust/src/event_timing/mod.rs b/Libraries/LibWeb/Bindings/Rust/src/event_timing/mod.rs
new file mode 100644
index 00000000000..06b3cf34fc7
--- /dev/null
+++ b/Libraries/LibWeb/Bindings/Rust/src/event_timing/mod.rs
@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) 2026-present, the Ladybird developers.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+//! Event Timing, https://w3c.github.io/event-timing/
+
+pub(crate) mod event_counts;
diff --git a/Libraries/LibWeb/Bindings/Rust/src/high_resolution_time/performance.rs b/Libraries/LibWeb/Bindings/Rust/src/high_resolution_time/performance.rs
index 65bc10f3d2f..e8728f55429 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/high_resolution_time/performance.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/high_resolution_time/performance.rs
@@ -21,6 +21,7 @@ use crate::bindings::global_object::{CppWindow, window_from_global_object};
use crate::bindings::interface::{Ref, Wrappable, allocate};
use crate::bindings::{CallContext, Exception, WebIdlResult};
use crate::css::css_rule::wrap_cpp_cell;
+use crate::event_timing::event_counts::EventCounts;
use crate::html::window_or_worker_global_scope::structured_clone;
use crate::performance_timeline::performance_entry::wrap_entries;
use crate::performance_timeline::performance_timeline::{PerformanceTimeline, PerformanceTimelineRef};
@@ -36,7 +37,6 @@ unsafe extern "C" {
fn web_navigation_timing_performance_navigation_create(window: *mut c_void) -> *mut c_void;
fn web_navigation_timing_is_performance_timing_attribute(name: usize) -> bool;
fn web_navigation_timing_performance_timing_attribute(timing: *mut c_void, name: usize) -> u64;
- fn web_event_timing_event_counts(window: *mut c_void) -> *mut c_void;
fn web_event_timing_interaction_count(window: *mut c_void) -> u64;
}
@@ -130,12 +130,10 @@ impl Performance {
}
// https://w3c.github.io/event-timing/#dom-performance-eventcounts
- pub(crate) fn event_counts(&self, cx: &mut CallContext) -> WebIdlResult<CppInterface> {
+ pub(crate) fn event_counts(&self, cx: &mut CallContext) -> WebIdlResult<Ref<EventCounts>> {
// The eventCounts attribute's getter returns this's relevant global object's eventCounts.
let window = self.window().expect("only a Window has eventCounts");
- // SAFETY: The Window is live, and LibWeb returns its live EventCounts.
- let event_counts = unsafe { CppCell::from_raw(web_event_timing_event_counts(window.as_ptr())) };
- Ok(wrap_cpp_cell(cx, &event_counts))
+ Ok(window.event_counts(cx.vm()))
}
// https://w3c.github.io/event-timing/#dom-performance-interactioncount
diff --git a/Libraries/LibWeb/Bindings/Rust/src/lib.rs b/Libraries/LibWeb/Bindings/Rust/src/lib.rs
index a2caaf0e011..751c6490681 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/lib.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/lib.rs
@@ -97,6 +97,12 @@ pub(crate) mod domurl;
)]
pub(crate) mod encoding;
#[cfg(not(test))]
+#[cfg_attr(
+ not(web_idl_bindings),
+ allow(dead_code, reason = "only the generated bindings use the interfaces")
+)]
+pub(crate) mod event_timing;
+#[cfg(not(test))]
pub(crate) mod fetch;
#[cfg_attr(
not(web_idl_bindings),
diff --git a/Libraries/LibWeb/Bindings/RustBindingsServices.cpp b/Libraries/LibWeb/Bindings/RustBindingsServices.cpp
index b2642e61b42..2c9f81405a4 100644
--- a/Libraries/LibWeb/Bindings/RustBindingsServices.cpp
+++ b/Libraries/LibWeb/Bindings/RustBindingsServices.cpp
@@ -102,6 +102,7 @@ void web_bindings_report_an_exception(void* realm, JSValue exception);
HTML::Window* web_bindings_window_from_global_object(JSObject* global_object);
void web_bindings_for_each_active_window(void* ctx, void (*on_window)(void*, HTML::Window*));
DOM::Document* web_bindings_window_associated_document(HTML::Window*);
+JS::Realm* web_bindings_window_realm(HTML::Window*);
u64 web_bindings_window_page_id(HTML::Window*);
bool web_bindings_window_has_transient_activation(HTML::Window*);
DOM::EventTarget* web_bindings_window_as_event_target(HTML::Window*);
@@ -199,6 +200,11 @@ void web_bindings_for_each_active_window(void* ctx, void (*on_window)(void*, HTM
});
}
+JS::Realm* web_bindings_window_realm(HTML::Window* window)
+{
+ return &HTML::relevant_realm(*window);
+}
+
DOM::Document* web_bindings_window_associated_document(HTML::Window* window)
{
return &window->associated_document();
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 520dc74168d..61427927139 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -290,7 +290,6 @@ set(SOURCES
EncryptedMediaExtensions/Algorithms.cpp
EncryptedMediaExtensions/MediaKeySystemAccess.cpp
EntriesAPI/FileSystemEntry.cpp
- EventTiming/EventCounts.cpp
EventTiming/EventTiming.cpp
EventTiming/PerformanceEventTiming.cpp
Fetch/Body.cpp
diff --git a/Libraries/LibWeb/EventTiming/BindingsGlue.h b/Libraries/LibWeb/EventTiming/BindingsGlue.h
deleted file mode 100644
index c263c392351..00000000000
--- a/Libraries/LibWeb/EventTiming/BindingsGlue.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/Optional.h>
-#include <AK/Utf16View.h>
-#include <LibGC/Ptr.h>
-#include <LibJS/Runtime/Map.h>
-#include <LibJS/Runtime/PrimitiveString.h>
-#include <LibJS/Runtime/Realm.h>
-#include <LibJS/Runtime/Value.h>
-#include <LibWeb/EventTiming/EventCounts.h>
-
-namespace Web::Bindings {
-
-// Maplike glue for EventCounts (see Meta/Generators/libweb_bindings/glue_headers.py).
-inline GC::Ref<JS::Map> map_entries(JS::Realm& realm, EventTiming::EventCounts& event_counts)
-{
- auto map_entries = JS::Map::create(realm);
- for (auto const& entry : event_counts.entries()) {
- auto key = JS::PrimitiveString::create(realm.vm(), entry.key);
- map_entries->map_set(JS::Value { key.ptr() }, JS::Value { static_cast<double>(entry.value) });
- }
- return map_entries;
-}
-
-inline Optional<JS::Value> map_get(JS::Realm&, EventTiming::EventCounts& event_counts, Utf16View key)
-{
- auto it = event_counts.entries().find(key);
- if (it == event_counts.entries().end())
- return {};
- return JS::Value { static_cast<double>(it->value) };
-}
-
-inline bool map_has(EventTiming::EventCounts& event_counts, Utf16View key)
-{
- return event_counts.entries().contains(key);
-}
-
-}
diff --git a/Libraries/LibWeb/EventTiming/EventCounts.cpp b/Libraries/LibWeb/EventTiming/EventCounts.cpp
deleted file mode 100644
index 52f76972115..00000000000
--- a/Libraries/LibWeb/EventTiming/EventCounts.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/EventTiming/EventCounts.h>
-#include <LibWeb/EventTiming/EventTiming.h>
-
-namespace Web::EventTiming {
-
-GC_DEFINE_ALLOCATOR(EventCounts);
-
-GC::Ref<EventCounts> EventCounts::create()
-{
- return GC::Heap::the().allocate<EventCounts>();
-}
-
-// https://w3c.github.io/event-timing/#sec-modifications-HTML
-EventCounts::EventCounts()
-{
- // Upon construction of a Performance object whose relevant global object is a Window, its eventCounts must be
- // initialized to a map containing 0s for all event types that the user agent supports from the list described in
- // Events exposed.
- for_each_event_type_considered_for_event_timing([&](Utf16FlyString const& type) {
- m_entries.set(type, 0);
- });
-}
-
-EventCounts::~EventCounts() = default;
-
-void EventCounts::increment(Utf16FlyString const& type)
-{
- auto it = m_entries.find(type);
- VERIFY(it != m_entries.end());
- ++it->value;
-}
-
-}
diff --git a/Libraries/LibWeb/EventTiming/EventCounts.h b/Libraries/LibWeb/EventTiming/EventCounts.h
deleted file mode 100644
index 3d0bc648735..00000000000
--- a/Libraries/LibWeb/EventTiming/EventCounts.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/HashMap.h>
-#include <AK/Utf16FlyString.h>
-#include <LibWeb/Bindings/Wrappable.h>
-#include <LibWeb/Export.h>
-#include <LibWeb/Forward.h>
-
-namespace Web::EventTiming {
-
-// https://w3c.github.io/event-timing/#sec-event-counts
-class WEB_API EventCounts final : public Bindings::GCAllocatedWrappable {
- WEB_WRAPPABLE(EventCounts, Bindings::GCAllocatedWrappable);
- GC_DECLARE_ALLOCATOR(EventCounts);
-
-public:
- static GC::Ref<EventCounts> create();
-
- virtual ~EventCounts() override;
-
- OrderedHashMap<Utf16FlyString, u64> const& entries() const { return m_entries; }
-
- void increment(Utf16FlyString const& type);
-
-private:
- EventCounts();
-
- OrderedHashMap<Utf16FlyString, u64> m_entries;
-};
-
-}
diff --git a/Libraries/LibWeb/EventTiming/EventCounts.idl b/Libraries/LibWeb/EventTiming/EventCounts.idl
index b6265180858..3bc491d95a8 100644
--- a/Libraries/LibWeb/EventTiming/EventCounts.idl
+++ b/Libraries/LibWeb/EventTiming/EventCounts.idl
@@ -1,5 +1,5 @@
// https://w3c.github.io/event-timing/#sec-event-counts
-[Exposed=Window]
+[Exposed=Window, ImplementedIn=Rust]
interface EventCounts {
readonly maplike<DOMString, unsigned long long>;
};
diff --git a/Libraries/LibWeb/EventTiming/EventTiming.cpp b/Libraries/LibWeb/EventTiming/EventTiming.cpp
index 8d2febc93cf..0bdce839de0 100644
--- a/Libraries/LibWeb/EventTiming/EventTiming.cpp
+++ b/Libraries/LibWeb/EventTiming/EventTiming.cpp
@@ -8,10 +8,11 @@
#include <AK/NeverDestroyed.h>
#include <AK/Random.h>
#include <AK/Utf16StringBuilder.h>
+#include <LibJS/HostClassBuilder.h>
+#include <LibJS/Runtime/VM.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
#include <LibWeb/DOM/Event.h>
-#include <LibWeb/EventTiming/EventCounts.h>
#include <LibWeb/EventTiming/EventTiming.h>
#include <LibWeb/EventTiming/PerformanceEventTiming.h>
#include <LibWeb/HTML/AttributeNames.h>
@@ -30,7 +31,9 @@
namespace Web::EventTiming {
extern "C" {
-EventCounts* web_event_timing_event_counts(HTML::Window*);
+void web_rust_event_timing_increment_event_count(JSVM*, HTML::Window*, FlatPtr event_type);
+
+void web_event_timing_for_each_event_type_considered_for_event_timing(void* context, void (*callback)(void* context, FlatPtr event_type));
u64 web_event_timing_interaction_count(HTML::Window*);
}
@@ -47,31 +50,17 @@ void WindowEventTimingState::visit_edges(GC::Cell::Visitor& visitor)
visitor.visit(it.value);
for (auto& it : pending_pointer_downs)
visitor.visit(it.value);
- visitor.visit(event_counts);
-}
-
-GC::Ref<EventCounts> event_counts(HTML::Window& window)
-{
- auto& event_counts = window.event_timing_state().event_counts;
- if (!event_counts)
- event_counts = EventCounts::create();
- return *event_counts;
}
extern "C" {
-EventCounts* web_event_timing_event_counts(HTML::Window* window)
-{
- return event_counts(*window).ptr();
-}
-
u64 web_event_timing_interaction_count(HTML::Window* window)
{
return window->event_timing_state().interaction_count;
}
}
-void for_each_event_type_considered_for_event_timing(Function<void(Utf16FlyString const&)> const& callback)
+static void for_each_event_type_considered_for_event_timing(Function<void(Utf16FlyString const&)> const& callback)
{
// MouseEvents
callback(UIEvents::EventNames::auxclick);
@@ -127,6 +116,16 @@ void for_each_event_type_considered_for_event_timing(Function<void(Utf16FlyStrin
callback(HTML::EventNames::drop);
}
+extern "C" {
+
+void web_event_timing_for_each_event_type_considered_for_event_timing(void* context, void (*callback)(void* context, FlatPtr event_type))
+{
+ for_each_event_type_considered_for_event_timing([&](Utf16FlyString const& event_type) {
+ callback(context, event_type.raw_identity());
+ });
+}
+}
+
HTML::Window* relevant_window_of_event_target(DOM::EventTarget& target)
{
if (auto* window = as_if<HTML::Window>(target))
@@ -543,7 +542,7 @@ static void set_event_timing_entry_duration(PerformanceEventTiming& timing_entry
// 1. Let eventCounts be window's eventCounts.
// 2. Assert that eventCounts contains name.
// 3. Set eventCounts[name] to eventCounts[name] + 1.
- event_counts(window)->increment(name);
+ web_rust_event_timing_increment_event_count(JS::HostABI::vm_to_abi(JS::VM::the()), &window, name.raw_identity());
// 6. If window's has dispatched input event is false, and timingEntry's interactionId is not 0, run the following
// steps:
diff --git a/Libraries/LibWeb/EventTiming/EventTiming.h b/Libraries/LibWeb/EventTiming/EventTiming.h
index 92ae339c11d..06eb16cd28d 100644
--- a/Libraries/LibWeb/EventTiming/EventTiming.h
+++ b/Libraries/LibWeb/EventTiming/EventTiming.h
@@ -6,7 +6,6 @@
#pragma once
-#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/Vector.h>
#include <LibGC/Ptr.h>
@@ -40,10 +39,6 @@ struct WindowEventTimingState {
// is contextmenu triggered, a boolean which is initially set to false.
bool is_contextmenu_triggered { false };
- // eventCounts, a map with entries of the form type → numEvents.
- // NB: This is created when it is first asked for.
- GC::Ptr<EventCounts> event_counts;
-
// interactionCount, an integer which counts the total number of distinct user interactions, for which there was a
// unique interactionId computed via computing interactionId.
u64 interaction_count { 0 };
@@ -57,14 +52,9 @@ struct WindowEventTimingState {
// of events that are timed.
HTML::Window* relevant_window_of_event_target(DOM::EventTarget&);
-GC::Ref<EventCounts> event_counts(HTML::Window&);
-
// https://w3c.github.io/event-timing/#considered-for-event-timing
bool is_considered_for_event_timing(DOM::Event const&);
-// Calls the given callback with every event type that is considered for Event Timing.
-void for_each_event_type_considered_for_event_timing(Function<void(Utf16FlyString const&)> const&);
-
// https://w3c.github.io/event-timing/#compute-interactionid
WebIDL::UnsignedLongLong compute_interaction_id(DOM::Event const&, HTML::Window&);
diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h
index 0dab9f004d2..98b587069e9 100644
--- a/Libraries/LibWeb/Forward.h
+++ b/Libraries/LibWeb/Forward.h
@@ -566,7 +566,6 @@ class FileSystemEntry;
namespace Web::EventTiming {
-class EventCounts;
class PerformanceEventTiming;
struct WindowEventTimingState;
diff --git a/Meta/Generators/libweb_bindings/glue_headers.py b/Meta/Generators/libweb_bindings/glue_headers.py
index e7a970e6250..f3a207ea666 100644
--- a/Meta/Generators/libweb_bindings/glue_headers.py
+++ b/Meta/Generators/libweb_bindings/glue_headers.py
@@ -15,7 +15,6 @@ def bindings_glue_header_for_interface(interface: Interface, wrapper_interface_n
"Animations": "LibWeb/Animations/BindingsGlue.h",
"CSS": "LibWeb/CSS/BindingsGlue.h",
"CookieStore": "LibWeb/CookieStore/BindingsGlue.h",
- "EventTiming": "LibWeb/EventTiming/BindingsGlue.h",
"IndexedDB": "LibWeb/IndexedDB/BindingsGlue.h",
"TrustedTypes": "LibWeb/TrustedTypes/BindingsGlue.h",
"WebRTC": "LibWeb/WebRTC/BindingsGlue.h",