mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
auto merge of #4357 : pcwalton/servo/compositor-hit-test-clipping, r=mrobinson
Fixes clicking on links on the second page of Hacker News. r? @mrobinson
This commit is contained in:
commit
251dbb37ed
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) => {
|
||||||
|
self.find_topmost_layer_at_point_for_layer(layer.clone(),
|
||||||
point,
|
point,
|
||||||
&*layer.bounds.borrow()),
|
&*layer.bounds.borrow())
|
||||||
|
}
|
||||||
|
|
||||||
None => None,
|
None => None,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue