| Index: Source/core/paint/DeprecatedPaintLayer.cpp
|
| diff --git a/Source/core/paint/DeprecatedPaintLayer.cpp b/Source/core/paint/DeprecatedPaintLayer.cpp
|
| index 7454af273849d6d75013614daf064295c93e6c56..81f29ebe4fcb059286468123362ea893c1637fc0 100644
|
| --- a/Source/core/paint/DeprecatedPaintLayer.cpp
|
| +++ b/Source/core/paint/DeprecatedPaintLayer.cpp
|
| @@ -1635,6 +1635,57 @@
|
| }
|
| }
|
|
|
| +static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject)
|
| +{
|
| + FrameView* frameView = layoutObject->document().view();
|
| + if (!frameView)
|
| + return LayoutRect();
|
| +
|
| + return LayoutRect(frameView->visibleContentRect());
|
| +}
|
| +
|
| +bool DeprecatedPaintLayer::hitTest(HitTestResult& result)
|
| +{
|
| + return hitTest(result.hitTestRequest(), result.hitTestLocation(), result);
|
| +}
|
| +
|
| +bool DeprecatedPaintLayer::hitTest(const HitTestRequest& request, const HitTestLocation& hitTestLocation, HitTestResult& result)
|
| +{
|
| + ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
|
| +
|
| + // LayoutView should make sure to update layout before entering hit testing
|
| + ASSERT(!layoutObject()->frame()->view()->layoutPending());
|
| + ASSERT(!layoutObject()->document().layoutView()->needsLayout());
|
| +
|
| + // Start with frameVisibleRect to ensure we include the scrollbars.
|
| + LayoutRect hitTestArea = frameVisibleRect(layoutObject());
|
| + if (request.ignoreClipping())
|
| + 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.
|
| + LayoutPoint hitPoint = hitTestLocation.point();
|
| + if (!request.isChildFrameHitTest() && ((request.active() || request.release()) || (request.move() && hitTestArea.contains(hitPoint.x(), hitPoint.y()))) && isRootLayer()) {
|
| + layoutObject()->updateHitTestResult(result, toLayoutView(layoutObject())->flipForWritingMode(hitTestLocation.point()));
|
| + insideLayer = this;
|
| + }
|
| + }
|
| +
|
| + // Now determine if the result is inside an anchor - if the urlElement isn't already set.
|
| + Node* node = result.innerNode();
|
| + if (node && !result.URLElement())
|
| + result.setURLElement(node->enclosingLinkEventParentOrSelf());
|
| +
|
| + // Now return whether we were inside this layer (this will always be true for the root
|
| + // layer).
|
| + return insideLayer;
|
| +}
|
| +
|
| Node* DeprecatedPaintLayer::enclosingElement() const
|
| {
|
| for (LayoutObject* r = layoutObject(); r; r = r->parent()) {
|
|
|