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

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

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix comments from tdresser Created 5 years, 6 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: Source/core/layout/HitTestResult.cpp
diff --git a/Source/core/layout/HitTestResult.cpp b/Source/core/layout/HitTestResult.cpp
index 84e6dc112d581cd23546e2c4f697da907183033d..83690358f760063f492084f24189d65037c335e0 100644
--- a/Source/core/layout/HitTestResult.cpp
+++ b/Source/core/layout/HitTestResult.cpp
@@ -101,6 +101,31 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other)
{
m_hitTestLocation = other.m_hitTestLocation;
m_hitTestRequest = other.m_hitTestRequest;
+ populateFromCachedResult(other);
+
+ return *this;
+}
+
+bool HitTestResult::equalForCacheability(const HitTestResult& other) const
+{
+ return m_hitTestRequest.equalForCacheability(other.m_hitTestRequest)
+ && m_innerNode == other.innerNode()
+ && m_innerPossiblyPseudoNode == other.innerPossiblyPseudoNode()
+ && m_pointInInnerNodeFrame == other.m_pointInInnerNodeFrame
+ && m_localPoint == other.localPoint()
+ && m_innerURLElement == other.URLElement()
+ && m_scrollbar == other.scrollbar()
+ && m_isOverWidget == other.isOverWidget();
+}
+
+void HitTestResult::cacheValues(const HitTestResult& other)
+{
+ *this = other;
+ m_hitTestRequest = other.m_hitTestRequest.type() & ~HitTestRequest::AvoidCache;
+}
+
+void HitTestResult::populateFromCachedResult(const HitTestResult& other)
+{
m_innerNode = other.innerNode();
m_innerPossiblyPseudoNode = other.innerPossiblyPseudoNode();
m_pointInInnerNodeFrame = other.m_pointInInnerNodeFrame;
@@ -108,11 +133,10 @@ HitTestResult& HitTestResult::operator=(const HitTestResult& other)
m_innerURLElement = other.URLElement();
m_scrollbar = other.scrollbar();
m_isOverWidget = other.isOverWidget();
+ m_validityRect = other.m_validityRect;
// Only copy the NodeSet in case of list hit test.
m_listBasedTestResult = adoptPtrWillBeNoop(other.m_listBasedTestResult ? new NodeSet(*other.m_listBasedTestResult) : 0);
-
- return *this;
}
DEFINE_TRACE(HitTestResult)
@@ -219,6 +243,12 @@ bool HitTestResult::isSelected() const
return false;
}
+void HitTestResult::setValidityRect(const LayoutRect& rect)
+{
+ ASSERT(!rect.isEmpty());
+ m_validityRect = rect;
+}
+
String HitTestResult::spellingToolTip(TextDirection& dir) const
{
dir = LTR;

Powered by Google App Engine
This is Rietveld 408576698