servoshell: Rename Minibrowser::is_in_browser_rect to Minibrowser::is_in_egui_toolbar_rect (#35717)

"browser rect" is a bit of a misnomer as the browser is the entire
window, but this function is trying to determine if a point is on the
non-WebView toolbar portion of the GUI.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-03-03 12:19:50 +01:00 committed by GitHub
parent 649291bf69
commit 6300e820b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -132,7 +132,7 @@ impl Minibrowser {
self.last_mouse_position = self.last_mouse_position =
Some(winit_position_to_euclid_point(*position).to_f32() / scale); Some(winit_position_to_euclid_point(*position).to_f32() / scale);
self.last_mouse_position self.last_mouse_position
.is_some_and(|p| self.is_in_browser_rect(p)) .is_some_and(|p| self.is_in_egui_toolbar_rect(p))
}, },
WindowEvent::MouseInput { WindowEvent::MouseInput {
state: ElementState::Pressed, state: ElementState::Pressed,
@ -154,14 +154,14 @@ impl Minibrowser {
}, },
WindowEvent::MouseWheel { .. } | WindowEvent::MouseInput { .. } => self WindowEvent::MouseWheel { .. } | WindowEvent::MouseInput { .. } => self
.last_mouse_position .last_mouse_position
.is_some_and(|p| self.is_in_browser_rect(p)), .is_some_and(|p| self.is_in_egui_toolbar_rect(p)),
_ => true, _ => true,
}; };
result result
} }
/// Return true iff the given position is in the Servo browser rect. /// Return true iff the given position is over the egui toolbar.
fn is_in_browser_rect(&self, position: Point2D<f32, DeviceIndependentPixel>) -> bool { fn is_in_egui_toolbar_rect(&self, position: Point2D<f32, DeviceIndependentPixel>) -> bool {
position.y < self.toolbar_height.get() position.y < self.toolbar_height.get()
} }