Index: Source/core/layout/HitTestResult.h |
diff --git a/Source/core/layout/HitTestResult.h b/Source/core/layout/HitTestResult.h |
index 01127a7ecd36ce969ce251bf51e202cc8a8e05e0..a65add09507a6928294b1f9b836c7c95c1538583 100644 |
--- a/Source/core/layout/HitTestResult.h |
+++ b/Source/core/layout/HitTestResult.h |
@@ -34,6 +34,7 @@ |
#include "wtf/ListHashSet.h" |
#include "wtf/OwnPtr.h" |
#include "wtf/RefPtr.h" |
+#include "wtf/VectorTraits.h" |
namespace blink { |
@@ -49,7 +50,8 @@ class PositionWithAffinity; |
class Scrollbar; |
class CORE_EXPORT HitTestResult { |
- DISALLOW_ALLOCATION(); |
+ ALLOW_ONLY_INLINE_ALLOCATION(); |
+ |
public: |
typedef WillBeHeapListHashSet<RefPtrWillBeMember<Node>> NodeSet; |
@@ -63,6 +65,14 @@ public: |
HitTestResult& operator=(const HitTestResult&); |
DECLARE_TRACE(); |
+ bool equalForCacheability(const HitTestResult&) const; |
+ void cacheValues(const HitTestResult&); |
+ |
+ // Populate this object based on another HitTestResult; similar to assignment operator |
+ // but don't assign any of the request parameters. ie. Thie method avoids setting |
+ // |m_hitTestLocation|, |m_hitTestRequest|. |
+ void populateFromCachedResult(const HitTestResult&); |
+ |
// For point-based hit tests, these accessors provide information about the node |
// under the point. For rect-based hit tests they are meaningless (reflect the |
// last candidate node observed in the rect). |
@@ -124,6 +134,9 @@ public: |
bool isOverLink() const; |
+ bool isCacheable() const { return m_cacheable; } |
+ void setCacheable(bool cacheable) { m_cacheable = cacheable; } |
+ |
// Return true if the test is a list-based test and we should continue testing. |
bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInContainer, const LayoutRect& = LayoutRect()); |
bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInContainer, const FloatRect&); |
@@ -143,6 +156,7 @@ private: |
HitTestLocation m_hitTestLocation; |
HitTestRequest m_hitTestRequest; |
+ bool m_cacheable; |
RefPtrWillBeMember<Node> m_innerNode; |
RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode; |
@@ -159,4 +173,16 @@ private: |
} // namespace blink |
+#if ENABLE(OILPAN) |
+// TODO(sof): the trait override/specialization is needed by HitTestCache's |
+// HeapVector<> to handle unused slots. It is not correct for HitTestResult |
+// in the wider sense of what canInitializeWithMemset provides, so fix this |
+// by introducing a trait that encompasses "unused slot" handling and use it |
+// here instead. |
+// |
+// Until that time, make this trait specialization conditional on OILPAN to |
+// limit exposure. |
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::HitTestResult); |
+#endif |
+ |
#endif // HitTestResult_h |