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

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: 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..c5e3c5554c806fd9aee382a5343a5ec1cbb2890c 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,42 @@ 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 is null, continue hit testing.
+ if (!node)
+ return ContinueHitTesting;
+
+ mutableListBasedTestResult().add(node);
+
+ if (hitTestRequest().penetratingList())
+ return ContinueHitTesting;
+
+ bool regionFilled = rect.contains(LayoutRect(location.boundingBox()));
+ return regionFilled ? StopHitTesting : ContinueHitTesting;
+}
+
+ListBasedHitTestBehavior HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& location, const Region& region)
+{
Rick Byers 2016/01/25 21:50:05 Seems a shame to copy/paste this entire function.
pdr. 2016/01/25 23:47:36 Good idea. This isn't possible due to the default
+ // 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 is null, continue hit testing.
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;
+ bool regionFilled = region.contains(location.boundingBox());
+ return regionFilled ? 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