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

Unified Diff: third_party/WebKit/Source/core/layout/HitTestResult.cpp

Issue 1630793002: Stop hit testing culled inlines when a match is found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simpler approach, but duplicated code Created 4 years, 11 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: third_party/WebKit/Source/core/layout/HitTestResult.cpp
diff --git a/third_party/WebKit/Source/core/layout/HitTestResult.cpp b/third_party/WebKit/Source/core/layout/HitTestResult.cpp
index c71c37288b3a28568716c2c23d5ea898449db5f8..7a4c2bc6faea630a9a6ff82c355cb1929cb101fc 100644
--- a/third_party/WebKit/Source/core/layout/HitTestResult.cpp
+++ b/third_party/WebKit/Source/core/layout/HitTestResult.cpp
@@ -42,6 +42,7 @@
#include "core/layout/LayoutTextFragment.h"
#include "core/page/FrameTree.h"
#include "core/svg/SVGElement.h"
+#include "platform/geometry/Region.h"
#include "platform/scroll/Scrollbar.h"
namespace blink {
@@ -430,23 +431,38 @@ bool HitTestResult::isContentEditable() const
return m_innerNode->hasEditableStyle();
}
-bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& locationInContainer, const LayoutRect& rect)
+ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& location, const LayoutRect& rect)
{
- // If not a list-based test, this function should be a no-op.
+ // If not a list-based test, stop testing because the hit has been found.
if (!hitTestRequest().listBased())
- return false;
+ return StopHitTesting;
+
+ if (!node)
+ return ContinueHitTesting;
+
+ mutableListBasedTestResult().add(node);
+
+ if (hitTestRequest().penetratingList())
+ return ContinueHitTesting;
+
+ return rect.contains(LayoutRect(location.boundingBox())) ? StopHitTesting : ContinueHitTesting;
+}
+
+ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& location, const Region& region)
+{
+ // If not a list-based test, stop testing because the hit has been found.
+ if (!hitTestRequest().listBased())
+ return StopHitTesting;
- // If node is null, return true so the hit test can continue.
if (!node)
- return true;
+ return ContinueHitTesting;
mutableListBasedTestResult().add(node);
if (hitTestRequest().penetratingList())
- return true;
+ return ContinueHitTesting;
- bool regionFilled = rect.contains(LayoutRect(locationInContainer.boundingBox()));
- return !regionFilled;
+ return region.contains(location.boundingBox()) ? StopHitTesting : ContinueHitTesting;
}
void HitTestResult::append(const HitTestResult& other)
« no previous file with comments | « third_party/WebKit/Source/core/layout/HitTestResult.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698