Title: [188754] trunk/Source/WebCore
Revision
188754
Author
[email protected]
Date
2015-08-21 09:05:20 -0700 (Fri, 21 Aug 2015)

Log Message

Have more getElementsBy*() methods return a Ref<>
https://bugs.webkit.org/show_bug.cgi?id=148287

Reviewed by Sam Weinig.

Have more getElementsBy*() methods return a Ref<> instaed of a RefPtr<>
as they cannot return null.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::getElementsByTagName):
(WebCore::ContainerNode::getElementsByTagNameNS):
(WebCore::ContainerNode::getElementsByName):
(WebCore::ContainerNode::getElementsByClassName):
(WebCore::ContainerNode::getElementsByClassNameForObjC):
(WebCore::ContainerNode::radioNodeList):
* dom/ContainerNode.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (188753 => 188754)


--- trunk/Source/WebCore/ChangeLog	2015-08-21 08:28:07 UTC (rev 188753)
+++ trunk/Source/WebCore/ChangeLog	2015-08-21 16:05:20 UTC (rev 188754)
@@ -1,5 +1,24 @@
 2015-08-21  Chris Dumez  <[email protected]>
 
+        Have more getElementsBy*() methods return a Ref<>
+        https://bugs.webkit.org/show_bug.cgi?id=148287
+
+        Reviewed by Sam Weinig.
+
+        Have more getElementsBy*() methods return a Ref<> instaed of a RefPtr<>
+        as they cannot return null.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::getElementsByTagName):
+        (WebCore::ContainerNode::getElementsByTagNameNS):
+        (WebCore::ContainerNode::getElementsByName):
+        (WebCore::ContainerNode::getElementsByClassName):
+        (WebCore::ContainerNode::getElementsByClassNameForObjC):
+        (WebCore::ContainerNode::radioNodeList):
+        * dom/ContainerNode.h:
+
+2015-08-21  Chris Dumez  <[email protected]>
+
         Drop NodeListBase class
         https://bugs.webkit.org/show_bug.cgi?id=148290
 

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (188753 => 188754)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2015-08-21 08:28:07 UTC (rev 188753)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2015-08-21 16:05:20 UTC (rev 188754)
@@ -867,7 +867,7 @@
 RefPtr<NodeList> ContainerNode::getElementsByTagName(const AtomicString& localName)
 {
     if (localName.isNull())
-        return 0;
+        return nullptr;
 
     if (document().isHTMLDocument())
         return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTagNodeList>(*this, localName);
@@ -877,7 +877,7 @@
 RefPtr<NodeList> ContainerNode::getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName)
 {
     if (localName.isNull())
-        return 0;
+        return nullptr;
 
     if (namespaceURI == starAtom)
         return getElementsByTagName(localName);
@@ -885,22 +885,22 @@
     return ensureRareData().ensureNodeLists().addCacheWithQualifiedName(*this, namespaceURI.isEmpty() ? nullAtom : namespaceURI, localName);
 }
 
-RefPtr<NodeList> ContainerNode::getElementsByName(const String& elementName)
+Ref<NodeList> ContainerNode::getElementsByName(const String& elementName)
 {
     return ensureRareData().ensureNodeLists().addCacheWithAtomicName<NameNodeList>(*this, elementName);
 }
 
-RefPtr<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicString& classNames)
+Ref<HTMLCollection> ContainerNode::getElementsByClassName(const AtomicString& classNames)
 {
     return ensureRareData().ensureNodeLists().addCachedCollection<ClassCollection>(*this, ByClass, classNames);
 }
 
-RefPtr<NodeList> ContainerNode::getElementsByClassNameForObjC(const AtomicString& classNames)
+Ref<NodeList> ContainerNode::getElementsByClassNameForObjC(const AtomicString& classNames)
 {
     return getElementsByClassName(classNames);
 }
 
-RefPtr<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name)
+Ref<RadioNodeList> ContainerNode::radioNodeList(const AtomicString& name)
 {
     ASSERT(hasTagName(HTMLNames::formTag) || hasTagName(HTMLNames::fieldsetTag));
     return ensureRareData().ensureNodeLists().addCacheWithAtomicName<RadioNodeList>(*this, name);

Modified: trunk/Source/WebCore/dom/ContainerNode.h (188753 => 188754)


--- trunk/Source/WebCore/dom/ContainerNode.h	2015-08-21 08:28:07 UTC (rev 188753)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2015-08-21 16:05:20 UTC (rev 188754)
@@ -145,10 +145,10 @@
 
     RefPtr<NodeList> getElementsByTagName(const AtomicString&);
     RefPtr<NodeList> getElementsByTagNameNS(const AtomicString& namespaceURI, const AtomicString& localName);
-    RefPtr<NodeList> getElementsByName(const String& elementName);
-    RefPtr<HTMLCollection> getElementsByClassName(const AtomicString& classNames);
-    RefPtr<NodeList> getElementsByClassNameForObjC(const AtomicString& classNames);
-    RefPtr<RadioNodeList> radioNodeList(const AtomicString&);
+    Ref<NodeList> getElementsByName(const String& elementName);
+    Ref<HTMLCollection> getElementsByClassName(const AtomicString& classNames);
+    Ref<NodeList> getElementsByClassNameForObjC(const AtomicString& classNames);
+    Ref<RadioNodeList> radioNodeList(const AtomicString&);
 
     // From the ParentNode interface - https://dom.spec.whatwg.org/#interface-parentnode
     Ref<HTMLCollection> children();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to