Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
https://bugs.webkit.org/show_bug.cgi?id=136902

Reviewed by Darin Adler.

Have LiveNodeLists / HTMLCollections's elementMatches() take a reference
in argument instead of a pointer as the Element can never be null.

No new tests, no behavior change.

* dom/ClassNodeList.h:
(WebCore::ClassNodeList::elementMatches):
* dom/DocumentOrderedMap.cpp:
(WebCore::keyMatchesWindowNamedItem):
(WebCore::keyMatchesDocumentNamedItem):
* dom/Element.cpp:
(WebCore::Element::updateNameForDocument):
(WebCore::Element::updateIdForDocument):
* dom/LiveNodeList.cpp:
(WebCore::LiveNodeList::namedItem):
* dom/LiveNodeList.h:
(WebCore::CachedLiveNodeList<NodeListType>::collectionBegin):
(WebCore::CachedLiveNodeList<NodeListType>::collectionLast):
(WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseForward):
(WebCore::CachedLiveNodeList<NodeListType>::collectionTraverseBackward):
* dom/NameNodeList.h:
(WebCore::NameNodeList::elementMatches):
* dom/TagNodeList.h:
(WebCore::TagNodeList::elementMatches):
(WebCore::HTMLTagNodeList::elementMatches):
* html/HTMLCollection.cpp:
(WebCore::isMatchingElement):
* html/HTMLNameCollection.cpp:
(WebCore::WindowNameCollection::elementMatchesIfNameAttributeMatch):
(WebCore::WindowNameCollection::elementMatches):
(WebCore::DocumentNameCollection::elementMatchesIfIdAttributeMatch):
(WebCore::DocumentNameCollection::elementMatchesIfNameAttributeMatch):
(WebCore::DocumentNameCollection::elementMatches):
* html/HTMLNameCollection.h:
* html/LabelsNodeList.cpp:
(WebCore::LabelsNodeList::elementMatches):
* html/LabelsNodeList.h:
* html/RadioNodeList.cpp:
(WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter):
(WebCore::RadioNodeList::elementMatches):
* html/RadioNodeList.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/dom/ClassNodeList.h b/Source/WebCore/dom/ClassNodeList.h
index df9e900..9332623 100644
--- a/Source/WebCore/dom/ClassNodeList.h
+++ b/Source/WebCore/dom/ClassNodeList.h
@@ -43,7 +43,7 @@
 
     virtual ~ClassNodeList();
 
-    virtual bool elementMatches(Element*) const override;
+    virtual bool elementMatches(Element&) const override;
     virtual bool isRootedAtDocument() const override { return false; }
 
 private:
@@ -60,17 +60,17 @@
 {
 }
 
-inline bool ClassNodeList::elementMatches(Element* element) const
+inline bool ClassNodeList::elementMatches(Element& element) const
 {
-    if (!element->hasClass())
+    if (!element.hasClass())
         return false;
     if (!m_classNames.size())
         return false;
     // FIXME: DOM4 allows getElementsByClassName to return non StyledElement.
     // https://bugs.webkit.org/show_bug.cgi?id=94718
-    if (!element->isStyledElement())
+    if (!element.isStyledElement())
         return false;
-    return element->classNames().containsAll(m_classNames);
+    return element.classNames().containsAll(m_classNames);
 }
 
 } // namespace WebCore