summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/DocumentOrderedMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/DocumentOrderedMap.h')
-rw-r--r--Source/WebCore/dom/DocumentOrderedMap.h26
1 files changed, 12 insertions, 14 deletions
diff --git a/Source/WebCore/dom/DocumentOrderedMap.h b/Source/WebCore/dom/DocumentOrderedMap.h
index 221297bdd..46a5106ef 100644
--- a/Source/WebCore/dom/DocumentOrderedMap.h
+++ b/Source/WebCore/dom/DocumentOrderedMap.h
@@ -28,11 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DocumentOrderedMap_h
-#define DocumentOrderedMap_h
+#pragma once
-#include <wtf/HashCountedSet.h>
#include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomicStringImpl.h>
@@ -45,6 +44,7 @@ class HTMLMapElement;
class TreeScope;
class DocumentOrderedMap {
+ WTF_MAKE_FAST_ALLOCATED;
public:
void add(const AtomicStringImpl&, Element&, const TreeScope&);
void remove(const AtomicStringImpl&, Element&);
@@ -58,8 +58,7 @@ public:
Element* getElementById(const AtomicStringImpl&, const TreeScope&) const;
Element* getElementByName(const AtomicStringImpl&, const TreeScope&) const;
HTMLMapElement* getElementByMapName(const AtomicStringImpl&, const TreeScope&) const;
- HTMLMapElement* getElementByLowercasedMapName(const AtomicStringImpl&, const TreeScope&) const;
- HTMLImageElement* getElementByLowercasedUsemap(const AtomicStringImpl&, const TreeScope&) const;
+ HTMLImageElement* getElementByUsemap(const AtomicStringImpl&, const TreeScope&) const;
HTMLLabelElement* getElementByLabelForAttribute(const AtomicStringImpl&, const TreeScope&) const;
Element* getElementByWindowNamedItem(const AtomicStringImpl&, const TreeScope&) const;
Element* getElementByDocumentNamedItem(const AtomicStringImpl&, const TreeScope&) const;
@@ -67,21 +66,22 @@ public:
const Vector<Element*>* getAllElementsById(const AtomicStringImpl&, const TreeScope&) const;
private:
- template<bool keyMatches(const AtomicStringImpl&, const Element&)> Element* get(const AtomicStringImpl&, const TreeScope&) const;
+ template <typename KeyMatchingFunction>
+ Element* get(const AtomicStringImpl&, const TreeScope&, const KeyMatchingFunction&) const;
struct MapEntry {
- MapEntry()
- : element(0)
- , count(0)
- { }
+ MapEntry() { }
explicit MapEntry(Element* firstElement)
: element(firstElement)
, count(1)
{ }
- Element* element;
- unsigned count;
+ Element* element { nullptr };
+ unsigned count { 0 };
Vector<Element*> orderedList;
+#if !ASSERT_DISABLED || ENABLE(SECURITY_ASSERTIONS)
+ HashSet<Element*> registeredElements;
+#endif
};
typedef HashMap<const AtomicStringImpl*, MapEntry> Map;
@@ -107,5 +107,3 @@ inline bool DocumentOrderedMap::containsMultiple(const AtomicStringImpl& id) con
}
} // namespace WebCore
-
-#endif // DocumentOrderedMap_h