| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 class TreeScope { | 49 class TreeScope { |
| 50 friend class Document; | 50 friend class Document; |
| 51 friend class TreeScopeAdopter; | 51 friend class TreeScopeAdopter; |
| 52 | 52 |
| 53 public: | 53 public: |
| 54 TreeScope* parentTreeScope() const { return m_parentTreeScope; } | 54 TreeScope* parentTreeScope() const { return m_parentTreeScope; } |
| 55 void setParentTreeScope(TreeScope*); | 55 void setParentTreeScope(TreeScope*); |
| 56 | 56 |
| 57 Element* adjustedFocusedElement(); | 57 Element* adjustedFocusedElement(); |
| 58 Element* getElementById(const AtomicString&) const; | 58 Element* getElementById(const AtomicString&) const; |
| 59 bool hasElementWithId(StringImpl* id) const; | 59 const Vector<Element*>* getAllElementsById(const AtomicString&) const; |
| 60 bool containsMultipleElementsWithId(const AtomicString& id) const; | 60 bool hasElementWithId(StringImpl*) const; // FIXME: The argument should have
type "const AtomicString&"" rather than "StringImpl*". |
| 61 void addElementById(const AtomicString& elementId, Element*); | 61 bool containsMultipleElementsWithId(const AtomicString&) const; |
| 62 void removeElementById(const AtomicString& elementId, Element*); | 62 void addElementById(const AtomicString&, Element*); |
| 63 void removeElementById(const AtomicString&, Element*); |
| 64 |
| 65 Element* getElementByName(const AtomicString&) const; |
| 66 bool hasElementWithName(const AtomicString&) const; |
| 67 bool containsMultipleElementsWithName(const AtomicString&) const; |
| 68 void addElementByName(const AtomicString&, Element*); |
| 69 void removeElementByName(const AtomicString&, Element*); |
| 63 | 70 |
| 64 Document* documentScope() const { return m_documentScope; } | 71 Document* documentScope() const { return m_documentScope; } |
| 65 | 72 |
| 66 Node* ancestorInThisScope(Node*) const; | 73 Node* ancestorInThisScope(Node*) const; |
| 67 | 74 |
| 68 void addImageMap(HTMLMapElement*); | 75 void addImageMap(HTMLMapElement*); |
| 69 void removeImageMap(HTMLMapElement*); | 76 void removeImageMap(HTMLMapElement*); |
| 70 HTMLMapElement* getImageMap(const String& url) const; | 77 HTMLMapElement* getImageMap(const String& url) const; |
| 71 | 78 |
| 72 Element* elementFromPoint(int x, int y) const; | 79 Element* elementFromPoint(int x, int y) const; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 #endif | 168 #endif |
| 162 | 169 |
| 163 bool rootNodeHasTreeSharedParent() const; | 170 bool rootNodeHasTreeSharedParent() const; |
| 164 | 171 |
| 165 Node* m_rootNode; | 172 Node* m_rootNode; |
| 166 Document* m_documentScope; | 173 Document* m_documentScope; |
| 167 TreeScope* m_parentTreeScope; | 174 TreeScope* m_parentTreeScope; |
| 168 int m_guardRefCount; | 175 int m_guardRefCount; |
| 169 | 176 |
| 170 OwnPtr<DocumentOrderedMap> m_elementsById; | 177 OwnPtr<DocumentOrderedMap> m_elementsById; |
| 178 OwnPtr<DocumentOrderedMap> m_elementsByName; |
| 171 OwnPtr<DocumentOrderedMap> m_imageMapsByName; | 179 OwnPtr<DocumentOrderedMap> m_imageMapsByName; |
| 172 OwnPtr<DocumentOrderedMap> m_labelsByForAttribute; | 180 OwnPtr<DocumentOrderedMap> m_labelsByForAttribute; |
| 173 | 181 |
| 174 OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry; | 182 OwnPtr<IdTargetObserverRegistry> m_idTargetObserverRegistry; |
| 175 | 183 |
| 176 mutable RefPtr<DOMSelection> m_selection; | 184 mutable RefPtr<DOMSelection> m_selection; |
| 177 }; | 185 }; |
| 178 | 186 |
| 179 inline bool TreeScope::hasElementWithId(StringImpl* id) const | 187 inline bool TreeScope::hasElementWithId(StringImpl* id) const |
| 180 { | 188 { |
| 181 ASSERT(id); | 189 ASSERT(id); |
| 182 return m_elementsById && m_elementsById->contains(id); | 190 return m_elementsById && m_elementsById->contains(id); |
| 183 } | 191 } |
| 184 | 192 |
| 185 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst | 193 inline bool TreeScope::containsMultipleElementsWithId(const AtomicString& id) co
nst |
| 186 { | 194 { |
| 187 return m_elementsById && m_elementsById->containsMultiple(id.impl()); | 195 return m_elementsById && m_elementsById->containsMultiple(id.impl()); |
| 188 } | 196 } |
| 189 | 197 |
| 198 inline bool TreeScope::hasElementWithName(const AtomicString& id) const |
| 199 { |
| 200 ASSERT(id.impl()); |
| 201 return m_elementsByName && m_elementsByName->contains(id.impl()); |
| 202 } |
| 203 |
| 204 inline bool TreeScope::containsMultipleElementsWithName(const AtomicString& name
) const |
| 205 { |
| 206 ASSERT(name.impl()); |
| 207 return m_elementsByName && m_elementsByName->containsMultiple(name.impl()); |
| 208 } |
| 209 |
| 190 Node* nodeFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0); | 210 Node* nodeFromPoint(Document*, int x, int y, LayoutPoint* localPoint = 0); |
| 191 TreeScope* commonTreeScope(Node*, Node*); | 211 TreeScope* commonTreeScope(Node*, Node*); |
| 192 | 212 |
| 193 } // namespace WebCore | 213 } // namespace WebCore |
| 194 | 214 |
| 195 #endif // TreeScope_h | 215 #endif // TreeScope_h |
| OLD | NEW |