Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index 938b699358cb4b1ee4462ddaf601447788c03f0d..0d8b029156dd6b2a0045f0533f6f435f2d8d9be1 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -1537,17 +1537,17 @@ PassRefPtrWillBeRawPtr<Range> Document::createRange() |
| return Range::create(*this); |
| } |
| -PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, ExceptionState& exceptionState) |
| { |
| // FIXME: Probably this should be handled within the bindings layer and TypeError should be thrown. |
| if (!root) { |
| exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node")); |
| return nullptr; |
| } |
| - return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>()); |
| + return NodeIterator::create(root, NodeFilter::SHOW_ALL, PassRefPtrWillBeRawPtr<NodeFilter>(nullptr)); |
|
haraken
2014/05/18 08:45:48
Doesn't just 'nullptr' work? The same comment for
sof
2014/05/18 17:19:24
Yes, the compiler doesn't need our explicit guidan
|
| } |
| -PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, ExceptionState& exceptionState) |
| { |
| if (!root) { |
| exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node")); |
| @@ -1555,10 +1555,10 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT |
| } |
| // FIXME: It might be a good idea to emit a warning if |whatToShow| contains a bit that is not defined in |
| // NodeFilter. |
| - return NodeIterator::create(root, whatToShow, PassRefPtr<NodeFilter>()); |
| + return NodeIterator::create(root, whatToShow, PassRefPtrWillBeRawPtr<NodeFilter>(nullptr)); |
| } |
| -PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& exceptionState) |
| { |
| if (!root) { |
| exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node")); |
| @@ -1568,25 +1568,25 @@ PassRefPtr<NodeIterator> Document::createNodeIterator(Node* root, unsigned whatT |
| return NodeIterator::create(root, whatToShow, filter); |
| } |
| -PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, ExceptionState& exceptionState) |
| { |
| if (!root) { |
| exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node")); |
| return nullptr; |
| } |
| - return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtr<NodeFilter>()); |
| + return TreeWalker::create(root, NodeFilter::SHOW_ALL, PassRefPtrWillBeRawPtr<NodeFilter>(nullptr)); |
| } |
| -PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, ExceptionState& exceptionState) |
| { |
| if (!root) { |
| exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node")); |
| return nullptr; |
| } |
| - return TreeWalker::create(root, whatToShow, PassRefPtr<NodeFilter>()); |
| + return TreeWalker::create(root, whatToShow, PassRefPtrWillBeRawPtr<NodeFilter>(nullptr)); |
| } |
| -PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtr<NodeFilter> filter, ExceptionState& exceptionState) |
| +PassRefPtrWillBeRawPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToShow, PassRefPtrWillBeRawPtr<NodeFilter> filter, ExceptionState& exceptionState) |
| { |
| if (!root) { |
| exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::argumentNullOrIncorrectType(1, "Node")); |
| @@ -3727,9 +3727,9 @@ void Document::detachNodeIterator(NodeIterator* ni) |
| void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) |
| { |
| - HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators; |
| - HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList.end(); |
| - for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { |
| + WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> > nodeIteratorsList = m_nodeIterators; |
| + WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nodeIteratorsEnd = nodeIteratorsList.end(); |
| + for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { |
| if ((*it)->root() == node) { |
| detachNodeIterator(*it); |
| newDocument.attachNodeIterator(*it); |
| @@ -3755,8 +3755,8 @@ void Document::nodeChildrenWillBeRemoved(ContainerNode& container) |
| (*it)->nodeChildrenWillBeRemoved(container); |
| } |
| - HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = m_nodeIterators.end(); |
| - for (HashSet<NodeIterator*>::const_iterator it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) { |
| + WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nodeIteratorsEnd = m_nodeIterators.end(); |
| + for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) { |
| for (Node* n = container.firstChild(); n; n = n->nextSibling()) |
| (*it)->nodeWillBeRemoved(*n); |
| } |
| @@ -3772,8 +3772,8 @@ void Document::nodeChildrenWillBeRemoved(ContainerNode& container) |
| void Document::nodeWillBeRemoved(Node& n) |
| { |
| - HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = m_nodeIterators.end(); |
| - for (HashSet<NodeIterator*>::const_iterator it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) |
| + WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator nodeIteratorsEnd = m_nodeIterators.end(); |
| + for (WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator> >::const_iterator it = m_nodeIterators.begin(); it != nodeIteratorsEnd; ++it) |
| (*it)->nodeWillBeRemoved(n); |
| if (!m_ranges.isEmpty()) { |
| @@ -5717,6 +5717,7 @@ void Document::trace(Visitor* visitor) |
| visitor->trace(m_cssCanvasElements); |
| visitor->trace(m_topLayerElements); |
| visitor->trace(m_elemSheet); |
| + visitor->trace(m_nodeIterators); |
| visitor->trace(m_styleEngine); |
| visitor->trace(m_formController); |
| visitor->trace(m_fetcher); |