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

Unified Diff: Source/core/dom/TreeScope.cpp

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix comments from tdresser 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
Index: Source/core/dom/TreeScope.cpp
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp
index 801eafbc6ec8c056517e19f50aa3d1c0749c8d40..35d408e33d25bdb5f4bcf7cc3f55dead78537750 100644
--- a/Source/core/dom/TreeScope.cpp
+++ b/Source/core/dom/TreeScope.cpp
@@ -262,13 +262,12 @@ static bool pointWithScrollAndZoomIfPossible(const Document& document, IntPoint&
return true;
}
-HitTestResult hitTestInDocument(const Document* document, int x, int y)
+HitTestResult hitTestInDocument(const Document* document, int x, int y, const HitTestRequest& request)
{
IntPoint hitPoint(x, y);
if (!pointWithScrollAndZoomIfPossible(*document, hitPoint))
return HitTestResult();
- HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
HitTestResult result(request, hitPoint);
document->layoutView()->hitTest(result);
return result;
@@ -276,7 +275,17 @@ HitTestResult hitTestInDocument(const Document* document, int x, int y)
Element* TreeScope::elementFromPoint(int x, int y) const
{
- HitTestResult result = hitTestInDocument(&rootNode().document(), x, y);
+ return hitTestPoint(x, y, HitTestRequest::ReadOnly | HitTestRequest::Active);
+}
+
+Element* TreeScope::elementFromPointNoCache(int x, int y) const
+{
+ return hitTestPoint(x, y, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AvoidCache);
+}
+
+Element* TreeScope::hitTestPoint(int x, int y, const HitTestRequest& request) const
+{
+ HitTestResult result = hitTestInDocument(&rootNode().document(), x, y, request);
Node* node = result.innerNode();
if (!node || node->isDocumentNode())
return 0;

Powered by Google App Engine
This is Rietveld 408576698