Chromium Code Reviews| Index: Source/core/dom/TreeScope.cpp |
| diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp |
| index 801eafbc6ec8c056517e19f50aa3d1c0749c8d40..417d72a317422995b58abcaf1cf4933a3f6cc91d 100644 |
| --- a/Source/core/dom/TreeScope.cpp |
| +++ b/Source/core/dom/TreeScope.cpp |
| @@ -262,13 +262,13 @@ 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, bool useCache) |
| { |
| IntPoint hitPoint(x, y); |
| if (!pointWithScrollAndZoomIfPossible(*document, hitPoint)) |
| return HitTestResult(); |
| - HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active); |
| + HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | (useCache ? 0 : HitTestRequest::AvoidCache)); |
| HitTestResult result(request, hitPoint); |
| document->layoutView()->hitTest(result); |
| return result; |
| @@ -276,7 +276,17 @@ HitTestResult hitTestInDocument(const Document* document, int x, int y) |
| Element* TreeScope::elementFromPoint(int x, int y) const |
|
esprehn
2015/06/06 21:14:29
elementFromPoint(int x, int y, HitTestCacheType =
dtapuska
2015/06/09 18:21:23
I'm just going to allow the HitTestRequest to be p
|
| { |
| - HitTestResult result = hitTestInDocument(&rootNode().document(), x, y); |
| + return hitTestPoint(x, y, true); |
| +} |
| + |
| +Element* TreeScope::elementFromPointNoCache(int x, int y) const |
|
esprehn
2015/06/06 21:14:29
Use default args instead, no need for two methods.
dtapuska
2015/06/09 18:21:23
Done.
|
| +{ |
| + return hitTestPoint(x, y, false); |
| +} |
| + |
| +Element* TreeScope::hitTestPoint(int x, int y, bool useCache) const |
| +{ |
| + HitTestResult result = hitTestInDocument(&rootNode().document(), x, y, useCache); |
| Node* node = result.innerNode(); |
| if (!node || node->isDocumentNode()) |
| return 0; |