servo: Merge #12813 - dom: getElementsFromPoint does the hit testing on viewport coordinates (from emilio:hit-test); r=notriddle

<!-- 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

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

We got this wrong (I think it wasn't my fault actually), I was just writing a test for #12777 when I found this.

Source-Repo: https://github.com/servo/servo
Source-Revision: 4cefbcc94927a1c7cf12b188c4abbd63d7636e3d
This commit is contained in:
Emilio Cobos Álvarez 2016-08-11 05:34:27 -05:00
Родитель cf9ad6bd7a
Коммит 09bdc2cd2d
2 изменённых файлов: 8 добавлений и 6 удалений

Просмотреть файл

@ -148,7 +148,9 @@ impl LayoutRPC for LayoutRPCImpl {
let result = match rw_data.display_list {
None => panic!("Tried to hit test without a DisplayList"),
Some(ref display_list) => {
display_list.hit_test(&page_point, &client_point, &rw_data.stacking_context_scroll_offsets)
display_list.hit_test(&page_point,
&client_point,
&rw_data.stacking_context_scroll_offsets)
}
};

Просмотреть файл

@ -1583,12 +1583,12 @@ impl Document {
self.browsing_context.is_none() || !url_has_network_scheme(&self.url)
}
pub fn nodes_from_point(&self, page_point: &Point2D<f32>) -> Vec<UntrustedNodeAddress> {
let client_point =
Point2D::new(page_point.x - self.window.PageXOffset() as f32,
page_point.y - self.window.PageYOffset() as f32);
pub fn nodes_from_point(&self, client_point: &Point2D<f32>) -> Vec<UntrustedNodeAddress> {
let page_point =
Point2D::new(client_point.x + self.window.PageXOffset() as f32,
client_point.y + self.window.PageYOffset() as f32);
self.window.layout().nodes_from_point(*page_point, client_point)
self.window.layout().nodes_from_point(page_point, *client_point)
}
}