| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
| 37 #include "wtf/HashMap.h" | 37 #include "wtf/HashMap.h" |
| 38 #include "wtf/text/AtomicString.h" | 38 #include "wtf/text/AtomicString.h" |
| 39 #include "wtf/text/AtomicStringHash.h" | 39 #include "wtf/text/AtomicStringHash.h" |
| 40 #include "wtf/text/StringImpl.h" | 40 #include "wtf/text/StringImpl.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class Element; | 44 class Element; |
| 45 class HTMLSlotElement; |
| 45 class TreeScope; | 46 class TreeScope; |
| 46 | 47 |
| 47 class DocumentOrderedMap : public GarbageCollected<DocumentOrderedMap> { | 48 class DocumentOrderedMap : public GarbageCollected<DocumentOrderedMap> { |
| 48 public: | 49 public: |
| 49 static DocumentOrderedMap* create(); | 50 static DocumentOrderedMap* create(); |
| 50 | 51 |
| 51 void add(const AtomicString&, Element*); | 52 void add(const AtomicString&, Element*); |
| 52 void remove(const AtomicString&, Element*); | 53 void remove(const AtomicString&, Element*); |
| 53 | 54 |
| 54 bool contains(const AtomicString&) const; | 55 bool contains(const AtomicString&) const; |
| 55 bool containsMultiple(const AtomicString&) const; | 56 bool containsMultiple(const AtomicString&) const; |
| 56 // concrete instantiations of the get<>() method template | 57 // concrete instantiations of the get<>() method template |
| 57 Element* getElementById(const AtomicString&, const TreeScope*) const; | 58 Element* getElementById(const AtomicString&, const TreeScope*) const; |
| 58 const HeapVector<Member<Element>>& getAllElementsById(const AtomicString&, c
onst TreeScope*) const; | 59 const HeapVector<Member<Element>>& getAllElementsById(const AtomicString&, c
onst TreeScope*) const; |
| 59 Element* getElementByMapName(const AtomicString&, const TreeScope*) const; | 60 Element* getElementByMapName(const AtomicString&, const TreeScope*) const; |
| 61 HTMLSlotElement* getSlotByName(const AtomicString&, const TreeScope*) const; |
| 60 Element* getElementByLowercasedMapName(const AtomicString&, const TreeScope*
) const; | 62 Element* getElementByLowercasedMapName(const AtomicString&, const TreeScope*
) const; |
| 61 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope*
) const; | 63 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope*
) const; |
| 62 | 64 |
| 63 DECLARE_TRACE(); | 65 DECLARE_TRACE(); |
| 64 | 66 |
| 65 #if DCHECK_IS_ON() | 67 #if DCHECK_IS_ON() |
| 66 // While removing a ContainerNode, ID lookups won't be precise should the tr
ee | 68 // While removing a ContainerNode, ID lookups won't be precise should the tr
ee |
| 67 // have elements with duplicate IDs contained in the element being removed. | 69 // have elements with duplicate IDs contained in the element being removed. |
| 68 // Rare trees, but ID lookups may legitimately fail across such removals; | 70 // Rare trees, but ID lookups may legitimately fail across such removals; |
| 69 // this scope object informs DocumentOrderedMaps about the transitory | 71 // this scope object informs DocumentOrderedMaps about the transitory |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 118 |
| 117 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const | 119 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const |
| 118 { | 120 { |
| 119 Map::const_iterator it = m_map.find(id); | 121 Map::const_iterator it = m_map.find(id); |
| 120 return it != m_map.end() && it->value->count > 1; | 122 return it != m_map.end() && it->value->count > 1; |
| 121 } | 123 } |
| 122 | 124 |
| 123 } // namespace blink | 125 } // namespace blink |
| 124 | 126 |
| 125 #endif // DocumentOrderedMap_h | 127 #endif // DocumentOrderedMap_h |
| OLD | NEW |