Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1175623002: Revert of Moving HitTest function to DeprecatedPaintLayerStackingNode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerStackingNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()) {
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerStackingNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698