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

Unified Diff: Source/core/layout/line/InlineFlowBox.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/line/InlineFlowBox.cpp
diff --git a/Source/core/layout/line/InlineFlowBox.cpp b/Source/core/layout/line/InlineFlowBox.cpp
index f81ae36630fef868145a7073fa9c1be0f8911085..0ecf2ea9f78baca86e67855bdc86d1c6b8079aea 100644
--- a/Source/core/layout/line/InlineFlowBox.cpp
+++ b/Source/core/layout/line/InlineFlowBox.cpp
@@ -975,8 +975,10 @@ bool InlineFlowBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo
LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
flipForWritingMode(overflowRect);
overflowRect.moveBy(accumulatedOffset);
- if (!locationInContainer.intersects(overflowRect))
+ if (!locationInContainer.intersects(overflowRect)) {
+ result.shrinkValidityRect(overflowRect);
return false;
+ }
// We need to hit test both our inline children (InlineBoxes) and culled inlines
// (LayoutObjects). We check our inlines in the same order as line layout but
@@ -992,7 +994,8 @@ bool InlineFlowBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo
continue;
if (curr->nodeAtPoint(result, locationInContainer, accumulatedOffset, lineTop, lineBottom)) {
- layoutObject().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
+ // TODO(dtapuska): Calculate pos based on lineTop/lineBottom
+ layoutObject().updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset), result.validityRect());
return true;
}
@@ -1019,8 +1022,10 @@ bool InlineFlowBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo
LayoutRect borderRect = logicalFrameRect();
borderRect.moveBy(accumulatedOffset);
FloatRoundedRect border = layoutObject().style()->getRoundedBorderFor(borderRect, includeLogicalLeftEdge(), includeLogicalRightEdge());
- if (!locationInContainer.intersects(border))
+ if (!locationInContainer.intersects(border)) {
+ result.shrinkValidityRect(borderRect);
return false;
+ }
}
// Now check ourselves. Pixel snap hit testing.
@@ -1047,10 +1052,11 @@ bool InlineFlowBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& lo
rect.moveBy(accumulatedOffset);
if (visibleToHitTestRequest(result.hitTestRequest()) && locationInContainer.intersects(rect)) {
- layoutObject().updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset))); // Don't add in m_x or m_y here, we want coords in the containing block's space.
+ layoutObject().updateHitTestResult(result, flipForWritingMode(locationInContainer.point() - toLayoutSize(accumulatedOffset)), rect); // Don't add in m_x or m_y here, we want coords in the containing block's space.
if (!result.addNodeToListBasedTestResult(layoutObject().node(), locationInContainer, rect))
return true;
}
+ result.shrinkValidityRect(rect);
return false;
}

Powered by Google App Engine
This is Rietveld 408576698