script: Minimize layout queries for window scroll offsets. (#38018)

These changes reduce the number of times we need to query layout for the
same information when creating mouse/pointer events.

Testing: No new tests required for maintaining existing behaviour.

Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
Josh Matthews 2025-07-12 10:17:55 -04:00 committed by GitHub
parent 6dbd64e72d
commit d0a93a8b02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 32 additions and 21 deletions

View file

@ -95,6 +95,7 @@ impl WheelEvent {
delta_y,
delta_z,
delta_mode,
can_gc,
);
ev
@ -160,6 +161,7 @@ impl WheelEventMethods<crate::DomTypeHolder> for WheelEvent {
delta_y_arg: Finite<f64>,
delta_z_arg: Finite<f64>,
delta_mode_arg: u32,
can_gc: CanGc,
) {
if self.upcast::<Event>().dispatching() {
return;
@ -181,6 +183,7 @@ impl WheelEventMethods<crate::DomTypeHolder> for WheelEvent {
self.mouseevent.MetaKey(),
self.mouseevent.Button(),
self.mouseevent.GetRelatedTarget().as_deref(),
can_gc,
);
self.delta_x.set(delta_x_arg);
self.delta_y.set(delta_y_arg);