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

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

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix git cl format mangling 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 HitTestResult(); 56 HitTestResult();
57 HitTestResult(const HitTestRequest&, const LayoutPoint&); 57 HitTestResult(const HitTestRequest&, const LayoutPoint&);
58 // Pass positive padding values to perform a rect-based hit test. 58 // Pass positive padding values to perform a rect-based hit test.
59 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);
60 HitTestResult(const HitTestRequest&, const HitTestLocation&); 60 HitTestResult(const HitTestRequest&, const HitTestLocation&);
61 HitTestResult(const HitTestResult&); 61 HitTestResult(const HitTestResult&);
62 ~HitTestResult(); 62 ~HitTestResult();
63 HitTestResult& operator=(const HitTestResult&); 63 HitTestResult& operator=(const HitTestResult&);
64 DECLARE_TRACE(); 64 DECLARE_TRACE();
65 65
66 bool equalForCacheability(const HitTestResult&) const;
67 void cacheValues(const HitTestResult&);
Rick Byers 2015/06/05 20:48:59 please add a brief comment describing when cacheVa
esprehn 2015/06/06 21:14:30 addCachedResult() I think is what you want.
dtapuska 2015/06/09 18:21:24 Done.
dtapuska 2015/06/09 18:21:24 Done.
68
66 // For point-based hit tests, these accessors provide information about the node 69 // For point-based hit tests, these accessors provide information about the node
67 // under the point. For rect-based hit tests they are meaningless (reflect t he 70 // under the point. For rect-based hit tests they are meaningless (reflect t he
68 // last candidate node observed in the rect). 71 // last candidate node observed in the rect).
69 // FIXME: Make these less error-prone for rect-based hit tests (center point or fail). 72 // FIXME: Make these less error-prone for rect-based hit tests (center point or fail).
70 Node* innerNode() const { return m_innerNode.get(); } 73 Node* innerNode() const { return m_innerNode.get(); }
71 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get (); } 74 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get (); }
72 Element* innerElement() const; 75 Element* innerElement() const;
73 76
74 // If innerNode is an image map or image map area, return the associated ima ge node. 77 // If innerNode is an image map or image map area, return the associated ima ge node.
75 Node* innerNodeOrImageMapImage() const; 78 Node* innerNodeOrImageMapImage() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 KURL absoluteImageURL() const; 120 KURL absoluteImageURL() const;
118 KURL absoluteMediaURL() const; 121 KURL absoluteMediaURL() const;
119 KURL absoluteLinkURL() const; 122 KURL absoluteLinkURL() const;
120 String textContent() const; 123 String textContent() const;
121 bool isLiveLink() const; 124 bool isLiveLink() const;
122 bool isMisspelled() const; 125 bool isMisspelled() const;
123 bool isContentEditable() const; 126 bool isContentEditable() const;
124 127
125 bool isOverLink() const; 128 bool isOverLink() const;
126 129
130 const LayoutRect& validityRect() const { return m_validityRect; }
131 void setValidityRect(const LayoutRect&);
132
127 // Return true if the test is a list-based test and we should continue testi ng. 133 // Return true if the test is a list-based test and we should continue testi ng.
128 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const LayoutRect& = LayoutRect()); 134 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const LayoutRect& = LayoutRect());
129 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const FloatRect&); 135 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const FloatRect&);
130 void append(const HitTestResult&); 136 void append(const HitTestResult&);
131 137
132 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_lis tBasedTestResult. Lazy allocation makes 138 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_lis tBasedTestResult. Lazy allocation makes
133 // sense because the NodeSet is seldom necessary, and it's somewhat expensiv e to allocate and initialize. This method does 139 // sense because the NodeSet is seldom necessary, and it's somewhat expensiv e to allocate and initialize. This method does
134 // the same thing as mutableListBasedTestResult(), but here the return value is const. 140 // the same thing as mutableListBasedTestResult(), but here the return value is const.
135 const NodeSet& listBasedTestResult() const; 141 const NodeSet& listBasedTestResult() const;
136 142
137 // Collapse the rect-based test result into a single target at the specified location. 143 // Collapse the rect-based test result into a single target at the specified location.
138 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame); 144 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame);
139 145
140 private: 146 private:
141 NodeSet& mutableListBasedTestResult(); // See above. 147 NodeSet& mutableListBasedTestResult(); // See above.
142 HTMLMediaElement* mediaElement() const; 148 HTMLMediaElement* mediaElement() const;
143 149
144 HitTestLocation m_hitTestLocation; 150 HitTestLocation m_hitTestLocation;
145 HitTestRequest m_hitTestRequest; 151 HitTestRequest m_hitTestRequest;
152 LayoutRect m_validityRect;
146 153
147 RefPtrWillBeMember<Node> m_innerNode; 154 RefPtrWillBeMember<Node> m_innerNode;
148 RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode; 155 RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode;
149 // FIXME: Nothing changes this to a value different from m_hitTestLocation! 156 // FIXME: Nothing changes this to a value different from m_hitTestLocation!
150 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr ame coordinates. 157 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr ame coordinates.
151 LayoutPoint m_localPoint; // A point in the local coordinate space of m_inne rNode's layoutObject. Allows us to efficiently 158 LayoutPoint m_localPoint; // A point in the local coordinate space of m_inne rNode's layoutObject. Allows us to efficiently
152 // determine where inside the layoutObject we hit on subsequent operatio ns. 159 // determine where inside the layoutObject we hit on subsequent operatio ns.
153 RefPtrWillBeMember<Element> m_innerURLElement; 160 RefPtrWillBeMember<Element> m_innerURLElement;
154 RefPtrWillBeMember<Scrollbar> m_scrollbar; 161 RefPtrWillBeMember<Scrollbar> m_scrollbar;
155 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example). 162 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example).
156 163
157 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult; 164 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult;
158 }; 165 };
159 166
160 } // namespace blink 167 } // namespace blink
161 168
162 #endif // HitTestResult_h 169 #endif // HitTestResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698