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

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

Issue 1032823003: Refactor HitTestResult to store the HitTestRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comments Created 5 years, 9 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
« no previous file with comments | « Source/core/layout/HitTestResult.h ('k') | Source/core/layout/LayoutBlock.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/HitTestResult.cpp
diff --git a/Source/core/layout/HitTestResult.cpp b/Source/core/layout/HitTestResult.cpp
index e1a11c7770aaf0c572e567b0108f02e8f7e2272b..1a6caba91adc2076ddb59ba1425838461a967703 100644
--- a/Source/core/layout/HitTestResult.cpp
+++ b/Source/core/layout/HitTestResult.cpp
@@ -47,26 +47,30 @@ namespace blink {
using namespace HTMLNames;
HitTestResult::HitTestResult()
- : m_isOverWidget(false)
+ : m_hitTestRequest(HitTestRequest::ReadOnly | HitTestRequest::Active)
+ , m_isOverWidget(false)
{
}
-HitTestResult::HitTestResult(const LayoutPoint& point)
+HitTestResult::HitTestResult(const HitTestRequest& request, const LayoutPoint& point)
: m_hitTestLocation(point)
+ , m_hitTestRequest(request)
, m_pointInInnerNodeFrame(point)
, m_isOverWidget(false)
{
}
-HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
+HitTestResult::HitTestResult(const HitTestRequest& request, const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
: m_hitTestLocation(centerPoint, topPadding, rightPadding, bottomPadding, leftPadding)
+ , m_hitTestRequest(request)
, m_pointInInnerNodeFrame(centerPoint)
, m_isOverWidget(false)
{
}
-HitTestResult::HitTestResult(const HitTestLocation& other)
+HitTestResult::HitTestResult(const HitTestRequest& otherRequest, const HitTestLocation& other)
: m_hitTestLocation(other)
+ , m_hitTestRequest(otherRequest)
, m_pointInInnerNodeFrame(m_hitTestLocation.point())
, m_isOverWidget(false)
{
@@ -74,6 +78,7 @@ HitTestResult::HitTestResult(const HitTestLocation& other)
HitTestResult::HitTestResult(const HitTestResult& other)
: m_hitTestLocation(other.m_hitTestLocation)
+ , m_hitTestRequest(other.m_hitTestRequest)
, m_innerNode(other.innerNode())
, m_innerPossiblyPseudoNode(other.m_innerPossiblyPseudoNode)
, m_innerNonSharedNode(other.innerNonSharedNode())
@@ -94,6 +99,7 @@ HitTestResult::~HitTestResult()
HitTestResult& HitTestResult::operator=(const HitTestResult& other)
{
m_hitTestLocation = other.m_hitTestLocation;
+ m_hitTestRequest = other.m_hitTestRequest;
m_innerNode = other.innerNode();
m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode();
m_innerNonSharedNode = other.innerNonSharedNode();
@@ -372,13 +378,11 @@ bool HitTestResult::isContentEditable() const
return m_innerNonSharedNode->hasEditableStyle();
}
-bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const LayoutRect& rect)
+bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& locationInContainer, const LayoutRect& rect)
{
// If not a list-based test, this function should be a no-op.
- if (!request.listBased()) {
- ASSERT(!isRectBasedTest());
+ if (!hitTestRequest().listBased())
return false;
- }
// If node is null, return true so the hit test can continue.
if (!node)
@@ -386,20 +390,18 @@ bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestReques
mutableListBasedTestResult().add(node);
- if (request.penetratingList())
+ if (hitTestRequest().penetratingList())
return true;
bool regionFilled = rect.contains(LayoutRect(locationInContainer.boundingBox()));
return !regionFilled;
}
-bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const FloatRect& rect)
+bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestLocation& locationInContainer, const FloatRect& rect)
{
// If not a list-based test, this function should be a no-op.
- if (!request.listBased()) {
- ASSERT(!isRectBasedTest());
+ if (!hitTestRequest().listBased())
return false;
- }
// If node is null, return true so the hit test can continue.
if (!node)
@@ -407,16 +409,16 @@ bool HitTestResult::addNodeToListBasedTestResult(Node* node, const HitTestReques
mutableListBasedTestResult().add(node);
- if (request.penetratingList())
+ if (hitTestRequest().penetratingList())
return true;
bool regionFilled = rect.contains(locationInContainer.boundingBox());
return !regionFilled;
}
-void HitTestResult::append(const HitTestResult& other, const HitTestRequest& request)
+void HitTestResult::append(const HitTestResult& other)
{
- ASSERT(request.listBased());
+ ASSERT(hitTestRequest().listBased());
if (!m_scrollbar && other.scrollbar()) {
setScrollbar(other.scrollbar());
« no previous file with comments | « Source/core/layout/HitTestResult.h ('k') | Source/core/layout/LayoutBlock.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698