mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 540568 - Remove DOMBuilder, r=bz
--HG-- extra : rebase_source : 77f05d87a414e3c55046016423486bcf127ea6cf
This commit is contained in:
parent
9308517cfc
commit
69f13bd2e3
@ -1,191 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Boris Zbarsky <bzbarsky@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* This file was part of an abortive attempt at DOM3 Load/Save; it's not built.
|
||||
*/
|
||||
|
||||
#include "nsDOMBuilder.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsContentUtils.h" // for NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO
|
||||
#include "nsIDOMDocument.h"
|
||||
|
||||
nsresult
|
||||
NS_NewDOMBuilder(nsIDOMDOMBuilder** aResult,
|
||||
PRUint16 aMode,
|
||||
const nsAString & aSchemaType,
|
||||
nsIDOMDOMImplementation* aDOMImplementation)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "Null out ptr? Who do you think you are, flouting XPCOM contract?");
|
||||
NS_PRECONDITION(aDOMImplementation, "How are we supposed to create documents without a DOMImplementation?");
|
||||
|
||||
nsDOMBuilder* it = new nsDOMBuilder(aMode, aSchemaType, aDOMImplementation);
|
||||
if (!it)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsDOMBuilder::nsDOMBuilder(PRUint16 aMode,
|
||||
const nsAString& aSchemaType,
|
||||
nsIDOMDOMImplementation* aDOMImplementation)
|
||||
{
|
||||
mDOMImplementation = aDOMImplementation;
|
||||
}
|
||||
|
||||
nsDOMBuilder::~nsDOMBuilder()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMBuilder)
|
||||
NS_IMPL_RELEASE(nsDOMBuilder)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMBuilder)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMBuilder)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDOMBuilder)
|
||||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMBuilder)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
// nsIDOMDOMBuilder
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::GetEntityResolver(nsIDOMDOMEntityResolver** aEntityResolver)
|
||||
{
|
||||
*aEntityResolver = mEntityResolver;
|
||||
NS_IF_ADDREF(*aEntityResolver);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::SetEntityResolver(nsIDOMDOMEntityResolver* aEntityResolver)
|
||||
{
|
||||
mEntityResolver = aEntityResolver;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::GetErrorHandler(nsIDOMDOMErrorHandler** aErrorHandler)
|
||||
{
|
||||
*aErrorHandler = mErrorHandler;
|
||||
NS_IF_ADDREF(*aErrorHandler);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::SetErrorHandler(nsIDOMDOMErrorHandler* aErrorHandler)
|
||||
{
|
||||
mErrorHandler = aErrorHandler;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::GetFilter(nsIDOMDOMBuilderFilter** aFilter)
|
||||
{
|
||||
*aFilter = mFilter;
|
||||
NS_IF_ADDREF(*aFilter);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::SetFilter(nsIDOMDOMBuilderFilter* aFilter)
|
||||
{
|
||||
mFilter = aFilter;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::SetFeature(const nsAString& aName, PRBool aState)
|
||||
{
|
||||
// XXX We don't know about any features yet
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::CanSetFeature(const nsAString& aName, PRBool aState,
|
||||
PRBool* aCanSet)
|
||||
{
|
||||
// XXX We can't set anything
|
||||
*aCanSet = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::GetFeature(const nsAString& aName, PRBool* aIsOn)
|
||||
{
|
||||
// XXX We don't know about any features yet
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::ParseURI(const nsAString& aURI, nsIDOMDocument** aDocument)
|
||||
{
|
||||
*aDocument = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
|
||||
NS_NAMED_LITERAL_STRING(emptyStr, "");
|
||||
mDOMImplementation->CreateDocument(emptyStr,
|
||||
emptyStr,
|
||||
nsnull,
|
||||
getter_AddRefs(domDoc));
|
||||
|
||||
if (!domDoc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// XXX synchronous loading? We'd have to do something right about now.
|
||||
|
||||
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::Parse(nsIDOMDOMInputSource* aInputSource,
|
||||
nsIDOMDocument** aDocument)
|
||||
{
|
||||
*aDocument = nsnull;
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMBuilder::ParseWithContext(nsIDOMDOMInputSource* aInputSource,
|
||||
nsIDOMNode* aContextNode,
|
||||
PRUint16 aAction)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Boris Zbarsky <bzbarsky@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*
|
||||
* This file was part of an abortive attempt at DOM3 Load/Save; it's not built.
|
||||
*/
|
||||
|
||||
#ifndef nsDOMBuilder_h__
|
||||
#define nsDOMBuilder_h__
|
||||
|
||||
#include "nsIDOMDOMBuilder.h"
|
||||
#include "nsIDOMDOMEntityResolver.h"
|
||||
#include "nsIDOMDOMErrorHandler.h"
|
||||
#include "nsIDOMDOMBuilderFilter.h"
|
||||
#include "nsIDOMDOMImplementation.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsDOMBuilder : public nsIDOMDOMBuilder
|
||||
{
|
||||
public:
|
||||
nsDOMBuilder(PRUint16 aMode, const nsAString& aSchemaType,
|
||||
nsIDOMDOMImplementation* aDOMImplementation);
|
||||
virtual ~nsDOMBuilder();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMDOMBUILDER
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDOMDOMEntityResolver> mEntityResolver;
|
||||
nsCOMPtr<nsIDOMDOMErrorHandler> mErrorHandler;
|
||||
nsCOMPtr<nsIDOMDOMBuilderFilter> mFilter;
|
||||
// Strong ref; make sure DOMImplementation never owns us!
|
||||
nsCOMPtr<nsIDOMDOMImplementation> mDOMImplementation;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewDOMBuilder(nsIDOMDOMBuilder** aResult,
|
||||
PRUint16 aMode,
|
||||
const nsAString & aSchemaType,
|
||||
nsIDOMDOMImplementation* aDOMImplementation);
|
||||
|
||||
#endif // nsDOMBuilder_h__
|
@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Boris Zbarsky <bzbarsky@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsILoadSaveContentSink_h__
|
||||
#define nsILoadSaveContentSink_h__
|
||||
|
||||
#include "nsIXMLContentSink.h"
|
||||
|
||||
#define NS_ILOADSAVE_CONTENT_SINK_IID \
|
||||
{ 0xa39ed66a, 0x6ef5, 0x49da, \
|
||||
{ 0xb6, 0xe4, 0x9e, 0x15, 0x85, 0xf0, 0xba, 0xc9 } }
|
||||
|
||||
/**
|
||||
* This interface represents a content sink used by the DOMBuilder in
|
||||
* DOM3 Load/Save.
|
||||
*/
|
||||
|
||||
class nsILoadSaveContentSink : public nsIXMLContentSink {
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILOADSAVE_CONTENT_SINK_IID)
|
||||
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsILoadSaveContentSink,
|
||||
NS_ILOADSAVE_CONTENT_SINK_IID)
|
||||
|
||||
/**
|
||||
* The nsIXMLContentSink passed to this method must also implement
|
||||
* nsIExpatSink.
|
||||
*/
|
||||
|
||||
nsresult
|
||||
NS_NewLoadSaveContentSink(nsILoadSaveContentSink** aResult,
|
||||
nsIXMLContentSink* aBaseSink);
|
||||
|
||||
#endif // nsILoadSaveContentSink_h__
|
@ -1,217 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Boris Zbarsky <bzbarsky@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsLoadSaveContentSink.h"
|
||||
|
||||
nsresult
|
||||
NS_NewLoadSaveContentSink(nsILoadSaveContentSink** aResult,
|
||||
nsIXMLContentSink* aBaseSink)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "Null out ptr? Who do you think you are, flouting XPCOM contract?");
|
||||
NS_ENSURE_ARG_POINTER(aBaseSink);
|
||||
nsLoadSaveContentSink* it;
|
||||
NS_NEWXPCOM(it, nsLoadSaveContentSink);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = it->Init(aBaseSink);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete it;
|
||||
return rv;
|
||||
}
|
||||
|
||||
return CallQueryInterface(it, aResult);
|
||||
}
|
||||
|
||||
nsLoadSaveContentSink::nsLoadSaveContentSink()
|
||||
{
|
||||
}
|
||||
|
||||
nsLoadSaveContentSink::~nsLoadSaveContentSink()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsLoadSaveContentSink::Init(nsIXMLContentSink* aBaseSink)
|
||||
{
|
||||
NS_PRECONDITION(aBaseSink, "aBaseSink needs to exist");
|
||||
mBaseSink = aBaseSink;
|
||||
mExpatSink = do_QueryInterface(aBaseSink);
|
||||
if (!mExpatSink) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsLoadSaveContentSink)
|
||||
NS_IMPL_THREADSAFE_RELEASE(nsLoadSaveContentSink)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsLoadSaveContentSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXMLContentSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIContentSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIExpatSink)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXMLContentSink)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
// nsIContentSink
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::WillBuildModel(nsDTDMode aDTDMode)
|
||||
{
|
||||
return mBaseSink->WillBuildModel(aDTDMode);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::DidBuildModel(PRBool aTerminated)
|
||||
{
|
||||
return mBaseSink->DidBuildModel(aTerminated);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::WillInterrupt(void)
|
||||
{
|
||||
return mBaseSink->WillInterrupt();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::WillResume(void)
|
||||
{
|
||||
return mBaseSink->WillResume();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::SetParser(nsIParser* aParser)
|
||||
{
|
||||
return mBaseSink->SetParser(aParser);
|
||||
}
|
||||
|
||||
void
|
||||
nsLoadSaveContentSink::FlushPendingNotifications(mozFlushType aType)
|
||||
{
|
||||
mBaseSink->FlushPendingNotifications(aType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::SetDocumentCharset(nsAString& aCharset)
|
||||
{
|
||||
return mBaseSink->SetDocumentCharset(aCharset);
|
||||
}
|
||||
|
||||
// nsIExpatSink
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleStartElement(const PRUnichar *aName,
|
||||
const PRUnichar **aAtts,
|
||||
PRUint32 aAttsCount,
|
||||
PRInt32 aIndex,
|
||||
PRUint32 aLineNumber)
|
||||
{
|
||||
return mExpatSink->HandleStartElement(aName, aAtts, aAttsCount, aIndex,
|
||||
aLineNumber);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleEndElement(const PRUnichar *aName)
|
||||
{
|
||||
return mExpatSink->HandleEndElement(aName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleComment(const PRUnichar *aName)
|
||||
{
|
||||
return mExpatSink->HandleComment(aName);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleCDataSection(const PRUnichar *aData,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
return mExpatSink->HandleCDataSection(aData, aLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleDoctypeDecl(const nsAString & aSubset,
|
||||
const nsAString & aName,
|
||||
const nsAString & aSystemId,
|
||||
const nsAString & aPublicId,
|
||||
nsISupports* aCatalogData)
|
||||
{
|
||||
return mExpatSink->HandleDoctypeDecl(aSubset, aName, aSystemId, aPublicId,
|
||||
aCatalogData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleCharacterData(const PRUnichar *aData,
|
||||
PRUint32 aLength)
|
||||
{
|
||||
return mExpatSink->HandleCharacterData(aData, aLength);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleProcessingInstruction(const PRUnichar *aTarget,
|
||||
const PRUnichar *aData)
|
||||
{
|
||||
return mExpatSink->HandleProcessingInstruction(aTarget, aData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::HandleXMLDeclaration(const PRUnichar *aVersion,
|
||||
const PRUnichar *aEncoding,
|
||||
PRInt32 aStandalone)
|
||||
{
|
||||
return mExpatSink->HandleXMLDeclaration(aVersion, aEncoding, aStandalone);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadSaveContentSink::ReportError(const PRUnichar* aErrorText,
|
||||
const PRUnichar* aSourceText,
|
||||
nsIScriptError *aError,
|
||||
PRBool *_retval)
|
||||
{
|
||||
NS_PRECONDITION(aError && aSourceText && aErrorText, "Check arguments!!!");
|
||||
|
||||
// XXX Do error reporting here. I see no reason to call ReportError
|
||||
// on the "base" sink; all we need to do is drop the document on the
|
||||
// floor...
|
||||
|
||||
// The expat driver should report the error.
|
||||
*_retval = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Boris Zbarsky <bzbarsky@mit.edu> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsLoadSaveContentSink_h__
|
||||
#define nsLoadSaveContentSink_h__
|
||||
|
||||
#include "nsIExpatSink.h"
|
||||
#include "nsIXMLContentSink.h"
|
||||
#include "nsILoadSaveContentSink.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDTD.h"
|
||||
|
||||
/**
|
||||
* This class implements the core of the DOMBuilder for DOM3
|
||||
* Load/Save. It holds a reference to an actual content sink that
|
||||
* constructs the content model.
|
||||
*/
|
||||
class nsLoadSaveContentSink : public nsILoadSaveContentSink,
|
||||
public nsIExpatSink
|
||||
{
|
||||
public:
|
||||
nsLoadSaveContentSink();
|
||||
virtual ~nsLoadSaveContentSink();
|
||||
|
||||
/**
|
||||
* Initializes the sink. This will return an error if the arguments
|
||||
* do not satisfy some basic sanity-checks.
|
||||
* @param aBaseSink a "real" sink that the LoadSave sink can use to
|
||||
* build the document. This must be non-null and
|
||||
* must also implement nsIExpatSink.
|
||||
*/
|
||||
nsresult Init(nsIXMLContentSink* aBaseSink);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIEXPATSINK
|
||||
|
||||
// nsILoadSaveContentSink
|
||||
NS_IMETHOD WillBuildModel(nsDTDMode aDTDMode);
|
||||
NS_IMETHOD DidBuildModel(PRBool aTerminated);
|
||||
NS_IMETHOD WillInterrupt(void);
|
||||
NS_IMETHOD WillResume(void);
|
||||
NS_IMETHOD SetParser(nsIParser* aParser);
|
||||
virtual void FlushPendingNotifications(mozFlushType aType);
|
||||
NS_IMETHOD SetDocumentCharset(nsAString& aCharset);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Pointers to the "real" sink. We hold on to both just for
|
||||
* convenience sake.
|
||||
*/
|
||||
nsCOMPtr<nsIXMLContentSink> mBaseSink;
|
||||
nsCOMPtr<nsIExpatSink> mExpatSink;
|
||||
};
|
||||
|
||||
#endif // nsLoadSaveContentSink_h__
|
Loading…
Reference in New Issue
Block a user