mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
8c296bbcd4
This patch was generated by a script. Here's the source of the script for future reference: function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert PRInt8 int8_t convert PRUint8 uint8_t convert PRInt16 int16_t convert PRUint16 uint16_t convert PRInt32 int32_t convert PRUint32 uint32_t convert PRInt64 int64_t convert PRUint64 uint64_t convert PRIntn int convert PRUintn unsigned convert PRSize size_t convert PROffset32 int32_t convert PROffset64 int64_t convert PRPtrdiff ptrdiff_t convert PRFloat64 double
262 lines
6.9 KiB
C++
262 lines
6.9 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
/*
|
|
* Implementation of DOM Core's nsIDOMDocumentFragment.
|
|
*/
|
|
|
|
#include "nsIDOMDocumentFragment.h"
|
|
#include "mozilla/dom/FragmentOrElement.h"
|
|
#include "nsGenericElement.h" // for DOMCI_NODE_DATA
|
|
#include "nsINameSpaceManager.h"
|
|
#include "nsINodeInfo.h"
|
|
#include "nsNodeInfoManager.h"
|
|
#include "nsError.h"
|
|
#include "nsGkAtoms.h"
|
|
#include "nsDOMString.h"
|
|
#include "nsContentUtils.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::dom;
|
|
|
|
class nsDocumentFragment : public FragmentOrElement,
|
|
public nsIDOMDocumentFragment
|
|
{
|
|
public:
|
|
using FragmentOrElement::GetFirstChild;
|
|
|
|
// nsISupports
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
// interface nsIDOMNode
|
|
NS_FORWARD_NSIDOMNODE(FragmentOrElement::)
|
|
|
|
// interface nsIDOMDocumentFragment
|
|
// NS_DECL_NSIDOCUMENTFRAGMENT Empty
|
|
|
|
nsDocumentFragment(already_AddRefed<nsINodeInfo> aNodeInfo);
|
|
virtual ~nsDocumentFragment()
|
|
{
|
|
}
|
|
|
|
// nsIContent
|
|
virtual already_AddRefed<nsINodeInfo>
|
|
GetExistingAttrNameFromQName(const nsAString& aStr) const
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
const nsAString& aValue, bool aNotify)
|
|
{
|
|
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
|
|
}
|
|
virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
nsIAtom* aPrefix, const nsAString& aValue,
|
|
bool aNotify)
|
|
{
|
|
return NS_OK;
|
|
}
|
|
virtual bool GetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
nsAString& aResult) const
|
|
{
|
|
return false;
|
|
}
|
|
virtual bool HasAttr(int32_t aNameSpaceID, nsIAtom* aName) const
|
|
{
|
|
return false;
|
|
}
|
|
virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
|
|
bool aNotify)
|
|
{
|
|
return NS_OK;
|
|
}
|
|
virtual const nsAttrName* GetAttrNameAt(uint32_t aIndex) const
|
|
{
|
|
return nullptr;
|
|
}
|
|
virtual uint32_t GetAttrCount() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
virtual bool IsNodeOfType(uint32_t aFlags) const;
|
|
|
|
virtual nsXPCClassInfo* GetClassInfo();
|
|
|
|
virtual nsIDOMNode* AsDOMNode() { return this; }
|
|
|
|
virtual nsIAtom* DoGetID() const;
|
|
virtual nsIAtom *GetIDAttributeName() const;
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
nsIContent* aBindingParent,
|
|
bool aCompileEventHandlers)
|
|
{
|
|
NS_ASSERTION(false, "Trying to bind a fragment to a tree");
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
}
|
|
|
|
virtual void UnbindFromTree(bool aDeep, bool aNullParent)
|
|
{
|
|
NS_ASSERTION(false, "Trying to unbind a fragment from a tree");
|
|
return;
|
|
}
|
|
|
|
virtual Element* GetNameSpaceElement()
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
virtual void List(FILE* out, int32_t aIndent) const;
|
|
virtual void DumpContent(FILE* out, int32_t aIndent, bool aDumpAll) const;
|
|
#endif
|
|
|
|
protected:
|
|
nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
|
};
|
|
|
|
nsresult
|
|
NS_NewDocumentFragment(nsIDOMDocumentFragment** aInstancePtrResult,
|
|
nsNodeInfoManager *aNodeInfoManager)
|
|
{
|
|
NS_ENSURE_ARG(aNodeInfoManager);
|
|
|
|
nsCOMPtr<nsINodeInfo> nodeInfo;
|
|
nodeInfo = aNodeInfoManager->GetNodeInfo(nsGkAtoms::documentFragmentNodeName,
|
|
nullptr, kNameSpaceID_None,
|
|
nsIDOMNode::DOCUMENT_FRAGMENT_NODE);
|
|
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
nsDocumentFragment *it = new nsDocumentFragment(nodeInfo.forget());
|
|
if (!it) {
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
}
|
|
|
|
NS_ADDREF(*aInstancePtrResult = it);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
nsDocumentFragment::nsDocumentFragment(already_AddRefed<nsINodeInfo> aNodeInfo)
|
|
: FragmentOrElement(aNodeInfo)
|
|
{
|
|
NS_ABORT_IF_FALSE(mNodeInfo->NodeType() ==
|
|
nsIDOMNode::DOCUMENT_FRAGMENT_NODE &&
|
|
mNodeInfo->Equals(nsGkAtoms::documentFragmentNodeName,
|
|
kNameSpaceID_None),
|
|
"Bad NodeType in aNodeInfo");
|
|
}
|
|
|
|
bool
|
|
nsDocumentFragment::IsNodeOfType(uint32_t aFlags) const
|
|
{
|
|
return !(aFlags & ~(eCONTENT | eDOCUMENT_FRAGMENT));
|
|
}
|
|
|
|
nsIAtom*
|
|
nsDocumentFragment::DoGetID() const
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
nsIAtom*
|
|
nsDocumentFragment::GetIDAttributeName() const
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
#ifdef DEBUG
|
|
void
|
|
nsDocumentFragment::List(FILE* out, int32_t aIndent) const
|
|
{
|
|
int32_t indent;
|
|
for (indent = aIndent; --indent >= 0; ) {
|
|
fputs(" ", out);
|
|
}
|
|
|
|
fprintf(out, "DocumentFragment@%p", (void *)this);
|
|
|
|
fprintf(out, " flags=[%08x]", static_cast<unsigned int>(GetFlags()));
|
|
fprintf(out, " refcount=%d<", mRefCnt.get());
|
|
|
|
nsIContent* child = GetFirstChild();
|
|
if (child) {
|
|
fputs("\n", out);
|
|
|
|
for (; child; child = child->GetNextSibling()) {
|
|
child->List(out, aIndent + 1);
|
|
}
|
|
|
|
for (indent = aIndent; --indent >= 0; ) {
|
|
fputs(" ", out);
|
|
}
|
|
}
|
|
|
|
fputs(">\n", out);
|
|
}
|
|
|
|
void
|
|
nsDocumentFragment::DumpContent(FILE* out, int32_t aIndent,
|
|
bool aDumpAll) const
|
|
{
|
|
int32_t indent;
|
|
for (indent = aIndent; --indent >= 0; ) {
|
|
fputs(" ", out);
|
|
}
|
|
|
|
fputs("<DocumentFragment>", out);
|
|
|
|
if(aIndent) {
|
|
fputs("\n", out);
|
|
}
|
|
|
|
for (nsIContent* child = GetFirstChild();
|
|
child;
|
|
child = child->GetNextSibling()) {
|
|
int32_t indent = aIndent ? aIndent + 1 : 0;
|
|
child->DumpContent(out, indent, aDumpAll);
|
|
}
|
|
for (indent = aIndent; --indent >= 0; ) {
|
|
fputs(" ", out);
|
|
}
|
|
fputs("</DocumentFragment>", out);
|
|
|
|
if(aIndent) {
|
|
fputs("\n", out);
|
|
}
|
|
}
|
|
#endif
|
|
|
|
|
|
DOMCI_NODE_DATA(DocumentFragment, nsDocumentFragment)
|
|
|
|
// QueryInterface implementation for nsDocumentFragment
|
|
NS_INTERFACE_MAP_BEGIN(nsDocumentFragment)
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsDocumentFragment)
|
|
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
|
NS_INTERFACE_MAP_ENTRY(nsINode)
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentFragment)
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
|
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsISupportsWeakReference,
|
|
new nsNodeSupportsWeakRefTearoff(this))
|
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMNodeSelector,
|
|
new nsNodeSelectorTearoff(this))
|
|
// nsNodeSH::PreCreate() depends on the identity pointer being the
|
|
// same as nsINode (which nsIContent inherits), so if you change the
|
|
// below line, make sure nsNodeSH::PreCreate() still does the right
|
|
// thing!
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DocumentFragment)
|
|
NS_INTERFACE_MAP_END
|
|
|
|
NS_IMPL_ADDREF_INHERITED(nsDocumentFragment, FragmentOrElement)
|
|
NS_IMPL_RELEASE_INHERITED(nsDocumentFragment, FragmentOrElement)
|
|
|
|
NS_IMPL_ELEMENT_CLONE(nsDocumentFragment)
|