| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class HTMLLabelElement; | 42 class HTMLLabelElement; |
| 43 class HTMLMapElement; | 43 class HTMLMapElement; |
| 44 class HitTestResult; | 44 class HitTestResult; |
| 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 GarbageCollectedMixin { |
| 53 public: | 53 public: |
| 54 TreeScope* parentTreeScope() const { return m_parentTreeScope; } | 54 TreeScope* parentTreeScope() const { return m_parentTreeScope; } |
| 55 | 55 |
| 56 TreeScope* olderShadowRootOrParentTreeScope() const; | 56 TreeScope* olderShadowRootOrParentTreeScope() const; |
| 57 bool isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(const TreeScope&
) const; | 57 bool isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(const TreeScope&
) const; |
| 58 | 58 |
| 59 Element* adjustedFocusedElement() const; | 59 Element* adjustedFocusedElement() const; |
| 60 Element* getElementById(const AtomicString&) const; | 60 Element* getElementById(const AtomicString&) const; |
| 61 const WillBeHeapVector<RawPtrWillBeMember<Element>>& getAllElementsById(cons
t AtomicString&) const; | 61 const HeapVector<Member<Element>>& getAllElementsById(const AtomicString&) c
onst; |
| 62 bool hasElementWithId(const AtomicString& id) const; | 62 bool hasElementWithId(const AtomicString& id) const; |
| 63 bool containsMultipleElementsWithId(const AtomicString& id) const; | 63 bool containsMultipleElementsWithId(const AtomicString& id) const; |
| 64 void addElementById(const AtomicString& elementId, Element*); | 64 void addElementById(const AtomicString& elementId, Element*); |
| 65 void removeElementById(const AtomicString& elementId, Element*); | 65 void removeElementById(const AtomicString& elementId, Element*); |
| 66 | 66 |
| 67 Document& document() const | 67 Document& document() const |
| 68 { | 68 { |
| 69 ASSERT(m_document); | 69 ASSERT(m_document); |
| 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* hitTestPoint(int x, int y, const HitTestRequest&) const; | 80 Element* hitTestPoint(int x, int y, const HitTestRequest&) const; |
| 81 WillBeHeapVector<RawPtrWillBeMember<Element>> elementsFromPoint(int x, int y
) const; | 81 HeapVector<Member<Element>> elementsFromPoint(int x, int y) const; |
| 82 WillBeHeapVector<RawPtrWillBeMember<Element>> elementsFromHitTestResult(HitT
estResult&) const; | 82 HeapVector<Member<Element>> elementsFromHitTestResult(HitTestResult&) const; |
| 83 | 83 |
| 84 // For accessibility. | 84 // For accessibility. |
| 85 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute
; } | 85 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute
; } |
| 86 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); | 86 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); |
| 87 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); | 87 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); |
| 88 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue); | 88 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue); |
| 89 | 89 |
| 90 DOMSelection* getSelection() const; | 90 DOMSelection* getSelection() const; |
| 91 | 91 |
| 92 // Find first anchor with the given name. | 92 // Find first anchor with the given name. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 bool deletionHasBegun(); | 171 bool deletionHasBegun(); |
| 172 void beginDeletion(); | 172 void beginDeletion(); |
| 173 #else | 173 #else |
| 174 bool deletionHasBegun() { return false; } | 174 bool deletionHasBegun() { return false; } |
| 175 void beginDeletion() { } | 175 void beginDeletion() { } |
| 176 #endif | 176 #endif |
| 177 #endif | 177 #endif |
| 178 | 178 |
| 179 bool rootNodeHasTreeSharedParent() const; | 179 bool rootNodeHasTreeSharedParent() const; |
| 180 | 180 |
| 181 RawPtrWillBeMember<ContainerNode> m_rootNode; | 181 Member<ContainerNode> m_rootNode; |
| 182 RawPtrWillBeMember<Document> m_document; | 182 Member<Document> m_document; |
| 183 RawPtrWillBeMember<TreeScope> m_parentTreeScope; | 183 Member<TreeScope> m_parentTreeScope; |
| 184 | 184 |
| 185 #if !ENABLE(OILPAN) | 185 #if !ENABLE(OILPAN) |
| 186 int m_guardRefCount; | 186 int m_guardRefCount; |
| 187 #endif | 187 #endif |
| 188 | 188 |
| 189 OwnPtrWillBeMember<DocumentOrderedMap> m_elementsById; | 189 Member<DocumentOrderedMap> m_elementsById; |
| 190 OwnPtrWillBeMember<DocumentOrderedMap> m_imageMapsByName; | 190 Member<DocumentOrderedMap> m_imageMapsByName; |
| 191 OwnPtrWillBeMember<DocumentOrderedMap> m_labelsByForAttribute; | 191 Member<DocumentOrderedMap> m_labelsByForAttribute; |
| 192 | 192 |
| 193 OwnPtrWillBeMember<IdTargetObserverRegistry> m_idTargetObserverRegistry; | 193 Member<IdTargetObserverRegistry> m_idTargetObserverRegistry; |
| 194 | 194 |
| 195 OwnPtrWillBeMember<ScopedStyleResolver> m_scopedStyleResolver; | 195 Member<ScopedStyleResolver> m_scopedStyleResolver; |
| 196 | 196 |
| 197 mutable RefPtrWillBeMember<DOMSelection> m_selection; | 197 mutable Member<DOMSelection> m_selection; |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 inline bool TreeScope::hasElementWithId(const AtomicString& id) const | 200 inline bool TreeScope::hasElementWithId(const AtomicString& id) const |
| 201 { | 201 { |
| 202 ASSERT(!id.isNull()); | 202 ASSERT(!id.isNull()); |
| 203 return m_elementsById && m_elementsById->contains(id); | 203 return m_elementsById && m_elementsById->contains(id); |
| 204 } | 204 } |
| 205 | 205 |
| 206 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst | 206 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst |
| 207 { | 207 { |
| 208 return m_elementsById && m_elementsById->containsMultiple(id); | 208 return m_elementsById && m_elementsById->containsMultiple(id); |
| 209 } | 209 } |
| 210 | 210 |
| 211 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) | 211 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) |
| 212 | 212 |
| 213 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ
est& = HitTestRequest::ReadOnly | HitTestRequest::Active); | 213 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ
est& = HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 214 | 214 |
| 215 } // namespace blink | 215 } // namespace blink |
| 216 | 216 |
| 217 #endif // TreeScope_h | 217 #endif // TreeScope_h |
| OLD | NEW |