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

Unified Diff: Source/core/layout/line/LineBoxList.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/LineBoxList.cpp
diff --git a/Source/core/layout/line/LineBoxList.cpp b/Source/core/layout/line/LineBoxList.cpp
index 4f391d5a96c5bec31fc48c130183cf14b4e0896a..e293a2d9d7890e1eccff47dcad2abebd975c2b47 100644
--- a/Source/core/layout/line/LineBoxList.cpp
+++ b/Source/core/layout/line/LineBoxList.cpp
@@ -209,8 +209,17 @@ bool LineBoxList::hitTest(LayoutBoxModelObject* layoutObject, HitTestResult& res
IntRect(point.x(), point.y() - locationInContainer.topPadding(), 1, locationInContainer.topPadding() + locationInContainer.bottomPadding() + 1) :
IntRect(point.x() - locationInContainer.leftPadding(), point.y(), locationInContainer.rightPadding() + locationInContainer.leftPadding() + 1, 1));
- if (!anyLineIntersectsRect(layoutObject, rect, accumulatedOffset))
+ if (!anyLineIntersectsRect(layoutObject, rect, accumulatedOffset)) {
+ InlineFlowBox* first = firstLineBox();
+ RootInlineBox& firstRoot = first->root();
+ InlineFlowBox* last = lastLineBox();
+ RootInlineBox& lastRoot = last->root();
+
+ result.shrinkValidityRect(first->visualOverflowRect(firstRoot.lineTop(), firstRoot.lineBottom()));
+ if (first != last)
+ result.shrinkValidityRect(last->visualOverflowRect(lastRoot.lineTop(), lastRoot.lineBottom()));
return false;
+ }
// See if our root lines contain the point. If so, then we hit test
// them further. Note that boxes can easily overlap, so we can't make any assumptions
@@ -220,9 +229,11 @@ bool LineBoxList::hitTest(LayoutBoxModelObject* layoutObject, HitTestResult& res
if (rangeIntersectsRect(layoutObject, curr->logicalTopVisualOverflow(root.lineTop()), curr->logicalBottomVisualOverflow(root.lineBottom()), rect, accumulatedOffset)) {
bool inside = curr->nodeAtPoint(result, locationInContainer, accumulatedOffset, root.lineTop(), root.lineBottom());
if (inside) {
- layoutObject->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset));
+ layoutObject->updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset), curr->visualOverflowRect(root.lineTop(), root.lineBottom()));
return true;
}
+ } else {
+ result.shrinkValidityRect(curr->visualOverflowRect(root.lineTop(), root.lineBottom()));
}
}

Powered by Google App Engine
This is Rietveld 408576698