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

Side by Side Diff: Source/core/dom/TreeScope.h

Issue 1142283004: Implement a Hit Test Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Adjust comments in HitTestCache.h 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #ifndef TreeScope_h 27 #ifndef TreeScope_h
28 #define TreeScope_h 28 #define TreeScope_h
29 29
30 #include "core/CoreExport.h" 30 #include "core/CoreExport.h"
31 #include "core/dom/DocumentOrderedMap.h" 31 #include "core/dom/DocumentOrderedMap.h"
32 #include "core/layout/HitTestRequest.h"
32 #include "platform/heap/Handle.h" 33 #include "platform/heap/Handle.h"
33 #include "wtf/text/AtomicString.h" 34 #include "wtf/text/AtomicString.h"
34 35
35 namespace blink { 36 namespace blink {
36 37
37 class ContainerNode; 38 class ContainerNode;
38 class DOMSelection; 39 class DOMSelection;
39 class Document; 40 class Document;
40 class Element; 41 class Element;
41 class HTMLLabelElement; 42 class HTMLLabelElement;
42 class HTMLMapElement; 43 class HTMLMapElement;
43 class HitTestResult; 44 class HitTestResult;
44 class HitTestRequest;
45 class IdTargetObserverRegistry; 45 class IdTargetObserverRegistry;
46 class ScopedStyleResolver; 46 class ScopedStyleResolver;
47 class Node; 47 class Node;
48 48
49 // A class which inherits both Node and TreeScope must call clearRareData() in i ts destructor 49 // A class which inherits both Node and TreeScope must call clearRareData() in i ts destructor
50 // so that the Node destructor no longer does problematic NodeList cache manipul ation in 50 // so that the Node destructor no longer does problematic NodeList cache manipul ation in
51 // the destructor. 51 // the destructor.
52 class CORE_EXPORT TreeScope : public WillBeGarbageCollectedMixin { 52 class CORE_EXPORT TreeScope : public WillBeGarbageCollectedMixin {
53 public: 53 public:
54 TreeScope* parentTreeScope() const { return m_parentTreeScope; } 54 TreeScope* parentTreeScope() const { return m_parentTreeScope; }
(...skipping 15 matching lines...) Expand all
70 return *m_document; 70 return *m_document;
71 } 71 }
72 72
73 Node* ancestorInThisScope(Node*) const; 73 Node* ancestorInThisScope(Node*) const;
74 74
75 void addImageMap(HTMLMapElement*); 75 void addImageMap(HTMLMapElement*);
76 void removeImageMap(HTMLMapElement*); 76 void removeImageMap(HTMLMapElement*);
77 HTMLMapElement* getImageMap(const String& url) const; 77 HTMLMapElement* getImageMap(const String& url) const;
78 78
79 Element* elementFromPoint(int x, int y) const; 79 Element* elementFromPoint(int x, int y) const;
80 Element* elementFromPointNoCache(int x, int y) const;
80 Vector<Element*> elementsFromPoint(int x, int y) const; 81 Vector<Element*> elementsFromPoint(int x, int y) const;
81 82
82 // For accessibility. 83 // For accessibility.
83 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute ; } 84 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute ; }
84 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); 85 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*);
85 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); 86 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*);
86 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue); 87 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue);
87 88
88 DOMSelection* getSelection() const; 89 DOMSelection* getSelection() const;
89 90
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 bool deletionHasBegun(); 170 bool deletionHasBegun();
170 void beginDeletion(); 171 void beginDeletion();
171 #else 172 #else
172 bool deletionHasBegun() { return false; } 173 bool deletionHasBegun() { return false; }
173 void beginDeletion() { } 174 void beginDeletion() { }
174 #endif 175 #endif
175 #endif 176 #endif
176 177
177 bool rootNodeHasTreeSharedParent() const; 178 bool rootNodeHasTreeSharedParent() const;
178 179
180 Element* hitTestPoint(int x, int y, const HitTestRequest&) const;
181
179 RawPtrWillBeMember<ContainerNode> m_rootNode; 182 RawPtrWillBeMember<ContainerNode> m_rootNode;
180 RawPtrWillBeMember<Document> m_document; 183 RawPtrWillBeMember<Document> m_document;
181 RawPtrWillBeMember<TreeScope> m_parentTreeScope; 184 RawPtrWillBeMember<TreeScope> m_parentTreeScope;
182 185
183 #if !ENABLE(OILPAN) 186 #if !ENABLE(OILPAN)
184 int m_guardRefCount; 187 int m_guardRefCount;
185 #endif 188 #endif
186 189
187 OwnPtrWillBeMember<DocumentOrderedMap> m_elementsById; 190 OwnPtrWillBeMember<DocumentOrderedMap> m_elementsById;
188 OwnPtrWillBeMember<DocumentOrderedMap> m_imageMapsByName; 191 OwnPtrWillBeMember<DocumentOrderedMap> m_imageMapsByName;
(...skipping 12 matching lines...) Expand all
201 return m_elementsById && m_elementsById->contains(id); 204 return m_elementsById && m_elementsById->contains(id);
202 } 205 }
203 206
204 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co nst 207 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co nst
205 { 208 {
206 return m_elementsById && m_elementsById->containsMultiple(id); 209 return m_elementsById && m_elementsById->containsMultiple(id);
207 } 210 }
208 211
209 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) 212 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope)
210 213
211 HitTestResult hitTestInDocument(const Document*, int x, int y); 214 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ est& = HitTestRequest::ReadOnly | HitTestRequest::Active);
tdresser 2015/06/10 13:35:21 Why take a reference instead of a value here?
dtapuska 2015/06/10 14:04:48 HitTestRequest is a class; so I prefer to pass cla
212 215
213 } // namespace blink 216 } // namespace blink
214 217
215 #endif // TreeScope_h 218 #endif // TreeScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698