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

Side by Side Diff: Source/core/layout/HitTestResult.h

Issue 1177123003: Revert "Implement a Hit Test Cache for same point hits." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « Source/core/layout/HitTestRequest.h ('k') | Source/core/layout/HitTestResult.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Computer, Inc. 2 * Copyright (C) 2006 Apple Computer, Inc.
3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 class HTMLAreaElement; 42 class HTMLAreaElement;
43 class HTMLMediaElement; 43 class HTMLMediaElement;
44 class Image; 44 class Image;
45 class KURL; 45 class KURL;
46 class Node; 46 class Node;
47 class LayoutObject; 47 class LayoutObject;
48 class PositionWithAffinity; 48 class PositionWithAffinity;
49 class Scrollbar; 49 class Scrollbar;
50 50
51 class CORE_EXPORT HitTestResult { 51 class CORE_EXPORT HitTestResult {
52 ALLOW_ONLY_INLINE_ALLOCATION(); 52 DISALLOW_ALLOCATION();
53
54 public: 53 public:
55 typedef WillBeHeapListHashSet<RefPtrWillBeMember<Node>> NodeSet; 54 typedef WillBeHeapListHashSet<RefPtrWillBeMember<Node>> NodeSet;
56 55
57 HitTestResult(); 56 HitTestResult();
58 HitTestResult(const HitTestRequest&, const LayoutPoint&); 57 HitTestResult(const HitTestRequest&, const LayoutPoint&);
59 // Pass positive padding values to perform a rect-based hit test. 58 // Pass positive padding values to perform a rect-based hit test.
60 HitTestResult(const HitTestRequest&, const LayoutPoint& centerPoint, unsigne d topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPaddin g); 59 HitTestResult(const HitTestRequest&, const LayoutPoint& centerPoint, unsigne d topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPaddin g);
61 HitTestResult(const HitTestRequest&, const HitTestLocation&); 60 HitTestResult(const HitTestRequest&, const HitTestLocation&);
62 HitTestResult(const HitTestResult&); 61 HitTestResult(const HitTestResult&);
63 ~HitTestResult(); 62 ~HitTestResult();
64 HitTestResult& operator=(const HitTestResult&); 63 HitTestResult& operator=(const HitTestResult&);
65 DECLARE_TRACE(); 64 DECLARE_TRACE();
66 65
67 bool equalForCacheability(const HitTestResult&) const;
68 void cacheValues(const HitTestResult&);
69
70 // Populate this object based on another HitTestResult; similar to assignmen t operator
71 // but don't assign any of the request parameters. ie. Thie method avoids se tting
72 // |m_hitTestLocation|, |m_hitTestRequest|.
73 void populateFromCachedResult(const HitTestResult&);
74
75 // For point-based hit tests, these accessors provide information about the node 66 // For point-based hit tests, these accessors provide information about the node
76 // under the point. For rect-based hit tests they are meaningless (reflect t he 67 // under the point. For rect-based hit tests they are meaningless (reflect t he
77 // last candidate node observed in the rect). 68 // last candidate node observed in the rect).
78 // FIXME: Make these less error-prone for rect-based hit tests (center point or fail). 69 // FIXME: Make these less error-prone for rect-based hit tests (center point or fail).
79 Node* innerNode() const { return m_innerNode.get(); } 70 Node* innerNode() const { return m_innerNode.get(); }
80 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get (); } 71 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get (); }
81 Element* innerElement() const; 72 Element* innerElement() const;
82 73
83 // If innerNode is an image map or image map area, return the associated ima ge node. 74 // If innerNode is an image map or image map area, return the associated ima ge node.
84 Node* innerNodeOrImageMapImage() const; 75 Node* innerNodeOrImageMapImage() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 KURL absoluteImageURL() const; 117 KURL absoluteImageURL() const;
127 KURL absoluteMediaURL() const; 118 KURL absoluteMediaURL() const;
128 KURL absoluteLinkURL() const; 119 KURL absoluteLinkURL() const;
129 String textContent() const; 120 String textContent() const;
130 bool isLiveLink() const; 121 bool isLiveLink() const;
131 bool isMisspelled() const; 122 bool isMisspelled() const;
132 bool isContentEditable() const; 123 bool isContentEditable() const;
133 124
134 bool isOverLink() const; 125 bool isOverLink() const;
135 126
136 const LayoutRect& validityRect() const { return m_validityRect; }
137 void setValidityRect(const LayoutRect&);
138
139 // Return true if the test is a list-based test and we should continue testi ng. 127 // Return true if the test is a list-based test and we should continue testi ng.
140 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const LayoutRect& = LayoutRect()); 128 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const LayoutRect& = LayoutRect());
141 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const FloatRect&); 129 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const FloatRect&);
142 void append(const HitTestResult&); 130 void append(const HitTestResult&);
143 131
144 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_lis tBasedTestResult. Lazy allocation makes 132 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_lis tBasedTestResult. Lazy allocation makes
145 // sense because the NodeSet is seldom necessary, and it's somewhat expensiv e to allocate and initialize. This method does 133 // sense because the NodeSet is seldom necessary, and it's somewhat expensiv e to allocate and initialize. This method does
146 // the same thing as mutableListBasedTestResult(), but here the return value is const. 134 // the same thing as mutableListBasedTestResult(), but here the return value is const.
147 const NodeSet& listBasedTestResult() const; 135 const NodeSet& listBasedTestResult() const;
148 136
149 // Collapse the rect-based test result into a single target at the specified location. 137 // Collapse the rect-based test result into a single target at the specified location.
150 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame); 138 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame);
151 139
152 private: 140 private:
153 NodeSet& mutableListBasedTestResult(); // See above. 141 NodeSet& mutableListBasedTestResult(); // See above.
154 HTMLMediaElement* mediaElement() const; 142 HTMLMediaElement* mediaElement() const;
155 143
156 HitTestLocation m_hitTestLocation; 144 HitTestLocation m_hitTestLocation;
157 HitTestRequest m_hitTestRequest; 145 HitTestRequest m_hitTestRequest;
158 LayoutRect m_validityRect;
159 146
160 RefPtrWillBeMember<Node> m_innerNode; 147 RefPtrWillBeMember<Node> m_innerNode;
161 RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode; 148 RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode;
162 // FIXME: Nothing changes this to a value different from m_hitTestLocation! 149 // FIXME: Nothing changes this to a value different from m_hitTestLocation!
163 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr ame coordinates. 150 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr ame coordinates.
164 LayoutPoint m_localPoint; // A point in the local coordinate space of m_inne rNode's layoutObject. Allows us to efficiently 151 LayoutPoint m_localPoint; // A point in the local coordinate space of m_inne rNode's layoutObject. Allows us to efficiently
165 // determine where inside the layoutObject we hit on subsequent operatio ns. 152 // determine where inside the layoutObject we hit on subsequent operatio ns.
166 RefPtrWillBeMember<Element> m_innerURLElement; 153 RefPtrWillBeMember<Element> m_innerURLElement;
167 RefPtrWillBeMember<Scrollbar> m_scrollbar; 154 RefPtrWillBeMember<Scrollbar> m_scrollbar;
168 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example). 155 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example).
169 156
170 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult; 157 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult;
171 }; 158 };
172 159
173 } // namespace blink 160 } // namespace blink
174 161
175 #endif // HitTestResult_h 162 #endif // HitTestResult_h
OLDNEW
« no previous file with comments | « Source/core/layout/HitTestRequest.h ('k') | Source/core/layout/HitTestResult.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698