mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
dom: getElementsFromPoint does the hit testing on viewport coordinates.
We got this wrong, I was just writing a test for #12777 when I found this.
This commit is contained in:
parent
3c7de6b821
commit
f9c0f2df13
4 changed files with 56 additions and 6 deletions
|
@ -147,7 +147,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)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue