| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 class HTMLLabelElement; | 43 class HTMLLabelElement; |
| 44 class HTMLMapElement; | 44 class HTMLMapElement; |
| 45 class HitTestResult; | 45 class HitTestResult; |
| 46 class IdTargetObserverRegistry; | 46 class IdTargetObserverRegistry; |
| 47 class ScopedStyleResolver; | 47 class ScopedStyleResolver; |
| 48 class Node; | 48 class Node; |
| 49 | 49 |
| 50 // A class which inherits both Node and TreeScope must call clearRareData() in i
ts destructor | 50 // A class which inherits both Node and TreeScope must call clearRareData() in i
ts destructor |
| 51 // so that the Node destructor no longer does problematic NodeList cache manipul
ation in | 51 // so that the Node destructor no longer does problematic NodeList cache manipul
ation in |
| 52 // the destructor. | 52 // the destructor. |
| 53 class CORE_EXPORT TreeScope : public WillBeGarbageCollectedMixin { | 53 class CORE_EXPORT TreeScope : public GarbageCollectedMixin { |
| 54 public: | 54 public: |
| 55 TreeScope* parentTreeScope() const { return m_parentTreeScope; } | 55 TreeScope* parentTreeScope() const { return m_parentTreeScope; } |
| 56 | 56 |
| 57 TreeScope* olderShadowRootOrParentTreeScope() const; | 57 TreeScope* olderShadowRootOrParentTreeScope() const; |
| 58 bool isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(const TreeScope&
) const; | 58 bool isInclusiveOlderSiblingShadowRootOrAncestorTreeScopeOf(const TreeScope&
) const; |
| 59 | 59 |
| 60 Element* adjustedFocusedElement() const; | 60 Element* adjustedFocusedElement() const; |
| 61 Element* getElementById(const AtomicString&) const; | 61 Element* getElementById(const AtomicString&) const; |
| 62 const WillBeHeapVector<RawPtrWillBeMember<Element>>& getAllElementsById(cons
t AtomicString&) const; | 62 const HeapVector<Member<Element>>& getAllElementsById(const AtomicString&) c
onst; |
| 63 bool hasElementWithId(const AtomicString& id) const; | 63 bool hasElementWithId(const AtomicString& id) const; |
| 64 bool containsMultipleElementsWithId(const AtomicString& id) const; | 64 bool containsMultipleElementsWithId(const AtomicString& id) const; |
| 65 void addElementById(const AtomicString& elementId, Element*); | 65 void addElementById(const AtomicString& elementId, Element*); |
| 66 void removeElementById(const AtomicString& elementId, Element*); | 66 void removeElementById(const AtomicString& elementId, Element*); |
| 67 | 67 |
| 68 Document& document() const | 68 Document& document() const |
| 69 { | 69 { |
| 70 ASSERT(m_document); | 70 ASSERT(m_document); |
| 71 return *m_document; | 71 return *m_document; |
| 72 } | 72 } |
| 73 | 73 |
| 74 Node* ancestorInThisScope(Node*) const; | 74 Node* ancestorInThisScope(Node*) const; |
| 75 | 75 |
| 76 void addImageMap(HTMLMapElement*); | 76 void addImageMap(HTMLMapElement*); |
| 77 void removeImageMap(HTMLMapElement*); | 77 void removeImageMap(HTMLMapElement*); |
| 78 HTMLMapElement* getImageMap(const String& url) const; | 78 HTMLMapElement* getImageMap(const String& url) const; |
| 79 | 79 |
| 80 Element* elementFromPoint(int x, int y) const; | 80 Element* elementFromPoint(int x, int y) const; |
| 81 Element* hitTestPoint(int x, int y, const HitTestRequest&) const; | 81 Element* hitTestPoint(int x, int y, const HitTestRequest&) const; |
| 82 WillBeHeapVector<RawPtrWillBeMember<Element>> elementsFromPoint(int x, int y
) const; | 82 HeapVector<Member<Element>> elementsFromPoint(int x, int y) const; |
| 83 WillBeHeapVector<RawPtrWillBeMember<Element>> elementsFromHitTestResult(HitT
estResult&) const; | 83 HeapVector<Member<Element>> elementsFromHitTestResult(HitTestResult&) const; |
| 84 | 84 |
| 85 // For accessibility. | 85 // For accessibility. |
| 86 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute
; } | 86 bool shouldCacheLabelsByForAttribute() const { return m_labelsByForAttribute
; } |
| 87 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); | 87 void addLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); |
| 88 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); | 88 void removeLabel(const AtomicString& forAttributeValue, HTMLLabelElement*); |
| 89 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue); | 89 HTMLLabelElement* labelElementForId(const AtomicString& forAttributeValue); |
| 90 | 90 |
| 91 DOMSelection* getSelection() const; | 91 DOMSelection* getSelection() const; |
| 92 | 92 |
| 93 // Find first anchor with the given name. | 93 // Find first anchor with the given name. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 bool deletionHasBegun(); | 174 bool deletionHasBegun(); |
| 175 void beginDeletion(); | 175 void beginDeletion(); |
| 176 #else | 176 #else |
| 177 bool deletionHasBegun() { return false; } | 177 bool deletionHasBegun() { return false; } |
| 178 void beginDeletion() { } | 178 void beginDeletion() { } |
| 179 #endif | 179 #endif |
| 180 #endif | 180 #endif |
| 181 | 181 |
| 182 bool rootNodeHasTreeSharedParent() const; | 182 bool rootNodeHasTreeSharedParent() const; |
| 183 | 183 |
| 184 RawPtrWillBeMember<ContainerNode> m_rootNode; | 184 Member<ContainerNode> m_rootNode; |
| 185 RawPtrWillBeMember<Document> m_document; | 185 Member<Document> m_document; |
| 186 RawPtrWillBeMember<TreeScope> m_parentTreeScope; | 186 Member<TreeScope> m_parentTreeScope; |
| 187 | 187 |
| 188 #if !ENABLE(OILPAN) | 188 #if !ENABLE(OILPAN) |
| 189 int m_guardRefCount; | 189 int m_guardRefCount; |
| 190 #endif | 190 #endif |
| 191 | 191 |
| 192 OwnPtrWillBeMember<DocumentOrderedMap> m_elementsById; | 192 Member<DocumentOrderedMap> m_elementsById; |
| 193 OwnPtrWillBeMember<DocumentOrderedMap> m_imageMapsByName; | 193 Member<DocumentOrderedMap> m_imageMapsByName; |
| 194 OwnPtrWillBeMember<DocumentOrderedMap> m_labelsByForAttribute; | 194 Member<DocumentOrderedMap> m_labelsByForAttribute; |
| 195 | 195 |
| 196 OwnPtrWillBeMember<IdTargetObserverRegistry> m_idTargetObserverRegistry; | 196 Member<IdTargetObserverRegistry> m_idTargetObserverRegistry; |
| 197 | 197 |
| 198 OwnPtrWillBeMember<ScopedStyleResolver> m_scopedStyleResolver; | 198 Member<ScopedStyleResolver> m_scopedStyleResolver; |
| 199 | 199 |
| 200 mutable RefPtrWillBeMember<DOMSelection> m_selection; | 200 mutable Member<DOMSelection> m_selection; |
| 201 | 201 |
| 202 RadioButtonGroupScope m_radioButtonGroupScope; | 202 RadioButtonGroupScope m_radioButtonGroupScope; |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 inline bool TreeScope::hasElementWithId(const AtomicString& id) const | 205 inline bool TreeScope::hasElementWithId(const AtomicString& id) const |
| 206 { | 206 { |
| 207 ASSERT(!id.isNull()); | 207 ASSERT(!id.isNull()); |
| 208 return m_elementsById && m_elementsById->contains(id); | 208 return m_elementsById && m_elementsById->contains(id); |
| 209 } | 209 } |
| 210 | 210 |
| 211 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst | 211 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst |
| 212 { | 212 { |
| 213 return m_elementsById && m_elementsById->containsMultiple(id); | 213 return m_elementsById && m_elementsById->containsMultiple(id); |
| 214 } | 214 } |
| 215 | 215 |
| 216 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) | 216 DEFINE_COMPARISON_OPERATORS_WITH_REFERENCES(TreeScope) |
| 217 | 217 |
| 218 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ
est& = HitTestRequest::ReadOnly | HitTestRequest::Active); | 218 HitTestResult hitTestInDocument(const Document*, int x, int y, const HitTestRequ
est& = HitTestRequest::ReadOnly | HitTestRequest::Active); |
| 219 | 219 |
| 220 } // namespace blink | 220 } // namespace blink |
| 221 | 221 |
| 222 #endif // TreeScope_h | 222 #endif // TreeScope_h |
| OLD | NEW |