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

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

Issue 1630793002: Stop hit testing culled inlines when a match is found (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 29 matching lines...) Expand all
40 namespace blink { 40 namespace blink {
41 41
42 class Element; 42 class Element;
43 class LocalFrame; 43 class LocalFrame;
44 class HTMLAreaElement; 44 class HTMLAreaElement;
45 class HTMLMediaElement; 45 class HTMLMediaElement;
46 class Image; 46 class Image;
47 class KURL; 47 class KURL;
48 class Node; 48 class Node;
49 class LayoutObject; 49 class LayoutObject;
50 class Region;
50 class Scrollbar; 51 class Scrollbar;
51 52
53 // List-based hit test testing can continue even after a hit has been found.
54 // This is used to support fuzzy matching with rect-based hit tests as well as
55 // penetrating tests which collect all nodes (see: HitTestRequest::RequestType).
56 enum ListBasedHitTestBehavior {
57 ContinueHitTesting,
58 StopHitTesting
59 };
60
52 class CORE_EXPORT HitTestResult { 61 class CORE_EXPORT HitTestResult {
53 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); 62 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
54
55 public: 63 public:
56 typedef WillBeHeapListHashSet<RefPtrWillBeMember<Node>> NodeSet; 64 typedef WillBeHeapListHashSet<RefPtrWillBeMember<Node>> NodeSet;
57 65
58 HitTestResult(); 66 HitTestResult();
59 HitTestResult(const HitTestRequest&, const LayoutPoint&); 67 HitTestResult(const HitTestRequest&, const LayoutPoint&);
60 // Pass positive padding values to perform a rect-based hit test. 68 // Pass positive padding values to perform a rect-based hit test.
61 HitTestResult(const HitTestRequest&, const LayoutPoint& centerPoint, unsigne d topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPaddin g); 69 HitTestResult(const HitTestRequest&, const LayoutPoint& centerPoint, unsigne d topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPaddin g);
62 HitTestResult(const HitTestRequest&, const HitTestLocation&); 70 HitTestResult(const HitTestRequest&, const HitTestLocation&);
63 HitTestResult(const HitTestResult&); 71 HitTestResult(const HitTestResult&);
64 ~HitTestResult(); 72 ~HitTestResult();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 String textContent() const; 138 String textContent() const;
131 bool isLiveLink() const; 139 bool isLiveLink() const;
132 bool isMisspelled() const; 140 bool isMisspelled() const;
133 bool isContentEditable() const; 141 bool isContentEditable() const;
134 142
135 bool isOverLink() const; 143 bool isOverLink() const;
136 144
137 bool isCacheable() const { return m_cacheable; } 145 bool isCacheable() const { return m_cacheable; }
138 void setCacheable(bool cacheable) { m_cacheable = cacheable; } 146 void setCacheable(bool cacheable) { m_cacheable = cacheable; }
139 147
140 // Return true if the test is a list-based test and we should continue testi ng. 148 ListBasedHitTestBehavior addNodeToListBasedTestResult(Node*, const HitTestLo cation&, const LayoutRect& = LayoutRect());
141 bool addNodeToListBasedTestResult(Node*, const HitTestLocation& pointInConta iner, const LayoutRect& = LayoutRect()); 149 ListBasedHitTestBehavior addNodeToListBasedTestResult(Node*, const HitTestLo cation&, const Region&);
150
142 void append(const HitTestResult&); 151 void append(const HitTestResult&);
143 152
144 // If m_listBasedTestResult is 0 then set it to a new NodeSet. Return *m_lis tBasedTestResult. Lazy allocation makes 153 // 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 154 // 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. 155 // the same thing as mutableListBasedTestResult(), but here the return value is const.
147 const NodeSet& listBasedTestResult() const; 156 const NodeSet& listBasedTestResult() const;
148 157
149 // Collapse the rect-based test result into a single target at the specified location. 158 // Collapse the rect-based test result into a single target at the specified location.
150 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame); 159 void resolveRectBasedTest(Node* resolvedInnerNode, const LayoutPoint& resolv edPointInMainFrame);
151 160
(...skipping 16 matching lines...) Expand all
168 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example). 177 bool m_isOverWidget; // Returns true if we are over a widget (and not in the border/padding area of a LayoutPart for example).
169 178
170 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult; 179 mutable OwnPtrWillBeMember<NodeSet> m_listBasedTestResult;
171 }; 180 };
172 181
173 } // namespace blink 182 } // namespace blink
174 183
175 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::HitTestResult); 184 WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::HitTestResult);
176 185
177 #endif // HitTestResult_h 186 #endif // HitTestResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698