From 770b3480910d255e4bbd78949c30c8324c57ae94 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Sat, 30 Sep 2017 15:50:47 +0200 Subject: Use WebRender to compute text index on click events This is the second half of switching over to WebRender for hit testing. Now that WebRender gives us the location of the hit tested point in the display item, we can use that to calculate text index. --- components/script/script_thread.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'components/script/script_thread.rs') diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 1413a0c40dc..8f6871f8e56 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -2187,8 +2187,15 @@ impl ScriptThread { self.handle_resize_event(pipeline_id, new_size, size_type); } - MouseButtonEvent(event_type, button, point, node_address) => { - self.handle_mouse_event(pipeline_id, event_type, button, point, node_address); + MouseButtonEvent(event_type, button, point, node_address, point_in_node) => { + self.handle_mouse_event( + pipeline_id, + event_type, + button, + point, + node_address, + point_in_node + ); } MouseMoveEvent(point, node_address) => { @@ -2299,7 +2306,8 @@ impl ScriptThread { mouse_event_type: MouseEventType, button: MouseButton, point: Point2D, - node_address: Option + node_address: Option, + point_in_node: Option> ) { let document = match { self.documents.borrow().find_document(pipeline_id) } { Some(document) => document, @@ -2310,7 +2318,8 @@ impl ScriptThread { button, point, mouse_event_type, - node_address + node_address, + point_in_node ); } -- cgit v1.2.3