Implement scroll event (#36687)

Reimplementation of https://github.com/servo/servo/pull/35105.

test: `tests/wpt/tests/pointerevents/{pointerevent_hit_test_scroll,
pointerevent_hit_test_scroll_visible_decendant}.html` (after
https://github.com/servo/servo/pull/37461)

Signed-off-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: PotatoCP <kenzieradityatirtarahardja.18@gmail.com>
Co-authored-by: Asun0204 <asun0204@163.com>
This commit is contained in:
Kenzie Raditya Tirtarahardja 2025-06-18 14:05:45 +08:00 committed by GitHub
parent 152467bc67
commit 96ef92b9ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 88 additions and 20 deletions

View file

@ -6,6 +6,7 @@ use keyboard_types::{CompositionEvent, KeyboardEvent};
use log::error;
use malloc_size_of_derive::MallocSizeOf;
use serde::{Deserialize, Serialize};
use webrender_api::ExternalScrollId;
use webrender_api::units::DevicePoint;
use crate::WebDriverMessageId;
@ -21,6 +22,7 @@ pub enum InputEvent {
MouseMove(MouseMoveEvent),
Touch(TouchEvent),
Wheel(WheelEvent),
Scroll(ScrollEvent),
}
/// An editing action that should be performed on a `WebView`.
@ -42,6 +44,7 @@ impl InputEvent {
InputEvent::MouseMove(event) => Some(event.point),
InputEvent::Touch(event) => Some(event.point),
InputEvent::Wheel(event) => Some(event.point),
InputEvent::Scroll(..) => None,
}
}
@ -55,6 +58,7 @@ impl InputEvent {
InputEvent::MouseMove(event) => event.webdriver_id,
InputEvent::Touch(..) => None,
InputEvent::Wheel(event) => event.webdriver_id,
InputEvent::Scroll(..) => None,
}
}
@ -74,6 +78,7 @@ impl InputEvent {
InputEvent::Wheel(ref mut event) => {
event.webdriver_id = webdriver_id;
},
InputEvent::Scroll(..) => {},
};
self
@ -291,6 +296,11 @@ impl WheelEvent {
}
}
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct ScrollEvent {
pub external_id: ExternalScrollId,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum ImeEvent {
Composition(CompositionEvent),