aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout_thread
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-19 02:36:32 -0500
committerGitHub <noreply@github.com>2017-10-19 02:36:32 -0500
commit4cf2ce66fc4f970a47ab1fb4b9aa1a55282640f7 (patch)
tree5a2b8abbb10747ede96a7d7f234569bf9c9fec8c /components/layout_thread
parent77a47171563fdb3a38dd75f8c58909c9647cb708 (diff)
parent2e2ed444d597904ed0b6d7f4eade2747d75021a6 (diff)
downloadservo-4cf2ce66fc4f970a47ab1fb4b9aa1a55282640f7.tar.gz
servo-4cf2ce66fc4f970a47ab1fb4b9aa1a55282640f7.zip
Auto merge of #18933 - mrobinson:wr-text-index, r=jdm
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. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because they shouldn't change behavior. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18933) <!-- Reviewable:end -->
Diffstat (limited to 'components/layout_thread')
-rw-r--r--components/layout_thread/lib.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs
index 0010d66673c..e7ce75db5c1 100644
--- a/components/layout_thread/lib.rs
+++ b/components/layout_thread/lib.rs
@@ -1361,18 +1361,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) };