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* firstElement) | 71 explicit MapEntry(Element*); |
72 : element(firstElement) | |
73 , count(1) | |
74 { | |
75 } | |
76 | 72 |
77 DECLARE_TRACE(); | 73 DECLARE_TRACE(); |
78 | 74 |
79 RawPtrWillBeMember<Element> element; | 75 RawPtrWillBeMember<Element> element; |
80 unsigned count; | 76 unsigned count; |
81 WillBeHeapVector<RawPtrWillBeMember<Element>> orderedList; | 77 WillBeHeapVector<RawPtrWillBeMember<Element>> orderedList; |
82 }; | 78 }; |
83 | 79 |
84 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; | 80 using Map = WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<MapEntry>>; |
85 | 81 |
86 mutable Map m_map; | 82 mutable Map m_map; |
87 }; | 83 }; |
88 | 84 |
89 inline bool DocumentOrderedMap::contains(const AtomicString& id) const | 85 inline bool DocumentOrderedMap::contains(const AtomicString& id) const |
90 { | 86 { |
91 return m_map.contains(id); | 87 return m_map.contains(id); |
92 } | 88 } |
93 | 89 |
94 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const | 90 inline bool DocumentOrderedMap::containsMultiple(const AtomicString& id) const |
95 { | 91 { |
96 Map::const_iterator it = m_map.find(id); | 92 Map::const_iterator it = m_map.find(id); |
97 return it != m_map.end() && it->value->count > 1; | 93 return it != m_map.end() && it->value->count > 1; |
98 } | 94 } |
99 | 95 |
100 } // namespace blink | 96 } // namespace blink |
101 | 97 |
102 #endif // DocumentOrderedMap_h | 98 #endif // DocumentOrderedMap_h |
OLD | NEW |