Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: Source/core/dom/DocumentOrderedMap.cpp

Issue 459203004: Have DocumentOrderedMap API deal with AtomicString type instead of StringImpl* (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/DocumentOrderedMap.h ('k') | Source/core/dom/TreeScope.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DocumentOrderedMap.cpp
diff --git a/Source/core/dom/DocumentOrderedMap.cpp b/Source/core/dom/DocumentOrderedMap.cpp
index ec815e16f206174c33644d56fb7a6253cbe9673e..604549b089a44301fd4ded709357be32c5879e29 100644
--- a/Source/core/dom/DocumentOrderedMap.cpp
+++ b/Source/core/dom/DocumentOrderedMap.cpp
@@ -41,24 +41,24 @@ namespace blink {
using namespace HTMLNames;
-inline bool keyMatchesId(StringImpl* key, Element& element)
+inline bool keyMatchesId(const AtomicString& key, const Element& element)
{
- return element.getIdAttribute().impl() == key;
+ return element.getIdAttribute() == key;
}
-inline bool keyMatchesMapName(StringImpl* key, Element& element)
+inline bool keyMatchesMapName(const AtomicString& key, const Element& element)
{
- return isHTMLMapElement(element) && toHTMLMapElement(element).getName().impl() == key;
+ return isHTMLMapElement(element) && toHTMLMapElement(element).getName() == key;
}
-inline bool keyMatchesLowercasedMapName(StringImpl* key, Element& element)
+inline bool keyMatchesLowercasedMapName(const AtomicString& key, const Element& element)
{
- return isHTMLMapElement(element) && toHTMLMapElement(element).getName().lower().impl() == key;
+ return isHTMLMapElement(element) && toHTMLMapElement(element).getName().lower() == key;
}
-inline bool keyMatchesLabelForAttribute(StringImpl* key, Element& element)
+inline bool keyMatchesLabelForAttribute(const AtomicString& key, const Element& element)
{
- return isHTMLLabelElement(element) && element.getAttribute(forAttr).impl() == key;
+ return isHTMLLabelElement(element) && element.getAttribute(forAttr) == key;
}
PassOwnPtrWillBeRawPtr<DocumentOrderedMap> DocumentOrderedMap::create()
@@ -66,12 +66,12 @@ PassOwnPtrWillBeRawPtr<DocumentOrderedMap> DocumentOrderedMap::create()
return adoptPtrWillBeNoop(new DocumentOrderedMap());
}
-void DocumentOrderedMap::add(StringImpl* key, Element* element)
+void DocumentOrderedMap::add(const AtomicString& key, Element* element)
{
ASSERT(key);
ASSERT(element);
- Map::AddResult addResult = m_map.add(key, adoptPtrWillBeNoop(new MapEntry(element)));
+ Map::AddResult addResult = m_map.add(key.impl(), adoptPtrWillBeNoop(new MapEntry(element)));
if (addResult.isNewEntry)
return;
@@ -82,12 +82,12 @@ void DocumentOrderedMap::add(StringImpl* key, Element* element)
entry->orderedList.clear();
}
-void DocumentOrderedMap::remove(StringImpl* key, Element* element)
+void DocumentOrderedMap::remove(const AtomicString& key, Element* element)
{
ASSERT(key);
ASSERT(element);
- Map::iterator it = m_map.find(key);
+ Map::iterator it = m_map.find(key.impl());
if (it == m_map.end())
return;
@@ -106,13 +106,13 @@ void DocumentOrderedMap::remove(StringImpl* key, Element* element)
}
}
-template<bool keyMatches(StringImpl*, Element&)>
-inline Element* DocumentOrderedMap::get(StringImpl* key, const TreeScope* scope) const
+template<bool keyMatches(const AtomicString&, const Element&)>
+inline Element* DocumentOrderedMap::get(const AtomicString& key, const TreeScope* scope) const
{
ASSERT(key);
ASSERT(scope);
- MapEntry* entry = m_map.get(key);
+ MapEntry* entry = m_map.get(key.impl());
if (!entry)
return 0;
@@ -131,18 +131,18 @@ inline Element* DocumentOrderedMap::get(StringImpl* key, const TreeScope* scope)
return 0;
}
-Element* DocumentOrderedMap::getElementById(StringImpl* key, const TreeScope* scope) const
+Element* DocumentOrderedMap::getElementById(const AtomicString& key, const TreeScope* scope) const
{
return get<keyMatchesId>(key, scope);
}
-const WillBeHeapVector<RawPtrWillBeMember<Element> >& DocumentOrderedMap::getAllElementsById(StringImpl* key, const TreeScope* scope) const
+const WillBeHeapVector<RawPtrWillBeMember<Element> >& DocumentOrderedMap::getAllElementsById(const AtomicString& key, const TreeScope* scope) const
{
ASSERT(key);
ASSERT(scope);
DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<WillBeHeapVector<RawPtrWillBeMember<Element> > >, emptyVector, (adoptPtrWillBeNoop(new WillBeHeapVector<RawPtrWillBeMember<Element> >())));
- Map::iterator it = m_map.find(key);
+ Map::iterator it = m_map.find(key.impl());
if (it == m_map.end())
return *emptyVector;
@@ -164,17 +164,17 @@ const WillBeHeapVector<RawPtrWillBeMember<Element> >& DocumentOrderedMap::getAll
return entry->orderedList;
}
-Element* DocumentOrderedMap::getElementByMapName(StringImpl* key, const TreeScope* scope) const
+Element* DocumentOrderedMap::getElementByMapName(const AtomicString& key, const TreeScope* scope) const
{
return get<keyMatchesMapName>(key, scope);
}
-Element* DocumentOrderedMap::getElementByLowercasedMapName(StringImpl* key, const TreeScope* scope) const
+Element* DocumentOrderedMap::getElementByLowercasedMapName(const AtomicString& key, const TreeScope* scope) const
{
return get<keyMatchesLowercasedMapName>(key, scope);
}
-Element* DocumentOrderedMap::getElementByLabelForAttribute(StringImpl* key, const TreeScope* scope) const
+Element* DocumentOrderedMap::getElementByLabelForAttribute(const AtomicString& key, const TreeScope* scope) const
{
return get<keyMatchesLabelForAttribute>(key, scope);
}
« no previous file with comments | « Source/core/dom/DocumentOrderedMap.h ('k') | Source/core/dom/TreeScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698