Index: Source/core/paint/DeprecatedPaintLayer.cpp |
diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp |
index 83f026517b2d4eb8cec6a02dd67551f9d86ada16..9bede69bf71f7506c896dbfe0f19df9889933495 100644 |
--- a/Source/core/paint/DeprecatedPaintLayer.cpp |
+++ b/Source/core/paint/DeprecatedPaintLayer.cpp |
@@ -1491,17 +1491,27 @@ bool DeprecatedPaintLayer::hitTest(HitTestResult& result) |
hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect())); |
DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestArea, hitTestLocation, false); |
- if (!insideLayer) { |
- // We didn't hit any layer. If we are the root layer and the mouse is -- or just was -- down, |
- // return ourselves. We do this so mouse events continue getting delivered after a drag has |
- // exited the WebView, and so hit testing over a scrollbar hits the content document. |
- // In addtion, it is possible for the mouse to stay in the document but there is no element. |
- // At that time, the events of the mouse should be fired. |
+ if (!insideLayer && isRootLayer()) { |
// TODO(majidvp): This should apply more consistently across different event types and we |
Rick Byers
2015/08/20 19:28:22
nit: please move this TODO to your second case - i
Yufeng Shen (Slow to review)
2015/08/20 20:28:19
Done.
|
// should not use RequestType for it. Perhaps best for it to be done at a higher level. See |
// http://crbug.com/505825 |
- LayoutPoint hitPoint = hitTestLocation.point(); |
- if (!request.isChildFrameHitTest() && ((request.active() || request.release()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y()))) && isRootLayer()) { |
+ |
+ IntRect hitRect = hitTestLocation.boundingBox(); |
+ bool fallback = false; |
+ // If we didn't hit any layers but are still inside the document |
+ // bounds, then we should fallback to hitting the document. |
+ // For rect-based hit test, we do the fallback only when the hit-rect |
+ // is totally within the document bounds. |
+ if (hitTestArea.contains(LayoutRect(hitRect))) { |
+ fallback = true; |
+ // Mouse dragging outside the main document should also be |
Rick Byers
2015/08/20 19:28:22
nit: add a newline above here to make the separati
Yufeng Shen (Slow to review)
2015/08/20 20:28:19
Done.
|
+ // delivered to the document. |
+ // TODO(miletus): Capture behavior inconsistent with iframes |
+ // crbug.com/522109. |
+ } else if ((request.active() || request.release()) && !request.isChildFrameHitTest()) { |
+ fallback = true; |
+ } |
+ if (fallback) { |
layoutObject()->updateHitTestResult(result, toLayoutView(layoutObject())->flipForWritingMode(hitTestLocation.point())); |
insideLayer = this; |