| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope*
) const; | 61 Element* getElementByLabelForAttribute(const AtomicString&, const TreeScope*
) const; |
| 62 | 62 |
| 63 DECLARE_TRACE(); | 63 DECLARE_TRACE(); |
| 64 | 64 |
| 65 private: | 65 private: |
| 66 template<bool keyMatches(const AtomicString&, const Element&)> | 66 template<bool keyMatches(const AtomicString&, const Element&)> |
| 67 Element* get(const AtomicString&, const TreeScope*) const; | 67 Element* get(const AtomicString&, const TreeScope*) const; |
| 68 | 68 |
| 69 class MapEntry : public NoBaseWillBeGarbageCollected<MapEntry> { | 69 class MapEntry : public NoBaseWillBeGarbageCollected<MapEntry> { |
| 70 public: | 70 public: |
| 71 explicit MapEntry(Element*); | 71 explicit MapEntry(Element* firstElement) |
| 72 : element(firstElement) |
| 73 , count(1) |
| 74 { |
| 75 } |
| 72 | 76 |
| 73 DECLARE_TRACE(); | 77 DECLARE_TRACE(); |
| 74 | 78 |
| 75 RawPtrWillBeMember<Element> element; | 79 RawPtrWillBeMember<Element> element; |
| 76 unsigned count; | 80 unsigned count; |
| 77 WillBeHeapVector<RawPtrWillBeMember<Element>> orderedList; | 81 WillBeHeapVector<RawPtrWillBeMember<Element>> orderedList; |
| 78 }; | 82 }; |
| 79 | 83 |
| 80 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; | 84 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; |
| 81 | 85 |
| 82 mutable Map m_map; | 86 mutable Map m_map; |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 inline bool DocumentOrderedMap::contains(const AtomicString& id) const | 89 inline bool DocumentOrderedMap::contains(const AtomicString& id) const |
| 86 { | 90 { |
| 87 return m_map.contains(id); | 91 return m_map.contains(id); |
| 88 } | 92 } |
| 89 | 93 |
| 90 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const | 94 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const |
| 91 { | 95 { |
| 92 Map::const_iterator it = m_map.find(id); | 96 Map::const_iterator it = m_map.find(id); |
| 93 return it != m_map.end() && it->value->count > 1; | 97 return it != m_map.end() && it->value->count > 1; |
| 94 } | 98 } |
| 95 | 99 |
| 96 } // namespace blink | 100 } // namespace blink |
| 97 | 101 |
| 98 #endif // DocumentOrderedMap_h | 102 #endif // DocumentOrderedMap_h |
| OLD | NEW |