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.
This commit is contained in:
Martin Robinson 2017-09-30 15:50:47 +02:00
parent ca08271345
commit 770b348091
11 changed files with 191 additions and 276 deletions

View file

@ -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<f32>,
node_address: Option<UntrustedNodeAddress>
node_address: Option<UntrustedNodeAddress>,
point_in_node: Option<Point2D<f32>>
) {
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
);
}