From 89db30494daae8bf10dbc5901de600c5b054bba4 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 19 Feb 2015 21:10:20 -0800 Subject: [PATCH] Remove two more uses of NodeList We now use List instead, which is more idiomatic. R=ojan@chromium.org Review URL: https://codereview.chromium.org/941913002 --- engine/core/dom/Node.cpp | 8 ++++---- engine/core/dom/Node.h | 2 +- engine/core/dom/Text.idl | 6 +----- engine/core/dom/shadow/InsertionPoint.cpp | 11 +++++------ engine/core/dom/shadow/InsertionPoint.h | 2 +- engine/core/html/HTMLContentElement.idl | 2 +- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/engine/core/dom/Node.cpp b/engine/core/dom/Node.cpp index 473ae8e5a2e..73529a49a91 100644 --- a/engine/core/dom/Node.cpp +++ b/engine/core/dom/Node.cpp @@ -1560,15 +1560,15 @@ void Node::removedLastRef() } #endif -PassRefPtr Node::getDestinationInsertionPoints() +Vector> Node::getDestinationInsertionPoints() { document().updateDistributionForNodeIfNeeded(this); Vector, 8> insertionPoints; collectDestinationInsertionPoints(*this, insertionPoints); // FIXME(sky): Is there an easier way to get this into a Vector? - Vector > nodes(insertionPoints.size()); - copyToVector(insertionPoints, nodes); - return StaticNodeList::adopt(nodes); + Vector> result(insertionPoints.size()); + copyToVector(insertionPoints, result); + return result; } void Node::setFocus(bool flag) diff --git a/engine/core/dom/Node.h b/engine/core/dom/Node.h index 4518265a991..1b9166e115e 100644 --- a/engine/core/dom/Node.h +++ b/engine/core/dom/Node.h @@ -481,7 +481,7 @@ public: void unregisterTransientMutationObserver(MutationObserverRegistration*); void notifyMutationObserversNodeWillDetach(); - PassRefPtr getDestinationInsertionPoints(); + Vector> getDestinationInsertionPoints(); void setAlreadySpellChecked(bool flag) { setFlag(flag, AlreadySpellCheckedFlag); } bool isAlreadySpellChecked() { return getFlag(AlreadySpellCheckedFlag); } diff --git a/engine/core/dom/Text.idl b/engine/core/dom/Text.idl index 116566e3ee9..518f49f8d16 100644 --- a/engine/core/dom/Text.idl +++ b/engine/core/dom/Text.idl @@ -20,10 +20,6 @@ Constructor(optional DOMString data = ""), ConstructorCallWith=Document, ] interface Text : CharacterData { - - // DOM Level 1 [RaisesException] Text splitText(unsigned long offset); - - // Shadow DOM API - NodeList getDestinationInsertionPoints(); + sequence getDestinationInsertionPoints(); }; diff --git a/engine/core/dom/shadow/InsertionPoint.cpp b/engine/core/dom/shadow/InsertionPoint.cpp index 6f5675e72b7..09d8465d0ea 100644 --- a/engine/core/dom/shadow/InsertionPoint.cpp +++ b/engine/core/dom/shadow/InsertionPoint.cpp @@ -141,16 +141,15 @@ bool InsertionPoint::isContentInsertionPoint() const return isHTMLContentElement(*this) && isActive(); } -PassRefPtr InsertionPoint::getDistributedNodes() +Vector> InsertionPoint::getDistributedNodes() { document().updateDistributionForNodeIfNeeded(this); - Vector > nodes; - nodes.reserveInitialCapacity(m_distribution.size()); + Vector > result; + result.reserveInitialCapacity(m_distribution.size()); for (size_t i = 0; i < m_distribution.size(); ++i) - nodes.uncheckedAppend(m_distribution.at(i)); - - return StaticNodeList::adopt(nodes); + result.uncheckedAppend(m_distribution.at(i)); + return result; } void InsertionPoint::childrenChanged(const ChildrenChange& change) diff --git a/engine/core/dom/shadow/InsertionPoint.h b/engine/core/dom/shadow/InsertionPoint.h index 6b86d710b49..ec1c4140d55 100644 --- a/engine/core/dom/shadow/InsertionPoint.h +++ b/engine/core/dom/shadow/InsertionPoint.h @@ -50,7 +50,7 @@ public: bool isContentInsertionPoint() const; - PassRefPtr getDistributedNodes(); + Vector> getDistributedNodes(); virtual bool canAffectSelector() const { return false; } diff --git a/engine/core/html/HTMLContentElement.idl b/engine/core/html/HTMLContentElement.idl index 15d63d6681a..a7d23687285 100644 --- a/engine/core/html/HTMLContentElement.idl +++ b/engine/core/html/HTMLContentElement.idl @@ -27,5 +27,5 @@ [ ] interface HTMLContentElement : HTMLElement { [Reflect, TreatNullAs=NullString] attribute DOMString select; - NodeList getDistributedNodes(); + sequence getDistributedNodes(); };