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

Unified Diff: Source/core/layout/LayoutBox.cpp

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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
Index: Source/core/layout/LayoutBox.cpp
diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp
index 3fe7409b4b57cf3135ad63f77991de306704d548..f5e8ffba67f4a84f2db842693c7adbf9933bfd57 100644
--- a/Source/core/layout/LayoutBox.cpp
+++ b/Source/core/layout/LayoutBox.cpp
@@ -1129,23 +1129,24 @@ bool LayoutBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locati
{
LayoutPoint adjustedLocation = accumulatedOffset + location();
+ LayoutRect boundsRect = borderBoxRect();
+ boundsRect.moveBy(adjustedLocation);
// Check kids first.
for (LayoutObject* child = slowLastChild(); child; child = child->previousSibling()) {
if ((!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSelfPaintingLayer()) && child->nodeAtPoint(result, locationInContainer, adjustedLocation, action)) {
- updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
+ updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation), boundsRect);
return true;
}
}
// Check our bounds next. For this purpose always assume that we can only be hit in the
// foreground phase (which is true for replaced elements like images).
- LayoutRect boundsRect = borderBoxRect();
- boundsRect.moveBy(adjustedLocation);
if (visibleToHitTestRequest(result.hitTestRequest()) && action == HitTestForeground && locationInContainer.intersects(boundsRect)) {
- updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation));
+ updateHitTestResult(result, locationInContainer.point() - toLayoutSize(adjustedLocation), boundsRect);
if (!result.addNodeToListBasedTestResult(node(), locationInContainer, boundsRect))
return true;
}
+ result.shrinkValidityRect(boundsRect);
return false;
}

Powered by Google App Engine
This is Rietveld 408576698