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

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: Created 5 years, 7 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
66 // For point-based hit tests, these accessors provide information about the node 68 // 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 69 // under the point. For rect-based hit tests they are meaningless (reflect t he
68 // last candidate node observed in the rect). 70 // last candidate node observed in the rect).
69 // FIXME: Make these less error-prone for rect-based hit tests (center point or fail). 71 // FIXME: Make these less error-prone for rect-based hit tests (center point or fail).
70 Node* innerNode() const { return m_innerNode.get(); } 72 Node* innerNode() const { return m_innerNode.get(); }
71 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get (); } 73 Node* innerPossiblyPseudoNode() const { return m_innerPossiblyPseudoNode.get (); }
72 Element* innerElement() const; 74 Element* innerElement() const;
73 75
74 // If innerNode is an image map or image map area, return the associated ima ge node. 76 // If innerNode is an image map or image map area, return the associated ima ge node.
75 Node* innerNodeOrImageMapImage() const; 77 Node* innerNodeOrImageMapImage() const;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 KURL absoluteImageURL() const; 119 KURL absoluteImageURL() const;
118 KURL absoluteMediaURL() const; 120 KURL absoluteMediaURL() const;
119 KURL absoluteLinkURL() const; 121 KURL absoluteLinkURL() const;
120 String textContent() const; 122 String textContent() const;
121 bool isLiveLink() const; 123 bool isLiveLink() const;
122 bool isMisspelled() const; 124 bool isMisspelled() const;
123 bool isContentEditable() const; 125 bool isContentEditable() const;
124 126
125 bool isOverLink() const; 127 bool isOverLink() const;
126 128
129 const LayoutRect& validityRect() const { return m_validityRect; }
130 void setValidityRect(const LayoutRect&);
131 void shrinkValidityRect(const LayoutRect&);
132 void intersectValidityRect(const LayoutRect&);
133
127 // Return true if the test is a list-based test and we should continue testi ng. 134 // 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()); 135 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const LayoutRect& = LayoutRect());
129 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const FloatRect&); 136 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const FloatRect&);
130 void append(const HitTestResult&); 137 void append(const HitTestResult&);
131 138
132 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_lis tBasedTestResult. Lazy allocation makes 139 // 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 140 // 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. 141 // the same thing as mutableListBasedTestResult(), but here the return value is const.
135 const NodeSet& listBasedTestResult() const; 142 const NodeSet& listBasedTestResult() const;
136 143
137 // Collapse the rect-based test result into a single target at the specified location. 144 // Collapse the rect-based test result into a single target at the specified location.
138 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame); 145 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame);
139 146
140 private: 147 private:
141 NodeSet& mutableListBasedTestResult(); // See above. 148 NodeSet& mutableListBasedTestResult(); // See above.
142 HTMLMediaElement* mediaElement() const; 149 HTMLMediaElement* mediaElement() const;
143 150
144 HitTestLocation m_hitTestLocation; 151 HitTestLocation m_hitTestLocation;
145 HitTestRequest m_hitTestRequest; 152 HitTestRequest m_hitTestRequest;
153 LayoutRect m_validityRect;
146 154
147 RefPtrWillBeMember<Node> m_innerNode; 155 RefPtrWillBeMember<Node> m_innerNode;
148 RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode; 156 RefPtrWillBeMember<Node> m_innerPossiblyPseudoNode;
149 // FIXME: Nothing changes this to a value different from m_hitTestLocation! 157 // FIXME: Nothing changes this to a value different from m_hitTestLocation!
150 LayoutPoint m_pointInInnerNodeFrame; // The hit-tested point in innerNode fr ame coordinates. 158 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 159 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. 160 // determine where inside the layoutObject we hit on subsequent operatio ns.
153 RefPtrWillBeMember<Element> m_innerURLElement; 161 RefPtrWillBeMember<Element> m_innerURLElement;
154 RefPtrWillBeMember<Scrollbar> m_scrollbar; 162 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). 163 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example).
156 164
157 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult; 165 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult;
158 }; 166 };
159 167
160 } // namespace blink 168 } // namespace blink
161 169
162 #endif // HitTestResult_h 170 #endif // HitTestResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698