mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
compositing: Translate clip rects into the coordinate systems of child
layers when doing hit tests. Fixes clicking on links on the second page of Hacker News.
This commit is contained in:
parent
e74a57821f
commit
fa1e06e7ce
1 changed files with 9 additions and 4 deletions
|
@ -1125,9 +1125,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
|
|
||||||
let child_point = point - layer_bounds.origin;
|
let child_point = point - layer_bounds.origin;
|
||||||
for child in layer.children().iter().rev() {
|
for child in layer.children().iter().rev() {
|
||||||
|
// Translate the clip rect into the child's coordinate system.
|
||||||
|
let clip_rect_for_child =
|
||||||
|
clip_rect_for_children.translate(&-*child.content_offset.borrow());
|
||||||
let result = self.find_topmost_layer_at_point_for_layer(child.clone(),
|
let result = self.find_topmost_layer_at_point_for_layer(child.clone(),
|
||||||
child_point,
|
child_point,
|
||||||
&clip_rect_for_children);
|
&clip_rect_for_child);
|
||||||
if result.is_some() {
|
if result.is_some() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1145,9 +1148,11 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
point: TypedPoint2D<LayerPixel, f32>)
|
point: TypedPoint2D<LayerPixel, f32>)
|
||||||
-> Option<HitTestResult> {
|
-> Option<HitTestResult> {
|
||||||
match self.scene.root {
|
match self.scene.root {
|
||||||
Some(ref layer) => self.find_topmost_layer_at_point_for_layer(layer.clone(),
|
Some(ref layer) => {
|
||||||
point,
|
self.find_topmost_layer_at_point_for_layer(layer.clone(),
|
||||||
&*layer.bounds.borrow()),
|
point,
|
||||||
|
&*layer.bounds.borrow())
|
||||||
|
}
|
||||||
|
|
||||||
None => None,
|
None => None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue