Index: third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp |
diff --git a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp |
index 5c7822bdec370e816a0b651ba83bc0b9553c927e..a7c01b5f2068fbf7ea498320fd37924269d3aa6e 100644 |
--- a/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp |
+++ b/third_party/WebKit/Source/core/dom/DocumentOrderedMap.cpp |
@@ -35,6 +35,7 @@ |
#include "core/dom/ElementTraversal.h" |
#include "core/dom/TreeScope.h" |
#include "core/html/HTMLMapElement.h" |
+#include "core/html/HTMLSlotElement.h" |
namespace blink { |
@@ -75,6 +76,11 @@ inline bool keyMatchesMapName(const AtomicString& key, const Element& element) |
return isHTMLMapElement(element) && toHTMLMapElement(element).getName() == key; |
} |
+inline bool keyMatchesSlotName(const AtomicString& key, const Element& element) |
+{ |
+ return isHTMLSlotElement(element) && toHTMLSlotElement(element).name() == key; |
+} |
+ |
inline bool keyMatchesLowercasedMapName(const AtomicString& key, const Element& element) |
{ |
return isHTMLMapElement(element) && toHTMLMapElement(element).getName().lower() == key; |
@@ -195,6 +201,16 @@ Element* DocumentOrderedMap::getElementByMapName(const AtomicString& key, const |
return get<keyMatchesMapName>(key, scope); |
} |
+// TODO(hayato): Template get<> by return type. |
+HTMLSlotElement* DocumentOrderedMap::getSlotByName(const AtomicString& key, const TreeScope* scope) const |
+{ |
+ if (Element* slot = get<keyMatchesSlotName>(key, scope)) { |
+ DCHECK(isHTMLSlotElement(slot)); |
+ return toHTMLSlotElement(slot); |
+ } |
+ return nullptr; |
+} |
+ |
Element* DocumentOrderedMap::getElementByLowercasedMapName(const AtomicString& key, const TreeScope* scope) const |
{ |
return get<keyMatchesLowercasedMapName>(key, scope); |