Back out changeset 1c851a5bbc9f (bug 838686) because it depends on a changeset gcc doesn't like

This commit is contained in:
Boris Zbarsky 2013-02-26 15:34:25 -05:00
Родитель 1029c5c255
Коммит da7352fc49
10 изменённых файлов: 29 добавлений и 88 удалений

Просмотреть файл

@ -95,13 +95,9 @@ class Element;
class GlobalObject;
class HTMLBodyElement;
class Link;
class NodeFilter;
class ProcessingInstruction;
class UndoManager;
template<typename> class Sequence;
template<typename, typename> class CallbackObjectHolder;
typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
} // namespace dom
} // namespace mozilla
@ -1923,19 +1919,10 @@ public:
already_AddRefed<nsRange> CreateRange(mozilla::ErrorResult& rv);
already_AddRefed<nsIDOMNodeIterator>
CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
mozilla::dom::NodeFilter* aFilter,
mozilla::ErrorResult& rv) const;
already_AddRefed<nsIDOMNodeIterator>
CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder& aFilter,
mozilla::ErrorResult& rv) const;
nsIDOMNodeFilter* aFilter, mozilla::ErrorResult& rv) const;
already_AddRefed<nsIDOMTreeWalker>
CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
mozilla::dom::NodeFilter* aFilter, mozilla::ErrorResult& rv) const;
already_AddRefed<nsIDOMTreeWalker>
CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder& aFilter,
mozilla::ErrorResult& rv) const;
nsIDOMNodeFilter* aFilter, mozilla::ErrorResult& rv) const;
// Deprecated WebIDL bits
already_AddRefed<mozilla::dom::CDATASection>

Просмотреть файл

