diff options
author | Martin Robinson <mrobinson@igalia.com> | 2017-09-30 15:50:47 +0200 |
---|---|---|
committer | Martin Robinson <mrobinson@igalia.com> | 2017-10-18 09:15:55 +0200 |
commit | 770b3480910d255e4bbd78949c30c8324c57ae94 (patch) | |
tree | 45f06cd50a98c25fe9df2672b786f35919bff03d /components/layout_thread | |
parent | ca08271345f78fa881c174545f5b69a8ccb78143 (diff) | |
download | servo-770b3480910d255e4bbd78949c30c8324c57ae94.tar.gz servo-770b3480910d255e4bbd78949c30c8324c57ae94.zip |
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.
Diffstat (limited to 'components/layout_thread')
-rw-r--r-- | components/layout_thread/lib.rs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index ab3e620c16e..5672715834c 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -1358,18 +1358,19 @@ impl LayoutThread { let node = unsafe { ServoLayoutNode::new(&node) }; rw_data.content_boxes_response = process_content_boxes_request(node, root_flow); }, - ReflowGoal::TextIndexQuery(node, mouse_x, mouse_y) => { + ReflowGoal::TextIndexQuery(node, point_in_node) => { let node = unsafe { ServoLayoutNode::new(&node) }; let opaque_node = node.opaque(); - let client_point = Point2D::new(Au::from_px(mouse_x), - Au::from_px(mouse_y)); - rw_data.text_index_response = - TextIndexResponse(rw_data.display_list - .as_ref() - .expect("Tried to hit test with no display list") - .text_index(opaque_node, - &client_point, - &rw_data.scroll_offsets)); + let point_in_node = Point2D::new( + Au::from_f32_px(point_in_node.x), + Au::from_f32_px(point_in_node.y) + ); + rw_data.text_index_response = TextIndexResponse( + rw_data.display_list + .as_ref() + .expect("Tried to hit test with no display list") + .text_index(opaque_node, &point_in_node) + ); }, ReflowGoal::NodeGeometryQuery(node) => { let node = unsafe { ServoLayoutNode::new(&node) }; |