Chromium Code Reviews| 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) |