summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/StaticNodeList.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/StaticNodeList.h')
-rw-r--r--Source/WebCore/dom/StaticNodeList.h52
1 files changed, 17 insertions, 35 deletions
diff --git a/Source/WebCore/dom/StaticNodeList.h b/Source/WebCore/dom/StaticNodeList.h
index c67ae0f17..0f1cba9fb 100644
--- a/Source/WebCore/dom/StaticNodeList.h
+++ b/Source/WebCore/dom/StaticNodeList.h
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -26,67 +26,49 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef StaticNodeList_h
-#define StaticNodeList_h
+#pragma once
#include "Element.h"
#include "NodeList.h"
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
-class StaticNodeList final : public NodeList {
+class WEBCORE_EXPORT StaticNodeList final : public NodeList {
public:
- static PassRefPtr<StaticNodeList> adopt(Vector<Ref<Node>>& nodes)
+ static Ref<StaticNodeList> create(Vector<Ref<Node>>&& nodes = { })
{
- RefPtr<StaticNodeList> nodeList = adoptRef(new StaticNodeList);
- nodeList->m_nodes.swap(nodes);
- return nodeList.release();
+ return adoptRef(*new StaticNodeList(WTFMove(nodes)));
}
- static PassRefPtr<StaticNodeList> createEmpty()
- {
- return adoptRef(new StaticNodeList);
- }
-
- virtual unsigned length() const override;
- virtual Node* item(unsigned index) const override;
- virtual Node* namedItem(const AtomicString&) const override;
+ unsigned length() const override;
+ Node* item(unsigned index) const override;
private:
- StaticNodeList() { }
+ StaticNodeList(Vector<Ref<Node>>&& nodes)
+ : m_nodes(WTFMove(nodes))
+ { }
Vector<Ref<Node>> m_nodes;
};
class StaticElementList final : public NodeList {
public:
- static PassRefPtr<StaticElementList> adopt(Vector<Ref<Element>>& elements)
+ static Ref<StaticElementList> create(Vector<Ref<Element>>&& elements = { })
{
- RefPtr<StaticElementList> nodeList = adoptRef(new StaticElementList);
- nodeList->m_elements.swap(elements);
- return nodeList.release();
+ return adoptRef(*new StaticElementList(WTFMove(elements)));
}
- static PassRefPtr<StaticElementList> createEmpty()
- {
- return adoptRef(new StaticElementList);
- }
-
- virtual unsigned length() const override;
- virtual Node* item(unsigned index) const override;
- virtual Node* namedItem(const AtomicString&) const override;
+ unsigned length() const override;
+ Element* item(unsigned index) const override;
private:
- StaticElementList()
- {
- }
+ StaticElementList(Vector<Ref<Element>>&& elements)
+ : m_elements(WTFMove(elements))
+ { }
Vector<Ref<Element>> m_elements;
};
} // namespace WebCore
-
-#endif // StaticNodeList_h