diff options
Diffstat (limited to 'Source/WebCore/xml/XPathNodeSet.h')
-rw-r--r-- | Source/WebCore/xml/XPathNodeSet.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/WebCore/xml/XPathNodeSet.h b/Source/WebCore/xml/XPathNodeSet.h index 459fcf3c4..6ea91b904 100644 --- a/Source/WebCore/xml/XPathNodeSet.h +++ b/Source/WebCore/xml/XPathNodeSet.h @@ -11,10 +11,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -24,19 +24,19 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef XPathNodeSet_h -#define XPathNodeSet_h +#pragma once #include "Node.h" namespace WebCore { - namespace XPath { class NodeSet { public: NodeSet() : m_isSorted(true), m_subtreesAreDisjoint(false) { } - explicit NodeSet(PassRefPtr<Node> node) : m_isSorted(true), m_subtreesAreDisjoint(false), m_nodes(1, node) { } + explicit NodeSet(RefPtr<Node>&& node) + : m_isSorted(true), m_subtreesAreDisjoint(false), m_nodes(1, WTFMove(node)) + { } size_t size() const { return m_nodes.size(); } bool isEmpty() const { return m_nodes.isEmpty(); } @@ -45,7 +45,7 @@ namespace WebCore { void clear() { m_nodes.clear(); } // NodeSet itself does not verify that nodes in it are unique. - void append(PassRefPtr<Node> node) { m_nodes.append(node); } + void append(RefPtr<Node>&& node) { m_nodes.append(WTFMove(node)); } void append(const NodeSet& nodeSet) { m_nodes.appendVector(nodeSet.m_nodes); } // Returns the set's first node in document order, or nullptr if the set is empty. @@ -64,6 +64,9 @@ namespace WebCore { void markSubtreesDisjoint(bool disjoint) { m_subtreesAreDisjoint = disjoint; } bool subtreesAreDisjoint() const { return m_subtreesAreDisjoint || m_nodes.size() < 2; } + const RefPtr<Node>* begin() const { return m_nodes.begin(); } + const RefPtr<Node>* end() const { return m_nodes.end(); } + private: void traversalSort() const; @@ -72,7 +75,5 @@ namespace WebCore { mutable Vector<RefPtr<Node>> m_nodes; }; - } -} - -#endif // XPathNodeSet_h + } // namespace XPath +} // namespace WebCore |