diff --git a/sky/packages/sky/lib/rendering/box.dart b/sky/packages/sky/lib/rendering/box.dart index b9f729b3db9..c1068927461 100644 --- a/sky/packages/sky/lib/rendering/box.dart +++ b/sky/packages/sky/lib/rendering/box.dart @@ -414,9 +414,13 @@ abstract class RenderBox extends RenderObject { } bool hitTest(HitTestResult result, { Point position }) { - hitTestChildren(result, position: position); - result.add(new BoxHitTestEntry(this, position)); - return true; + if (position.x >= 0.0 && position.x < _size.width && + position.y >= 0.0 && position.y < _size.height) { + hitTestChildren(result, position: position); + result.add(new BoxHitTestEntry(this, position)); + return true; + } + return false; } void hitTestChildren(HitTestResult result, { Point position }) { } @@ -1008,11 +1012,8 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi void hitTestChildren(HitTestResult result, { Point position }) { if (child != null) { assert(child.parentData is BoxParentData); - Rect childBounds = child.parentData.position & child.size; - if (childBounds.contains(position)) { - child.hitTest(result, position: new Point(position.x - child.parentData.position.x, - position.y - child.parentData.position.y)); - } + child.hitTest(result, position: new Point(position.x - child.parentData.position.x, + position.y - child.parentData.position.y)); } } @@ -1319,10 +1320,8 @@ class RenderViewport extends RenderBox with RenderObjectWithChildMixin