mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Remove unnecessary layers of casting from embedding event API.
This commit is contained in:
parent
256011a652
commit
981f7414ec
3 changed files with 19 additions and 19 deletions
|
@ -277,12 +277,12 @@ impl ServoGlue {
|
|||
/// Start scrolling.
|
||||
/// x/y are scroll coordinates.
|
||||
/// dx/dy are scroll deltas.
|
||||
pub fn scroll_start(&mut self, dx: i32, dy: i32, x: u32, y: u32) -> Result<(), &'static str> {
|
||||
let delta = TypedVector2D::new(dx as f32, dy as f32);
|
||||
pub fn scroll_start(&mut self, dx: f32, dy: f32, x: i32, y: i32) -> Result<(), &'static str> {
|
||||
let delta = TypedVector2D::new(dx, dy);
|
||||
let scroll_location = webrender_api::ScrollLocation::Delta(delta);
|
||||
let event = WindowEvent::Scroll(
|
||||
scroll_location,
|
||||
TypedPoint2D::new(x as i32, y as i32),
|
||||
TypedPoint2D::new(x, y),
|
||||
TouchEventType::Down,
|
||||
);
|
||||
self.process_event(event)
|
||||
|
@ -291,12 +291,12 @@ impl ServoGlue {
|
|||
/// Scroll.
|
||||
/// x/y are scroll coordinates.
|
||||
/// dx/dy are scroll deltas.
|
||||
pub fn scroll(&mut self, dx: i32, dy: i32, x: u32, y: u32) -> Result<(), &'static str> {
|
||||
let delta = TypedVector2D::new(dx as f32, dy as f32);
|
||||
pub fn scroll(&mut self, dx: f32, dy: f32, x: i32, y: i32) -> Result<(), &'static str> {
|
||||
let delta = TypedVector2D::new(dx, dy);
|
||||
let scroll_location = webrender_api::ScrollLocation::Delta(delta);
|
||||
let event = WindowEvent::Scroll(
|
||||
scroll_location,
|
||||
TypedPoint2D::new(x as i32, y as i32),
|
||||
TypedPoint2D::new(x, y),
|
||||
TouchEventType::Move,
|
||||
);
|
||||
self.process_event(event)
|
||||
|
@ -305,12 +305,12 @@ impl ServoGlue {
|
|||
/// End scrolling.
|
||||
/// x/y are scroll coordinates.
|
||||
/// dx/dy are scroll deltas.
|
||||
pub fn scroll_end(&mut self, dx: i32, dy: i32, x: u32, y: u32) -> Result<(), &'static str> {
|
||||
let delta = TypedVector2D::new(dx as f32, dy as f32);
|
||||
pub fn scroll_end(&mut self, dx: f32, dy: f32, x: i32, y: i32) -> Result<(), &'static str> {
|
||||
let delta = TypedVector2D::new(dx, dy);
|
||||
let scroll_location = webrender_api::ScrollLocation::Delta(delta);
|
||||
let event = WindowEvent::Scroll(
|
||||
scroll_location,
|
||||
TypedPoint2D::new(x as i32, y as i32),
|
||||
TypedPoint2D::new(x, y),
|
||||
TouchEventType::Up,
|
||||
);
|
||||
self.process_event(event)
|
||||
|
@ -375,9 +375,9 @@ impl ServoGlue {
|
|||
}
|
||||
|
||||
/// Perform a click.
|
||||
pub fn click(&mut self, x: u32, y: u32) -> Result<(), &'static str> {
|
||||
pub fn click(&mut self, x: f32, y: f32) -> Result<(), &'static str> {
|
||||
let mouse_event =
|
||||
MouseWindowEvent::Click(MouseButton::Left, TypedPoint2D::new(x as f32, y as f32));
|
||||
MouseWindowEvent::Click(MouseButton::Left, TypedPoint2D::new(x, y));
|
||||
let event = WindowEvent::MouseWindowEventClass(mouse_event);
|
||||
self.process_event(event)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue