servoshell: Do not send mouse button events to Servo that happen outside the WebView (#38696)

`webview_relative_mouse_point` can have negative y-coordinate when at
toolbar, but we still would notify compositor the native mousebutton
event to do hit-test.

Testing: This fixes the way that mouse events are passed from servoshell
to Servo,
but there is currently no way to test those kind of interactions.

Signed-off-by: Euclid Ye <euclid.ye@huawei.com>
This commit is contained in:
Euclid Ye 2025-08-15 16:55:25 +08:00 committed by GitHub
parent 02dca0fb21
commit aca4bde93d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -287,6 +287,10 @@ impl Window {
};
let point = self.webview_relative_mouse_point.get();
// `point` can be outside viewport, such as at toolbar with negative y-coordinate.
if !webview.rect().contains(point) {
return;
}
let action = match action {
ElementState::Pressed => MouseButtonAction::Down,
ElementState::Released => MouseButtonAction::Up,