68790 - Remove nsHTMLContentSinkStream dependency. Not in use anymore
r=heikki sr=jst
This commit is contained in:
Родитель
a468466153
Коммит
970bb44680
|
@ -2063,87 +2063,6 @@ nsRange::CreateContextualFragment(const nsAReadableString& aFragment,
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRange::IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIParser> parser;
|
||||
nsITagStack* tagStack;
|
||||
|
||||
if (!mIsPositioned) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Create a new parser for this entire operation
|
||||
result = nsComponentManager::CreateInstance(kCParserCID,
|
||||
nsnull,
|
||||
NS_GET_IID(nsIParser),
|
||||
(void **)getter_AddRefs(parser));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
result = parser->CreateTagStack(&tagStack);
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mStartParent, &result));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
|
||||
result = content->GetDocument(*getter_AddRefs(document));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDOMDocument> domDocument(do_QueryInterface(document, &result));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
parent = mStartParent;
|
||||
while (parent &&
|
||||
(parent != domDocument) &&
|
||||
NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIDOMNode> temp;
|
||||
nsAutoString tagName;
|
||||
PRUnichar* name = nsnull;
|
||||
|
||||
parent->GetNodeName(tagName);
|
||||
// XXX Wish we didn't have to allocate here
|
||||
name = tagName.ToNewUnicode();
|
||||
if (name) {
|
||||
tagStack->Push(name);
|
||||
temp = parent;
|
||||
result = temp->GetParentNode(getter_AddRefs(parent));
|
||||
}
|
||||
else {
|
||||
result = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsAutoString contentType;
|
||||
|
||||
document->GetContentType(contentType);
|
||||
*aReturn = parser->IsValidFragment(aFragment,
|
||||
*tagStack,
|
||||
0, contentType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Ick! Delete strings we allocated above.
|
||||
PRUnichar* str = nsnull;
|
||||
str = tagStack->Pop();
|
||||
while (str) {
|
||||
nsCRT::free(str);
|
||||
str = tagStack->Pop();
|
||||
}
|
||||
|
||||
// XXX Double Ick! Deleting something that someone else newed.
|
||||
delete tagStack;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRange::GetHasGeneratedBefore(PRBool *aBool)
|
||||
{
|
||||
|
|
|
@ -98,8 +98,6 @@ public:
|
|||
/*BEGIN nsIDOMNSRange interface implementations*/
|
||||
NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment,
|
||||
nsIDOMDocumentFragment** aReturn);
|
||||
NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn);
|
||||
|
||||
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset,
|
||||
PRBool* aResult);
|
||||
NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset,
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
interface Range {
|
||||
/* IID: { 0xa6cf90ce, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
|
||||
const unsigned short START_TO_START = 0;
|
||||
const unsigned short START_TO_END = 1;
|
||||
const unsigned short END_TO_START = 2;
|
||||
const unsigned short END_TO_END = 3;
|
||||
|
||||
readonly attribute Node startContainer;
|
||||
readonly attribute long startOffset;
|
||||
readonly attribute Node endContainer;
|
||||
readonly attribute long endOffset;
|
||||
|
||||
readonly attribute boolean collapsed;
|
||||
readonly attribute Node commonAncestorContainer;
|
||||
|
||||
void setStart(in Node parent, in long offset);
|
||||
void setStartBefore(in Node sibling);
|
||||
void setStartAfter(in Node sibling);
|
||||
void setEnd(in Node parent, in long offset);
|
||||
void setEndBefore(in Node sibling);
|
||||
void setEndAfter(in Node sibling);
|
||||
|
||||
void collapse(in boolean toStart);
|
||||
|
||||
void selectNode(in Node n);
|
||||
void selectNodeContents(in Node n);
|
||||
|
||||
int compareBoundaryPoints(in unsigned short how, in Range srcRange);
|
||||
|
||||
void deleteContents();
|
||||
|
||||
DocumentFragment extractContents();
|
||||
DocumentFragment cloneContents();
|
||||
|
||||
void insertNode(in Node n);
|
||||
void surroundContents(in Node n);
|
||||
|
||||
Range cloneRange();
|
||||
|
||||
void detach();
|
||||
|
||||
DOMString toString();
|
||||
};
|
||||
|
||||
interface NSRange {
|
||||
/* IID: { 0xa6cf90f2, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
|
||||
DocumentFragment createContextualFragment(in DOMString fragment);
|
||||
boolean isValidFragment(in DOMString fragment);
|
||||
|
||||
// Is the point contained in the range?
|
||||
boolean isPointInRange(in Node parent, in long offset);
|
||||
|
||||
// comparePoint returns
|
||||
// -1 if point is before range,
|
||||
// 0 if point is in range,
|
||||
// 1 if point is after range
|
||||
// Sort of a strcmp for ranges.
|
||||
short comparePoint(in Node parent, in long offset);
|
||||
|
||||
// Does the node intersect the range?
|
||||
boolean intersectsNode(in Node n);
|
||||
|
||||
// HOW does the node intersect the range? Four possible values:
|
||||
const unsigned short NODE_BEFORE = 0;
|
||||
const unsigned short NODE_AFTER = 1;
|
||||
const unsigned short NODE_BEFORE_AND_AFTER = 2;
|
||||
const unsigned short NODE_INSIDE = 3;
|
||||
unsigned short compareNode(in Node n);
|
||||
void nSDetach();
|
||||
};
|
|
@ -834,7 +834,6 @@ enum nsDOMProp {
|
|||
NS_DOM_PROP_NSRANGE_CREATECONTEXTUALFRAGMENT,
|
||||
NS_DOM_PROP_NSRANGE_INTERSECTSNODE,
|
||||
NS_DOM_PROP_NSRANGE_ISPOINTINRANGE,
|
||||
NS_DOM_PROP_NSRANGE_ISVALIDFRAGMENT,
|
||||
NS_DOM_PROP_NSRANGE_NSDETACH,
|
||||
NS_DOM_PROP_NSUIEVENT_CANCELBUBBLE,
|
||||
NS_DOM_PROP_NSUIEVENT_GETPREVENTDEFAULT,
|
||||
|
|
|
@ -832,7 +832,6 @@
|
|||
"nsrange.createcontextualfragment", \
|
||||
"nsrange.intersectsnode", \
|
||||
"nsrange.ispointinrange", \
|
||||
"nsrange.isvalidfragment", \
|
||||
"nsrange.nsdetach", \
|
||||
"nsuievent.cancelbubble", \
|
||||
"nsuievent.getpreventdefault", \
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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 Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#ifndef nsIDOMNSRange_h__
|
||||
#define nsIDOMNSRange_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
class nsIDOMDocumentFragment;
|
||||
|
||||
#define NS_IDOMNSRANGE_IID \
|
||||
{ 0xa6cf90f2, 0x15b3, 0x11d2, \
|
||||
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
|
||||
|
||||
class NS_NO_VTABLE nsIDOMNSRange : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMNSRANGE_IID)
|
||||
enum {
|
||||
NODE_BEFORE = 0,
|
||||
NODE_AFTER = 1,
|
||||
NODE_BEFORE_AND_AFTER = 2,
|
||||
NODE_INSIDE = 3
|
||||
};
|
||||
|
||||
NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn)=0;
|
||||
|
||||
NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn)=0;
|
||||
|
||||
NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn)=0;
|
||||
|
||||
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRUint16* aReturn)=0;
|
||||
|
||||
NS_IMETHOD NSDetach()=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMNSRANGE \
|
||||
NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn); \
|
||||
NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn); \
|
||||
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn); \
|
||||
NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn); \
|
||||
NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn); \
|
||||
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRUint16* aReturn); \
|
||||
NS_IMETHOD NSDetach(); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMNSRANGE(_to) \
|
||||
NS_IMETHOD CreateContextualFragment(const nsAReadableString& aFragment, nsIDOMDocumentFragment** aReturn) { return _to CreateContextualFragment(aFragment, aReturn); } \
|
||||
NS_IMETHOD IsValidFragment(const nsAReadableString& aFragment, PRBool* aReturn) { return _to IsValidFragment(aFragment, aReturn); } \
|
||||
NS_IMETHOD IsPointInRange(nsIDOMNode* aParent, PRInt32 aOffset, PRBool* aReturn) { return _to IsPointInRange(aParent, aOffset, aReturn); } \
|
||||
NS_IMETHOD ComparePoint(nsIDOMNode* aParent, PRInt32 aOffset, PRInt16* aReturn) { return _to ComparePoint(aParent, aOffset, aReturn); } \
|
||||
NS_IMETHOD IntersectsNode(nsIDOMNode* aN, PRBool* aReturn) { return _to IntersectsNode(aN, aReturn); } \
|
||||
NS_IMETHOD CompareNode(nsIDOMNode* aN, PRUint16* aReturn) { return _to CompareNode(aN, aReturn); } \
|
||||
NS_IMETHOD NSDetach() { return _to NSDetach(); } \
|
||||
|
||||
|
||||
#endif // nsIDOMNSRange_h__
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -6,7 +6,6 @@ nshtmlpars.h
|
|||
nsIContentSink.h
|
||||
nsIHTMLContentSink.h
|
||||
nsIHTMLFragmentContentSink.h
|
||||
nsHTMLContentSinkStream.h
|
||||
nsITokenizer.h
|
||||
nsHTMLTokens.h
|
||||
nsIParserNode.h
|
||||
|
|
|
@ -72,7 +72,6 @@ CPPSRCS = \
|
|||
nsScanner.cpp \
|
||||
nsToken.cpp \
|
||||
nsTokenHandler.cpp \
|
||||
nsHTMLContentSinkStream.cpp \
|
||||
nsValidDTD.cpp \
|
||||
nsWellFormedDTD.cpp \
|
||||
nsViewSourceHTML.cpp \
|
||||
|
@ -94,7 +93,6 @@ EXPORTS = \
|
|||
nsITokenizer.h \
|
||||
nsIExpatTokenizer.h \
|
||||
nsIHTMLContentSink.h \
|
||||
nsHTMLContentSinkStream.h \
|
||||
nsIHTMLFragmentContentSink.h \
|
||||
nsHTMLEntities.h \
|
||||
nsHTMLEntityList.h \
|
||||
|
|
|
@ -49,7 +49,6 @@ CPPSRCS= \
|
|||
nsScanner.cpp \
|
||||
nsToken.cpp \
|
||||
nsTokenHandler.cpp \
|
||||
nsHTMLContentSinkStream.cpp \
|
||||
nsValidDTD.cpp \
|
||||
nsWellFormedDTD.cpp \
|
||||
nsViewSourceHTML.cpp \
|
||||
|
@ -77,7 +76,6 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsScanner.obj \
|
||||
.\$(OBJDIR)\nsToken.obj \
|
||||
.\$(OBJDIR)\nsTokenHandler.obj \
|
||||
.\$(OBJDIR)\nsHTMLContentSinkStream.obj \
|
||||
.\$(OBJDIR)\nsValidDTD.obj \
|
||||
.\$(OBJDIR)\nsWellFormedDTD.obj \
|
||||
.\$(OBJDIR)\nsViewSourceHTML.obj \
|
||||
|
@ -92,7 +90,6 @@ EXPORTS= \
|
|||
nsIContentSink.h \
|
||||
nsIHTMLContentSink.h \
|
||||
nsILoggingSink.h \
|
||||
nsHTMLContentSinkStream.h \
|
||||
nsIHTMLFragmentContentSink.h \
|
||||
nsHTMLEntities.h \
|
||||
nsHTMLEntityList.h \
|
||||
|
|
|
@ -240,7 +240,6 @@ class nsIParser : public nsISupports {
|
|||
|
||||
virtual nsresult Terminate(void) = 0;
|
||||
|
||||
virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "nshtmlpars.h"
|
||||
#include "nsWellFormedDTD.h"
|
||||
#include "nsViewSourceHTML.h"
|
||||
#include "nsHTMLContentSinkStream.h" //this is here so we can get a null sink, which really should be gotten from nsICOntentSink.h
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
@ -1736,62 +1735,6 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method to test whether a given fragment is valid within a given context-stack.
|
||||
* @update gess 04/01/99
|
||||
* @param aSourceBuffer contains the content blob you're trying to insert
|
||||
* @param aInsertPos tells us where in the context stack you're trying to do the insertion
|
||||
* @param aMimeType tells us what kind of stuff you're inserting
|
||||
* @return TRUE if valid, otherwise FALSE
|
||||
*/
|
||||
PRBool nsParser::IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){
|
||||
|
||||
/************************************************************************************
|
||||
This method works like this:
|
||||
1. Convert aStack to a markup string
|
||||
2. Append a "sentinel" tag to markup string so we know where new content is inserted
|
||||
3. Append new context to markup stack
|
||||
4. Call the normal parse() methods for a string, using an HTMLContentSink.
|
||||
The output of this call is stored in an outputstring
|
||||
5. Scan the output string looking for markup inside our sentinel. If non-empty
|
||||
then we have to assume that the fragment is valid (at least in part)
|
||||
************************************************************************************/
|
||||
|
||||
nsAutoString theContext;
|
||||
PRUint32 theCount=aStack.GetSize();
|
||||
PRUint32 theIndex=0;
|
||||
while(theIndex++<theCount){
|
||||
theContext.AppendWithConversion("<");
|
||||
theContext.Append(aStack.TagAt(theCount-theIndex));
|
||||
theContext.AppendWithConversion(">");
|
||||
}
|
||||
theContext.AppendWithConversion("<endnote>"); //XXXHack! I'll make this better later.
|
||||
nsAutoString theBuffer(theContext);
|
||||
theBuffer.Append(aSourceBuffer);
|
||||
|
||||
PRBool result=PR_FALSE;
|
||||
if(theBuffer.Length()){
|
||||
//now it's time to try to build the model from this fragment
|
||||
|
||||
nsString theOutput;
|
||||
nsIHTMLContentSink* theSink=0;
|
||||
nsresult theResult=NS_New_HTML_ContentSinkStream(&theSink,&theOutput,0);
|
||||
SetContentSink(theSink);
|
||||
theResult=Parse(theBuffer,(void*)&theBuffer,aMimeType,PR_FALSE,PR_TRUE);
|
||||
theOutput.StripWhitespace();
|
||||
if(NS_OK==theResult){
|
||||
theOutput.Cut(0,theContext.Length());
|
||||
PRInt32 aPos=theOutput.RFind("</endnote>");
|
||||
if(-1<aPos)
|
||||
theOutput.Truncate(aPos);
|
||||
result=PRBool(0<theOutput.Length());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess 04/01/99
|
||||
|
|
|
@ -200,7 +200,6 @@ class nsParser : public nsIParser,
|
|||
*/
|
||||
virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "COtherDTD.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "nsViewSourceHTML.h"
|
||||
#include "nsHTMLContentSinkStream.h"
|
||||
#include "nsHTMLEntities.h"
|
||||
#include "nsHTMLTokenizer.h"
|
||||
#include "nsXMLTokenizer.h"
|
||||
|
@ -156,7 +155,6 @@ static NS_DEFINE_CID(kNavDTDCID, NS_CNAVDTD_CID);
|
|||
static NS_DEFINE_CID(kCOtherDTDCID, NS_COTHER_DTD_CID);
|
||||
static NS_DEFINE_CID(kCTransitionalDTDCID, NS_CTRANSITIONAL_DTD_CID);
|
||||
static NS_DEFINE_CID(kViewSourceDTDCID, NS_VIEWSOURCE_DTD_CID);
|
||||
static NS_DEFINE_CID(kHTMLContentSinkStreamCID, NS_HTMLCONTENTSINKSTREAM_CID);
|
||||
static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
|
||||
|
@ -166,7 +164,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(COtherDTD)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(CTransitionalDTD)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLContentSinkStream)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
|
||||
|
||||
static nsModuleComponentInfo gComponents[] = {
|
||||
|
@ -178,8 +175,6 @@ static nsModuleComponentInfo gComponents[] = {
|
|||
{ "Transitional DTD", NS_CTRANSITIONAL_DTD_CID, NULL,
|
||||
CTransitionalDTDConstructor },
|
||||
{ "ViewSource DTD", NS_VIEWSOURCE_DTD_CID, NULL, CViewSourceHTMLConstructor },
|
||||
{ "HTML Content Sink Stream", NS_HTMLCONTENTSINKSTREAM_CID, NULL,
|
||||
nsHTMLContentSinkStreamConstructor },
|
||||
{ "ParserService", NS_PARSERSERVICE_CID, NULL, nsParserServiceConstructor }
|
||||
};
|
||||
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))
|
||||
|
|
|
@ -6,7 +6,6 @@ nshtmlpars.h
|
|||
nsIContentSink.h
|
||||
nsIHTMLContentSink.h
|
||||
nsIHTMLFragmentContentSink.h
|
||||
nsHTMLContentSinkStream.h
|
||||
nsITokenizer.h
|
||||
nsHTMLTokens.h
|
||||
nsIParserNode.h
|
||||
|
|
|
@ -72,7 +72,6 @@ CPPSRCS = \
|
|||
nsScanner.cpp \
|
||||
nsToken.cpp \
|
||||
nsTokenHandler.cpp \
|
||||
nsHTMLContentSinkStream.cpp \
|
||||
nsValidDTD.cpp \
|
||||
nsWellFormedDTD.cpp \
|
||||
nsViewSourceHTML.cpp \
|
||||
|
@ -94,7 +93,6 @@ EXPORTS = \
|
|||
nsITokenizer.h \
|
||||
nsIExpatTokenizer.h \
|
||||
nsIHTMLContentSink.h \
|
||||
nsHTMLContentSinkStream.h \
|
||||
nsIHTMLFragmentContentSink.h \
|
||||
nsHTMLEntities.h \
|
||||
nsHTMLEntityList.h \
|
||||
|
|
|
@ -49,7 +49,6 @@ CPPSRCS= \
|
|||
nsScanner.cpp \
|
||||
nsToken.cpp \
|
||||
nsTokenHandler.cpp \
|
||||
nsHTMLContentSinkStream.cpp \
|
||||
nsValidDTD.cpp \
|
||||
nsWellFormedDTD.cpp \
|
||||
nsViewSourceHTML.cpp \
|
||||
|
@ -77,7 +76,6 @@ CPP_OBJS= \
|
|||
.\$(OBJDIR)\nsScanner.obj \
|
||||
.\$(OBJDIR)\nsToken.obj \
|
||||
.\$(OBJDIR)\nsTokenHandler.obj \
|
||||
.\$(OBJDIR)\nsHTMLContentSinkStream.obj \
|
||||
.\$(OBJDIR)\nsValidDTD.obj \
|
||||
.\$(OBJDIR)\nsWellFormedDTD.obj \
|
||||
.\$(OBJDIR)\nsViewSourceHTML.obj \
|
||||
|
@ -92,7 +90,6 @@ EXPORTS= \
|
|||
nsIContentSink.h \
|
||||
nsIHTMLContentSink.h \
|
||||
nsILoggingSink.h \
|
||||
nsHTMLContentSinkStream.h \
|
||||
nsIHTMLFragmentContentSink.h \
|
||||
nsHTMLEntities.h \
|
||||
nsHTMLEntityList.h \
|
||||
|
|
|
@ -240,7 +240,6 @@ class nsIParser : public nsISupports {
|
|||
|
||||
virtual nsresult Terminate(void) = 0;
|
||||
|
||||
virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect)=0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "nshtmlpars.h"
|
||||
#include "nsWellFormedDTD.h"
|
||||
#include "nsViewSourceHTML.h"
|
||||
#include "nsHTMLContentSinkStream.h" //this is here so we can get a null sink, which really should be gotten from nsICOntentSink.h
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
|
@ -1736,62 +1735,6 @@ aMimeType,PRBool aVerifyEnabled,PRBool aLastCall,nsDTDMode aMode){
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Call this method to test whether a given fragment is valid within a given context-stack.
|
||||
* @update gess 04/01/99
|
||||
* @param aSourceBuffer contains the content blob you're trying to insert
|
||||
* @param aInsertPos tells us where in the context stack you're trying to do the insertion
|
||||
* @param aMimeType tells us what kind of stuff you're inserting
|
||||
* @return TRUE if valid, otherwise FALSE
|
||||
*/
|
||||
PRBool nsParser::IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aMimeType,nsDTDMode aMode){
|
||||
|
||||
/************************************************************************************
|
||||
This method works like this:
|
||||
1. Convert aStack to a markup string
|
||||
2. Append a "sentinel" tag to markup string so we know where new content is inserted
|
||||
3. Append new context to markup stack
|
||||
4. Call the normal parse() methods for a string, using an HTMLContentSink.
|
||||
The output of this call is stored in an outputstring
|
||||
5. Scan the output string looking for markup inside our sentinel. If non-empty
|
||||
then we have to assume that the fragment is valid (at least in part)
|
||||
************************************************************************************/
|
||||
|
||||
nsAutoString theContext;
|
||||
PRUint32 theCount=aStack.GetSize();
|
||||
PRUint32 theIndex=0;
|
||||
while(theIndex++<theCount){
|
||||
theContext.AppendWithConversion("<");
|
||||
theContext.Append(aStack.TagAt(theCount-theIndex));
|
||||
theContext.AppendWithConversion(">");
|
||||
}
|
||||
theContext.AppendWithConversion("<endnote>"); //XXXHack! I'll make this better later.
|
||||
nsAutoString theBuffer(theContext);
|
||||
theBuffer.Append(aSourceBuffer);
|
||||
|
||||
PRBool result=PR_FALSE;
|
||||
if(theBuffer.Length()){
|
||||
//now it's time to try to build the model from this fragment
|
||||
|
||||
nsString theOutput;
|
||||
nsIHTMLContentSink* theSink=0;
|
||||
nsresult theResult=NS_New_HTML_ContentSinkStream(&theSink,&theOutput,0);
|
||||
SetContentSink(theSink);
|
||||
theResult=Parse(theBuffer,(void*)&theBuffer,aMimeType,PR_FALSE,PR_TRUE);
|
||||
theOutput.StripWhitespace();
|
||||
if(NS_OK==theResult){
|
||||
theOutput.Cut(0,theContext.Length());
|
||||
PRInt32 aPos=theOutput.RFind("</endnote>");
|
||||
if(-1<aPos)
|
||||
theOutput.Truncate(aPos);
|
||||
result=PRBool(0<theOutput.Length());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @update gess 04/01/99
|
||||
|
|
|
@ -200,7 +200,6 @@ class nsParser : public nsIParser,
|
|||
*/
|
||||
virtual nsresult Parse(const nsAReadableString& aSourceBuffer,void* aKey,const nsString& aContentType,PRBool aEnableVerify=PR_FALSE,PRBool aLastCall=PR_FALSE,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
virtual PRBool IsValidFragment(const nsAReadableString& aSourceBuffer,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
virtual nsresult ParseFragment(const nsAReadableString& aSourceBuffer,void* aKey,nsITagStack& aStack,PRUint32 anInsertPos,const nsString& aContentType,nsDTDMode aMode=eDTDMode_autodetect);
|
||||
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "COtherDTD.h"
|
||||
#include "COtherDTD.h"
|
||||
#include "nsViewSourceHTML.h"
|
||||
#include "nsHTMLContentSinkStream.h"
|
||||
#include "nsHTMLEntities.h"
|
||||
#include "nsHTMLTokenizer.h"
|
||||
#include "nsXMLTokenizer.h"
|
||||
|
@ -156,7 +155,6 @@ static NS_DEFINE_CID(kNavDTDCID, NS_CNAVDTD_CID);
|
|||
static NS_DEFINE_CID(kCOtherDTDCID, NS_COTHER_DTD_CID);
|
||||
static NS_DEFINE_CID(kCTransitionalDTDCID, NS_CTRANSITIONAL_DTD_CID);
|
||||
static NS_DEFINE_CID(kViewSourceDTDCID, NS_VIEWSOURCE_DTD_CID);
|
||||
static NS_DEFINE_CID(kHTMLContentSinkStreamCID, NS_HTMLCONTENTSINKSTREAM_CID);
|
||||
static NS_DEFINE_CID(kParserServiceCID, NS_PARSERSERVICE_CID);
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParser)
|
||||
|
@ -166,7 +164,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(CNavDTD)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(COtherDTD)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(CTransitionalDTD)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(CViewSourceHTML)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHTMLContentSinkStream)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsParserService)
|
||||
|
||||
static nsModuleComponentInfo gComponents[] = {
|
||||
|
@ -178,8 +175,6 @@ static nsModuleComponentInfo gComponents[] = {
|
|||
{ "Transitional DTD", NS_CTRANSITIONAL_DTD_CID, NULL,
|
||||
CTransitionalDTDConstructor },
|
||||
{ "ViewSource DTD", NS_VIEWSOURCE_DTD_CID, NULL, CViewSourceHTMLConstructor },
|
||||
{ "HTML Content Sink Stream", NS_HTMLCONTENTSINKSTREAM_CID, NULL,
|
||||
nsHTMLContentSinkStreamConstructor },
|
||||
{ "ParserService", NS_PARSERSERVICE_CID, NULL, nsParserServiceConstructor }
|
||||
};
|
||||
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))
|
||||
|
|
|
@ -1160,12 +1160,6 @@ nsLoggingSink_CID = { /* a6cf910d-15b3-11d2-932e-00805f8add32 */
|
|||
0x11d2,
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}
|
||||
};
|
||||
nsHTMLContentSinkStream_CID = { /* a6cf910f-15b3-11d2-932e-00805f8add32 */
|
||||
0xa6cf910f,
|
||||
0x15b3,
|
||||
0x11d2,
|
||||
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}
|
||||
};
|
||||
nsIParserService = { /* a6cf9111-15b3-11d2-932e-00805f8add32 */
|
||||
0xa6cf9111,
|
||||
0x15b3,
|
||||
|
|
Загрузка…
Ссылка в новой задаче