@ -184,7 +184,6 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/UndoManager.h"
#include "nsFrame.h"
#include "nsDOMCaretPosition.h"
@ -5355,28 +5354,14 @@ nsDocument::CreateNodeIterator(nsIDOMNode *aRoot,
NS_ENSURE_TRUE(root, NS_ERROR_UNEXPECTED);
ErrorResult rv;
NodeFilterHolder holder(aFilter);
*_retval = nsIDocument::CreateNodeIterator(*root, aWhatToShow, holder,
*_retval = nsIDocument::CreateNodeIterator(*root, aWhatToShow, aFilter,
rv).get();
return rv.ErrorCode();
}
already_AddRefed<nsIDOMNodeIterator>
nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
NodeFilter* aFilter,
mozilla::ErrorResult& rv) const
{
NodeFilterHolder holder(aFilter);
// We don't really know how to handle WebIDL callbacks yet, in
// nsTraversal, so just go ahead and convert to an XPCOM callback.
nsCOMPtr<nsIDOMNodeFilter> filter = holder.ToXPCOMCallback();
NodeFilterHolder holder2(filter);
return CreateNodeIterator(aRoot, aWhatToShow, holder2, rv);
}
already_AddRefed<nsIDOMNodeIterator>
nsIDocument::CreateNodeIterator(nsINode& aRoot, uint32_t aWhatToShow,
const NodeFilterHolder& aFilter,
nsIDOMNodeFilter* aFilter,
mozilla::ErrorResult& rv) const
{
nsINode* root = &aRoot;
@ -5408,28 +5393,14 @@ nsDocument::CreateTreeWalker(nsIDOMNode *aRoot,
NS_ENSURE_TRUE(root, NS_ERROR_DOM_NOT_SUPPORTED_ERR);
ErrorResult rv;
NodeFilterHolder holder(aFilter);
*_retval = nsIDocument::CreateTreeWalker(*root, aWhatToShow, holder,
*_retval = nsIDocument::CreateTreeWalker(*root, aWhatToShow, aFilter,
rv).get();
return rv.ErrorCode();
}
already_AddRefed<nsIDOMTreeWalker>
nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
NodeFilter* aFilter,
mozilla::ErrorResult& rv) const
{
NodeFilterHolder holder(aFilter);
// We don't really know how to handle WebIDL callbacks yet, in
// nsTraversal, so just go ahead and convert to an XPCOM callback.
nsCOMPtr<nsIDOMNodeFilter> filter = holder.ToXPCOMCallback();
NodeFilterHolder holder2(filter);
return CreateTreeWalker(aRoot, aWhatToShow, holder2, rv);
}
already_AddRefed<nsIDOMTreeWalker>
nsIDocument::CreateTreeWalker(nsINode& aRoot, uint32_t aWhatToShow,
const NodeFilterHolder& aFilter,
nsIDOMNodeFilter* aFilter,
mozilla::ErrorResult& rv) const
{
nsINode* root = &aRoot;

Просмотреть файл

@ -19,9 +19,6 @@
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/NodeFilterBinding.h"
using namespace mozilla::dom;
/*
* NodePointer implementation
@ -140,7 +137,7 @@ void nsNodeIterator::NodePointer::MoveBackward(nsINode *aParent, nsINode *aNode)
nsNodeIterator::nsNodeIterator(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
nsIDOMNodeFilter *aFilter) :
nsTraversal(aRoot, aWhatToShow, aFilter),
mDetached(false),
mPointer(mRoot, true)
@ -206,7 +203,7 @@ NS_IMETHODIMP nsNodeIterator::GetFilter(nsIDOMNodeFilter **aFilter)
{
NS_ENSURE_ARG_POINTER(aFilter);
*aFilter = mFilter.ToXPCOMCallback().get();
NS_IF_ADDREF(*aFilter = mFilter);
return NS_OK;
}

Просмотреть файл

@ -30,7 +30,7 @@ public:
nsNodeIterator(nsINode *aRoot,
uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder &aFilter);
nsIDOMNodeFilter *aFilter);
virtual ~nsNodeIterator();
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED

Просмотреть файл

@ -10,17 +10,12 @@
#include "nsIDOMNodeFilter.h"
#include "nsError.h"
#include "nsINode.h"
#include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/AutoRestore.h"
#include "nsGkAtoms.h"
using namespace mozilla;
using namespace mozilla::dom;
nsTraversal::nsTraversal(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
nsIDOMNodeFilter *aFilter) :
mRoot(aRoot),
mWhatToShow(aWhatToShow),
mFilter(aFilter),
@ -45,6 +40,8 @@ nsresult nsTraversal::TestNode(nsINode* aNode, int16_t* _filtered)
{
NS_ENSURE_TRUE(!mInAcceptNode, NS_ERROR_DOM_INVALID_STATE_ERR);
nsresult rv;
*_filtered = nsIDOMNodeFilter::FILTER_SKIP;
uint16_t nodeType = aNode->NodeType();
@ -53,22 +50,14 @@ nsresult nsTraversal::TestNode(nsINode* aNode, int16_t* _filtered)
return NS_OK;
}
if (!mFilter.GetISupports()) {
// No filter, just accept
*_filtered = nsIDOMNodeFilter::FILTER_ACCEPT;
return NS_OK;
}
if (mFilter.HasWebIDLCallback()) {
AutoRestore<bool> inAcceptNode(mInAcceptNode);
if (mFilter) {
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
mInAcceptNode = true;
ErrorResult res;
*_filtered = mFilter.GetWebIDLCallback()->AcceptNode(*aNode, res);
return res.ErrorCode();
rv = mFilter->AcceptNode(domNode, _filtered);
mInAcceptNode = false;
return rv;
}
nsCOMPtr<nsIDOMNode> domNode = do_QueryInterface(aNode);
AutoRestore<bool> inAcceptNode(mInAcceptNode);
mInAcceptNode = true;
return mFilter.GetXPCOMCallback()->AcceptNode(domNode, _filtered);
*_filtered = nsIDOMNodeFilter::FILTER_ACCEPT;
return NS_OK;
}

Просмотреть файл

@ -12,8 +12,6 @@
#define nsTraversal_h___
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "mozilla/dom/CallbackObject.h"
class nsINode;
class nsIDOMNodeFilter;
@ -23,13 +21,13 @@ class nsTraversal
public:
nsTraversal(nsINode *aRoot,
uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder &aFilter);
nsIDOMNodeFilter *aFilter);
virtual ~nsTraversal();
protected:
nsCOMPtr<nsINode> mRoot;
uint32_t mWhatToShow;
mozilla::dom::NodeFilterHolder mFilter;
nsCOMPtr<nsIDOMNodeFilter> mFilter;
bool mInAcceptNode;
/*

Просмотреть файл

@ -16,9 +16,6 @@
#include "nsINode.h"
#include "nsDOMClassInfoID.h"
#include "nsContentUtils.h"
#include "mozilla/dom/NodeFilterBinding.h"
using namespace mozilla::dom;
/*
* Factories, constructors and destructors
@ -26,7 +23,7 @@ using namespace mozilla::dom;
nsTreeWalker::nsTreeWalker(nsINode *aRoot,
uint32_t aWhatToShow,
const NodeFilterHolder &aFilter) :
nsIDOMNodeFilter *aFilter) :
nsTraversal(aRoot, aWhatToShow, aFilter),
mCurrentNode(aRoot)
{
@ -85,7 +82,7 @@ NS_IMETHODIMP nsTreeWalker::GetFilter(nsIDOMNodeFilter * *aFilter)
{
NS_ENSURE_ARG_POINTER(aFilter);
*aFilter = mFilter.ToXPCOMCallback().get();
NS_IF_ADDREF(*aFilter = mFilter);
return NS_OK;
}

Просмотреть файл

@ -29,7 +29,7 @@ public:
nsTreeWalker(nsINode *aRoot,
uint32_t aWhatToShow,
const mozilla::dom::NodeFilterHolder &aFilter);
nsIDOMNodeFilter *aFilter);
virtual ~nsTreeWalker();
NS_DECL_CYCLE_COLLECTION_CLASS(nsTreeWalker)

Просмотреть файл

@ -2624,6 +2624,7 @@ for (uint32_t i = 0; i < length; ++i) {
type.unroll().inner.identifier.name)
if (descriptor.interface.isCallback() and
descriptor.interface.identifier.name != "NodeFilter" and
descriptor.interface.identifier.name != "EventListener"):
if descriptor.workers:
if type.nullable():
@ -3469,7 +3470,8 @@ if (!returnArray) {
if (type.isGeckoInterface() and
(not type.isCallbackInterface() or
type.unroll().inner.identifier.name == "EventListener")):
type.unroll().inner.identifier.name == "EventListener" or
type.unroll().inner.identifier.name == "NodeFilter")):
descriptor = descriptorProvider.getDescriptor(type.unroll().inner.identifier.name)
if type.nullable():
wrappingCode = ("if (!%s) {\n" % (result) +
@ -7462,6 +7464,7 @@ class CGNativeMember(ClassMethod):
if (type.isGeckoInterface() and
(not type.isCallbackInterface() or
type.unroll().inner.identifier.name == "NodeFilter" or
type.unroll().inner.identifier.name == "EventListener")):
iface = type.unroll().inner
argIsPointer = type.nullable() or iface.isExternal()

Просмотреть файл

@ -449,8 +449,7 @@ GetTextNode(nsISelection *selection, nsEditor *editor) {
// if node is null, return it to indicate there's no text
NS_ENSURE_TRUE(node, nullptr);
// This should be the root node, walk the tree looking for text nodes
mozilla::dom::NodeFilterHolder filter;
nsNodeIterator iter(node, nsIDOMNodeFilter::SHOW_TEXT, filter);
nsNodeIterator iter(node, nsIDOMNodeFilter::SHOW_TEXT, nullptr);
while (!editor->IsTextNode(selNode)) {
if (NS_FAILED(res = iter.NextNode(getter_AddRefs(selNode))) || !selNode) {
return nullptr;