diff --git a/htmlparser/.cvsignore b/htmlparser/.cvsignore
deleted file mode 100644
index f3c7a7c5da68..000000000000
--- a/htmlparser/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/htmlparser/public/.cvsignore b/htmlparser/public/.cvsignore
deleted file mode 100644
index f3c7a7c5da68..000000000000
--- a/htmlparser/public/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/htmlparser/public/nsHTMLTagList.h b/htmlparser/public/nsHTMLTagList.h
deleted file mode 100644
index 5d366461666c..000000000000
--- a/htmlparser/public/nsHTMLTagList.h
+++ /dev/null
@@ -1,193 +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) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 contains the list of all HTML tags
- See nsHTMLTags.h for access to the enum values for tags
-
- It is designed to be used as inline input to nsHTMLTags.cpp and
- nsHTMLContentSink *only* through the magic of C preprocessing.
-
- All entires must be enclosed in the macro HTML_TAG which will have cruel
- and unusual things done to it
-
- It is recommended (but not strictly necessary) to keep all entries
- in alphabetical order
-
- The first argument to HTML_TAG is both the enum identifier of the
- property and the string value. The second argument is the "creator"
- method of the form NS_New$TAGNAMEElement, that will be used by
- nsHTMLContentSink.cpp to create a content object for a tag of that
- type. Use NOTUSED, if the particular tag has a non-standard creator.
-
- The HTML_OTHER macro is for values in the nsHTMLTag enum that are
- not strictly tags.
-
- Entries *must* use only lowercase characters.
-
- ** Break these invarient and bad things will happen. **
-
- ******/
-HTML_TAG(a, Anchor)
-HTML_TAG(abbr, Span)
-HTML_TAG(acronym, Span)
-HTML_TAG(address, Span)
-HTML_TAG(applet, Applet)
-HTML_TAG(area, Area)
-HTML_TAG(b, Span)
-HTML_TAG(base, Shared)
-HTML_TAG(basefont, Shared)
-HTML_TAG(bdo, Span)
-HTML_TAG(bgsound, Span)
-HTML_TAG(big, Span)
-HTML_TAG(blink, Span)
-HTML_TAG(blockquote, Shared)
-HTML_TAG(body, Body)
-HTML_TAG(br, BR)
-HTML_TAG(button, Button)
-HTML_TAG(caption, TableCaption)
-HTML_TAG(center, Span)
-HTML_TAG(cite, Span)
-HTML_TAG(code, Span)
-HTML_TAG(col, TableCol)
-HTML_TAG(colgroup, TableCol)
-HTML_TAG(counter, Span)
-HTML_TAG(dd, Span)
-HTML_TAG(del, Mod)
-HTML_TAG(dfn, Span)
-HTML_TAG(dir, Shared)
-HTML_TAG(div, Div)
-HTML_TAG(dl, SharedList)
-HTML_TAG(dt, Span)
-HTML_TAG(em, Span)
-HTML_TAG(embed, Shared)
-HTML_TAG(endnote, Span)
-HTML_TAG(fieldset, FieldSet)
-HTML_TAG(font, Font)
-HTML_TAG(form, NOTUSED)
-HTML_TAG(frame, Frame)
-HTML_TAG(frameset, FrameSet)
-HTML_TAG(h1, Heading)
-HTML_TAG(h2, Heading)
-HTML_TAG(h3, Heading)
-HTML_TAG(h4, Heading)
-HTML_TAG(h5, Heading)
-HTML_TAG(h6, Heading)
-HTML_TAG(head, Head)
-HTML_TAG(hr, HR)
-HTML_TAG(html, Html)
-HTML_TAG(i, Span)
-HTML_TAG(iframe, IFrame)
-HTML_TAG(image, Span)
-HTML_TAG(img, Image)
-HTML_TAG(input, NOTUSED)
-HTML_TAG(ins, Mod)
-HTML_TAG(isindex, Shared)
-HTML_TAG(kbd, Span)
-HTML_TAG(keygen, Span)
-HTML_TAG(label, Label)
-HTML_TAG(legend, Legend)
-HTML_TAG(li, LI)
-HTML_TAG(link, Link)
-HTML_TAG(listing, Span)
-HTML_TAG(map, Map)
-HTML_TAG(marquee, Div)
-HTML_TAG(menu, Shared)
-HTML_TAG(meta, Meta)
-HTML_TAG(multicol, Span)
-HTML_TAG(nobr, Span)
-HTML_TAG(noembed, Div)
-HTML_TAG(noframes, Div)
-HTML_TAG(noscript, Div)
-HTML_TAG(object, Object)
-HTML_TAG(ol, SharedList)
-HTML_TAG(optgroup, OptGroup)
-HTML_TAG(option, Option)
-HTML_TAG(p, Paragraph)
-HTML_TAG(param, Shared)
-HTML_TAG(parsererror, Div)
-HTML_TAG(plaintext, Span)
-HTML_TAG(pre, Pre)
-HTML_TAG(q, Shared)
-HTML_TAG(s, Span)
-HTML_TAG(samp, Span)
-HTML_TAG(script, Script)
-HTML_TAG(select, NOTUSED)
-HTML_TAG(server, Span)
-HTML_TAG(small, Span)
-HTML_TAG(sound, Span)
-HTML_TAG(sourcetext, Div)
-HTML_TAG(spacer, Shared)
-HTML_TAG(span, Span)
-HTML_TAG(strike, Span)
-HTML_TAG(strong, Span)
-HTML_TAG(style, Style)
-HTML_TAG(sub, Span)
-HTML_TAG(sup, Span)
-HTML_TAG(table, Table)
-HTML_TAG(tbody, TableSection)
-HTML_TAG(td, TableCell)
-HTML_TAG(textarea, TextArea)
-HTML_TAG(tfoot, TableSection)
-HTML_TAG(th, TableCell)
-HTML_TAG(thead, TableSection)
-HTML_TAG(title, Title)
-HTML_TAG(tr, TableRow)
-HTML_TAG(tt, Span)
-HTML_TAG(u, Span)
-HTML_TAG(ul, SharedList)
-HTML_TAG(var, Span)
-HTML_TAG(wbr, Shared)
-HTML_TAG(xmp, Span)
-
-
-/* These are not for tags. But they will be included in the nsHTMLTag
- enum anyway */
-
-/* XXX: The second parameters in some of the following entries look
- like they are just wrong. They should really be NOTUSED. For now,
- I'm just emulating what nsHTMLContentSink has done all along.
-*/
-HTML_OTHER(text, Span)
-HTML_OTHER(whitespace, Span)
-HTML_OTHER(newline, Span)
-HTML_OTHER(comment, Span)
-HTML_OTHER(entity, Span)
-HTML_OTHER(doctypeDecl, Span)
-HTML_OTHER(markupDecl, Span)
-HTML_OTHER(instruction, Span)
diff --git a/htmlparser/public/nsHTMLTags.h b/htmlparser/public/nsHTMLTags.h
deleted file mode 100644
index f9243468948c..000000000000
--- a/htmlparser/public/nsHTMLTags.h
+++ /dev/null
@@ -1,82 +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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsHTMLTags_h___
-#define nsHTMLTags_h___
-
-#include "nsAString.h"
-
-class nsIAtom;
-
-/*
- Declare the enum list using the magic of preprocessing
- enum values are "eHTMLTag_foo" (where foo is the tag)
-
- To change the list of tags, see nsHTMLTagList.h
-
- */
-#define HTML_TAG(_tag, _classname) eHTMLTag_##_tag,
-#define HTML_OTHER(_tag, _classname) eHTMLTag_##_tag,
-enum nsHTMLTag {
- /* this enum must be first and must be zero */
- eHTMLTag_unknown = 0,
-#include "nsHTMLTagList.h"
-
- /* can't be moved into nsHTMLTagList since gcc3.4 doesn't like a
- comma at the end of enum list*/
- eHTMLTag_userdefined
-};
-#undef HTML_TAG
-#undef HTML_OTHER
-
-// Currently there are 110 HTML tags. eHTMLTag_text = 112.
-#define NS_HTML_TAG_MAX PRInt32(eHTMLTag_text - 1)
-
-class nsHTMLTags {
-public:
- static nsresult AddRefTable(void);
- static void ReleaseTable(void);
-
- static nsHTMLTag LookupTag(const nsAString& aTagName);
- static nsHTMLTag CaseSensitiveLookupTag(const PRUnichar* aTagName);
- static const PRUnichar *GetStringValue(nsHTMLTag aEnum);
- static nsIAtom *GetAtom(nsHTMLTag aEnum);
-};
-
-#define eHTMLTags nsHTMLTag
-
-#endif /* nsHTMLTags_h___ */
diff --git a/htmlparser/public/nsHTMLTokens.h b/htmlparser/public/nsHTMLTokens.h
deleted file mode 100644
index ae8b75263beb..000000000000
--- a/htmlparser/public/nsHTMLTokens.h
+++ /dev/null
@@ -1,512 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- * This file contains the declarations for all the HTML specific token types that
- * our DTD's understand. In fact, the same set of token types are used for XML.
- * Currently we have tokens for text, comments, start and end tags, entities,
- * attributes, style, script and skipped content. Whitespace and newlines also
- * have their own token types, but don't count on them to stay forever.
- *
- * If you're looking for the html tags, they're in a file called nsHTMLTag.h/cpp.
- *
- * Most of the token types have a similar API. They have methods to get the type
- * of token (GetTokenType); those that represent HTML tags also have a method to
- * get type tag type (GetTypeID). In addition, most have a method that causes the
- * token to help in the parsing process called (Consume). We've also thrown in a
- * few standard debugging methods as well.
- */
-
-#ifndef HTMLTOKENS_H
-#define HTMLTOKENS_H
-
-#include "nsToken.h"
-#include "nsHTMLTags.h"
-#include "nsParserError.h"
-#include "nsString.h"
-#include "nsScannerString.h"
-
-class nsScanner;
-
- /*******************************************************************
- * This enum defines the set of token types that we currently support.
- *******************************************************************/
-
-enum eHTMLTokenTypes {
- eToken_unknown=0,
- eToken_start=1, eToken_end, eToken_comment, eToken_entity,
- eToken_whitespace, eToken_newline, eToken_text, eToken_attribute,
- eToken_script, eToken_style, eToken_skippedcontent, eToken_instruction,
- eToken_cdatasection, eToken_error, eToken_doctypeDecl, eToken_markupDecl,
- eToken_last //make sure this stays the last token...
-};
-
-enum eHTMLCategory {
- eHTMLCategory_unknown=0,
- eHTMLCategory_inline,
- eHTMLCategory_block,
- eHTMLCategory_blockAndInline,
- eHTMLCategory_list,
- eHTMLCategory_table,
- eHTMLCategory_tablepart,
- eHTMLCategory_tablerow,
- eHTMLCategory_tabledata,
- eHTMLCategory_head,
- eHTMLCategory_html,
- eHTMLCategory_body,
- eHTMLCategory_form,
- eHTMLCategory_options,
- eHTMLCategory_frameset,
- eHTMLCategory_text
-};
-
-
-nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScanner);
-nsresult ConsumeAttributeText(PRUnichar aChar,nsString& aString,nsScanner& aScanner);
-const PRUnichar* GetTagName(PRInt32 aTag);
-//PRInt32 FindEntityIndex(nsString& aString,PRInt32 aCount=-1);
-
-
-
-/**
- * This declares the basic token type used in the HTML DTD's.
- * @update gess 3/25/98
- */
-class CHTMLToken : public CToken {
-public:
- virtual ~CHTMLToken();
- CHTMLToken(eHTMLTags aTag);
-
- virtual eContainerInfo GetContainerInfo(void) const {return eFormUnknown;}
- virtual void SetContainerInfo(eContainerInfo aInfo) { }
-
-protected:
-};
-
-/**
- * This declares start tokens, which always take the form .
- * This class also knows how to consume related attributes.
- *
- * @update gess 3/25/98
- */
-class CStartToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CStartToken(eHTMLTags aTag=eHTMLTag_unknown);
- CStartToken(const nsAString& aString);
- CStartToken(const nsAString& aName,eHTMLTags aTag);
-
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTypeID(void);
- virtual PRInt32 GetTokenType(void);
-
- virtual PRBool IsEmpty(void);
- virtual void SetEmpty(PRBool aValue);
-
- virtual const nsAString& GetStringValue();
- virtual void GetSource(nsString& anOutputString);
- virtual void AppendSourceTo(nsAString& anOutputString);
-
- // the following info is used to set well-formedness state on start tags...
- virtual eContainerInfo GetContainerInfo(void) const {return mContainerInfo;}
- virtual void SetContainerInfo(eContainerInfo aContainerInfo) {
- mContainerInfo=aContainerInfo;
- }
- virtual PRBool IsWellFormed(void) const {
- return eWellFormed == mContainerInfo;
- }
-
- nsString mTextValue;
- nsString mTrailingContent;
-protected:
- eContainerInfo mContainerInfo;
- PRPackedBool mEmpty;
-#ifdef DEBUG
- PRPackedBool mAttributed;
-#endif
-};
-
-
-/**
- * This declares end tokens, which always take the
- * form . This class also knows how to consume
- * related attributes.
- *
- * @update gess 3/25/98
- */
-class CEndToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CEndToken(eHTMLTags aTag);
- CEndToken(const nsAString& aString);
- CEndToken(const nsAString& aName,eHTMLTags aTag);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTypeID(void);
- virtual PRInt32 GetTokenType(void);
-
- virtual const nsAString& GetStringValue();
- virtual void GetSource(nsString& anOutputString);
- virtual void AppendSourceTo(nsAString& anOutputString);
-
-protected:
- nsString mTextValue;
-};
-
-
-/**
- * This declares comment tokens. Comments are usually
- * thought of as tokens, but we treat them that way
- * here so that the parser can have a consistent view
- * of all tokens.
- *
- * @update gess 3/25/98
- */
-class CCommentToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CCommentToken();
- CCommentToken(const nsAString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
- virtual void AppendSourceTo(nsAString& anOutputString);
-
- nsresult ConsumeStrictComment(nsScanner& aScanner);
- nsresult ConsumeQuirksComment(nsScanner& aScanner);
-
-protected:
- nsScannerSubstring mComment; // does not include MDO & MDC
- nsScannerSubstring mCommentDecl; // includes MDO & MDC
-};
-
-
-/**
- * This class declares entity tokens, which always take
- * the form &xxxx;. This class also offers a few utility
- * methods that allow you to easily reduce entities.
- *
- * @update gess 3/25/98
- */
-class CEntityToken : public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CEntityToken();
- CEntityToken(const nsAString& aString);
- virtual PRInt32 GetTokenType(void);
- PRInt32 TranslateToUnicodeStr(nsString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- static nsresult ConsumeEntity(PRUnichar aChar, nsString& aString,
- nsScanner& aScanner);
- static PRInt32 TranslateToUnicodeStr(PRInt32 aValue,nsString& aString);
-
- virtual const nsAString& GetStringValue(void);
- virtual void GetSource(nsString& anOutputString);
- virtual void AppendSourceTo(nsAString& anOutputString);
-
-protected:
- nsString mTextValue;
-};
-
-
-/**
- * Whitespace tokens are used where whitespace can be
- * detected as distinct from text. This allows us to
- * easily skip leading/trailing whitespace when desired.
- *
- * @update gess 3/25/98
- */
-class CWhitespaceToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CWhitespaceToken();
- CWhitespaceToken(const nsAString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
-protected:
- nsString mTextValue;
-};
-
-/**
- * Text tokens contain the normalized form of html text.
- * These tokens are guaranteed not to contain entities,
- * start or end tags, or newlines.
- *
- * @update gess 3/25/98
- */
-class CTextToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CTextToken();
- CTextToken(const nsAString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- nsresult ConsumeUntil(PRUnichar aChar, PRBool aIgnoreComments,
- nsScanner& aScanner, nsString& aEndTagName,
- PRInt32 aFlag, PRBool& aFlushTokens);
- virtual PRInt32 GetTokenType(void);
- virtual PRInt32 GetTextLength(void);
- virtual void CopyTo(nsAString& aStr);
- virtual const nsAString& GetStringValue(void);
- virtual void Bind(nsScanner* aScanner, nsScannerIterator& aStart,
- nsScannerIterator& aEnd);
- virtual void Bind(const nsAString& aStr);
-
-protected:
- nsScannerSubstring mTextValue;
-};
-
-
-/**
- * CDATASection tokens contain raw unescaped text content delimited by
- * a ![CDATA[ and ]].
- * XXX Not really a HTML construct - maybe we need a separation
- *
- * @update vidur 11/12/98
- */
-class CCDATASectionToken : public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CCDATASectionToken(eHTMLTags aTag = eHTMLTag_unknown);
- CCDATASectionToken(const nsAString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
-protected:
- nsString mTextValue;
-};
-
-
-/**
- * Declaration tokens contain raw unescaped text content (not really, but
- * right now we use this only for view source).
- * XXX Not really a HTML construct - maybe we need a separation
- *
- */
-class CMarkupDeclToken : public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CMarkupDeclToken();
- CMarkupDeclToken(const nsAString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
-protected:
- nsScannerSubstring mTextValue;
-};
-
-
-/**
- * Attribute tokens are used to contain attribute key/value
- * pairs whereever they may occur. Typically, they should
- * occur only in start tokens. However, we may expand that
- * ability when XML tokens become commonplace.
- *
- * @update gess 3/25/98
- */
-class CAttributeToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CAttributeToken();
- CAttributeToken(const nsAString& aString);
- CAttributeToken(const nsAString& aKey, const nsAString& aString);
- ~CAttributeToken() {}
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetKey(void); // XXX {return mTextKey;}
- virtual void SetKey(const nsAString& aKey);
- virtual void BindKey(nsScanner* aScanner, nsScannerIterator& aStart,
- nsScannerIterator& aEnd);
- virtual const nsAString& GetValue(void) {return mTextValue;}
- virtual void SanitizeKey();
- virtual const nsAString& GetStringValue(void);
- virtual void GetSource(nsString& anOutputString);
- virtual void AppendSourceTo(nsAString& anOutputString);
-
- PRPackedBool mHasEqualWithoutValue;
-protected:
-#ifdef DEBUG
- PRPackedBool mLastAttribute;
-#endif
- nsAutoString mTextValue;
- nsScannerSubstring mTextKey;
-};
-
-
-/**
- * Newline tokens contain, you guessed it, newlines.
- * They consume newline (CR/LF) either alone or in pairs.
- *
- * @update gess 3/25/98
- */
-class CNewlineToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CNewlineToken();
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
- static void AllocNewline();
- static void FreeNewline();
-};
-
-
-/**
- * Script tokens contain sequences of javascript (or, gulp,
- * any other script you care to send). We don't tokenize
- * it here, nor validate it. We just wrap it up, and pass
- * it along to the html parser, who sends it (later on)
- * to the scripting engine.
- *
- * @update gess 3/25/98
- */
-class CScriptToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CScriptToken();
- CScriptToken(const nsAString& aString);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
-protected:
- nsString mTextValue;
-};
-
-
-/**
- * Style tokens contain sequences of css style. We don't
- * tokenize it here, nor validate it. We just wrap it up,
- * and pass it along to the html parser, who sends it
- * (later on) to the style engine.
- *
- * @update gess 3/25/98
- */
-class CStyleToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CStyleToken();
- CStyleToken(const nsAString& aString);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
-protected:
- nsString mTextValue;
-};
-
-
-/**
- * Whitespace tokens are used where whitespace can be
- * detected as distinct from text. This allows us to
- * easily skip leading/trailing whitespace when desired.
- *
- * @update gess 3/25/98
- */
-class CInstructionToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CInstructionToken();
- CInstructionToken(const nsAString& aString);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
-
-protected:
- nsString mTextValue;
-};
-
-class CErrorToken : public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CErrorToken(nsParserError* aError=0);
- ~CErrorToken();
- virtual PRInt32 GetTokenType(void);
-
- void SetError(nsParserError* aError); // CErrorToken takes ownership of aError
-
- // The nsParserError object returned by GetError is still owned by CErrorToken.
- // DO NOT use the delete operator on it. Should we change this so that a copy
- // of nsParserError is returned which needs to be destroyed by the consumer?
- const nsParserError* GetError(void);
-
- virtual const nsAString& GetStringValue(void);
-protected:
- nsString mTextValue;
- nsParserError* mError;
-};
-
-/**
- * This token is generated by the HTML and Expat tokenizers
- * when they see the doctype declaration ("")
- *
- */
-
-class CDoctypeDeclToken: public CHTMLToken {
- CTOKEN_IMPL_SIZEOF
-
-public:
- CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown);
- CDoctypeDeclToken(const nsAString& aString,eHTMLTags aTag=eHTMLTag_unknown);
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
- virtual PRInt32 GetTokenType(void);
- virtual const nsAString& GetStringValue(void);
- virtual void SetStringValue(const nsAString& aStr);
-
-protected:
- nsString mTextValue;
-};
-
-#endif
diff --git a/htmlparser/public/nsIContentSink.h b/htmlparser/public/nsIContentSink.h
deleted file mode 100644
index 0a8b9d7364fd..000000000000
--- a/htmlparser/public/nsIContentSink.h
+++ /dev/null
@@ -1,124 +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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIContentSink_h___
-#define nsIContentSink_h___
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- * This pure virtual interface is used as the "glue" that connects the parsing
- * process to the content model construction process.
- *
- * The icontentsink interface is a very lightweight wrapper that represents the
- * content-sink model building process. There is another one that you may care
- * about more, which is the IHTMLContentSink interface. (See that file for details).
- */
-#include "nsISupports.h"
-#include "nsString.h"
-
-class nsIParser;
-
-#define NS_ICONTENT_SINK_IID \
-{ 0xa6cf9052, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-// The base value for the content ID counter.
-// Values greater than or equal to this base value are used
-// by each of the content sinks to assign unique values
-// to the content objects created by them.
-#define NS_CONTENT_ID_COUNTER_BASE 10000
-
-class nsIContentSink : public nsISupports {
-public:
-
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTENT_SINK_IID)
-
- /**
- * This method gets called when the parser begins the process
- * of building the content model via the content sink.
- *
- * @update 5/7/98 gess
- */
- NS_IMETHOD WillBuildModel(void)=0;
-
- /**
- * This method gets called when the parser concludes the process
- * of building the content model via the content sink.
- *
- * @update 5/7/98 gess
- */
- NS_IMETHOD DidBuildModel()=0;
-
- /**
- * This method gets called when the parser gets i/o blocked,
- * and wants to notify the sink that it may be a while before
- * more data is available.
- *
- * @update 5/7/98 gess
- */
- NS_IMETHOD WillInterrupt(void)=0;
-
- /**
- * This method gets called when the parser i/o gets unblocked,
- * and we're about to start dumping content again to the sink.
- *
- * @update 5/7/98 gess
- */
- NS_IMETHOD WillResume(void)=0;
-
- /**
- * This method gets called by the parser so that the content
- * sink can retain a reference to the parser. The expectation
- * is that the content sink will drop the reference when it
- * gets the DidBuildModel notification i.e. when parsing is done.
- */
- NS_IMETHOD SetParser(nsIParser* aParser)=0;
-
- /**
- * Flush all pending notifications so that the content model
- * is in sync with the state of the sink.
- */
- NS_IMETHOD FlushPendingNotifications()=0;
-
- /**
- * Set the document character set. This should be passed on to the
- * document itself.
- */
- NS_IMETHOD SetDocumentCharset(nsACString& aCharset)=0;
-};
-
-#endif /* nsIContentSink_h___ */
diff --git a/htmlparser/public/nsIDTD.h b/htmlparser/public/nsIDTD.h
deleted file mode 100644
index 470e1663c4e9..000000000000
--- a/htmlparser/public/nsIDTD.h
+++ /dev/null
@@ -1,252 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** 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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIDTD_h___
-#define nsIDTD_h___
-
-/**
- * MODULE NOTES:
- * @update gess 7/20/98
- *
- * This interface defines standard interface for DTD's. Note that this
- * isn't HTML specific. DTD's have several functions within the parser
- * system:
- * 1) To coordinate the consumption of an input stream via the
- * parser
- * 2) To serve as proxy to represent the containment rules of the
- * underlying document
- * 3) To offer autodetection services to the parser (mainly for doc
- * conversion)
- * */
-
-#include "nsISupports.h"
-#include "nsString.h"
-#include "prtypes.h"
-#include "nsITokenizer.h"
-
-#define NS_IDTD_IID \
- { 0xa6cf9053, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-enum eAutoDetectResult {
- eUnknownDetect,
- eValidDetect,
- ePrimaryDetect,
- eInvalidDetect
-};
-
-enum nsDTDMode {
- eDTDMode_unknown = 0,
- eDTDMode_quirks, //pre 4.0 versions
- eDTDMode_almost_standards,
- eDTDMode_full_standards,
- eDTDMode_autodetect,
- eDTDMode_fragment
-};
-
-
-class nsIParser;
-class CToken;
-class nsIURI;
-class nsIContentSink;
-class CParserContext;
-class nsIAtom;
-
-class nsIDTD : public nsISupports
-{
-public:
-
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDTD_IID)
-
-
- NS_IMETHOD_(const nsIID&) GetMostDerivedIID(void) const = 0;
-
- /**
- * Call this method if you want the DTD to construct a clone of itself.
- * @update gess7/23/98
- * @param
- * @return
- */
- NS_IMETHOD CreateNewInstance(nsIDTD** aInstancePtrResult) = 0;
-
- /**
- * This method is called to determine if the given DTD can parse
- * a document in a given source-type.
- * NOTE: Parsing always assumes that the end result will involve
- * storing the result in the main content model.
- * @update gess6/24/98
- * @param aContentType -- string representing type of doc to be
- * converted (ie text/html)
- * @return TRUE if this DTD can satisfy the request; FALSE otherwise.
- */
- NS_IMETHOD_(eAutoDetectResult) CanParse(CParserContext& aParserContext,
- const nsString& aBuffer,
- PRInt32 aVersion) = 0;
-
- NS_IMETHOD WillBuildModel(const CParserContext& aParserContext,
- nsITokenizer* aTokenizer,
- nsIContentSink* aSink) = 0;
-
- /**
- * Called by the parser after the parsing process has concluded
- * @update gess5/18/98
- * @param anErrorCode - contains error code resulting from parse process
- * @return
- */
- NS_IMETHOD DidBuildModel(nsresult anErrorCode, PRBool aNotifySink,
- nsIParser* aParser,
- nsIContentSink* aSink) = 0;
-
- /**
- * Called by the parser after the parsing process has concluded
- * @update gess5/18/98
- * @param anErrorCode - contains error code resulting from parse process
- * @return
- */
- NS_IMETHOD BuildModel(nsIParser* aParser, nsITokenizer* aTokenizer,
- nsITokenObserver* anObserver,
- nsIContentSink* aSink) = 0;
-
- /**
- * Called during model building phase of parse process. Each token
- * created during the parse phase is stored in a deque (in the
- * parser) and are passed to this method so that the DTD can
- * process the token. Ultimately, the DTD will transform given
- * token into calls onto a contentsink.
- * @update gess 3/25/98
- * @param aToken -- token object to be put into content model
- * @return error code (usually 0)
- */
- NS_IMETHOD HandleToken(CToken* aToken,nsIParser* aParser) = 0;
-
- /**
- * If the parse process gets interrupted midway, this method is
- * called by the parser prior to resuming the process.
- * @update gess5/18/98
- * @return ignored
- */
- NS_IMETHOD WillResumeParse(nsIContentSink* aSink) = 0;
-
- /**
- * If the parse process gets interrupted, this method is called by
- * the parser to notify the DTD that interruption will occur.
- * @update gess5/18/98
- * @return ignored
- */
- NS_IMETHOD WillInterruptParse(nsIContentSink* aSink) = 0;
-
- /**
- * This method is called to determine whether or not a tag of one
- * type can contain a tag of another type.
- *
- * @update gess 3/25/98
- * @param aParent -- int tag of parent container
- * @param aChild -- int tag of child container
- * @return PR_TRUE if parent can contain child
- */
- NS_IMETHOD_(PRBool) CanContain(PRInt32 aParent,PRInt32 aChild) const = 0;
-
- /**
- * This method gets called to determine whether a given
- * tag is itself a container
- *
- * @update gess 3/25/98
- * @param aTag -- tag to test for containership
- * @return PR_TRUE if given tag can contain other tags
- */
- NS_IMETHOD_(PRBool) IsContainer(PRInt32 aTag) const = 0;
-
- /**
- * Use this id you want to stop the building content model
- * --------------[ Sets DTD to STOP mode ]----------------
- * It's recommended to use this method in accordance with
- * the parser's terminate() method.
- *
- * @update harishd 07/22/99
- * @param
- * @return
- */
- NS_IMETHOD_(void) Terminate() = 0;
-
- NS_IMETHOD_(PRInt32) GetType() = 0;
-
- NS_IMETHOD CollectSkippedContent(PRInt32 aTag, nsAString& aContent, PRInt32 &aLineNo) = 0;
-
-/* XXX Temporary measure, pending further work by RickG */
-
-
- // Whaaaa! These are useless methods, use nsIParserService!
-
-
- /**
- * Give rest of world access to our tag enums, so that CanContain(), etc,
- * become useful.
- */
- NS_IMETHOD StringTagToIntTag(const nsAString &aTag,
- PRInt32* aIntTag) const = 0;
-
- NS_IMETHOD_(const PRUnichar *) IntTagToStringTag(PRInt32 aIntTag) const = 0;
-
- NS_IMETHOD_(nsIAtom *) IntTagToAtom(PRInt32 aIntTag) const = 0;
-
- NS_IMETHOD_(PRBool) IsBlockElement(PRInt32 aTagID,
- PRInt32 aParentID) const = 0;
-
- NS_IMETHOD_(PRBool) IsInlineElement(PRInt32 aTagID,
- PRInt32 aParentID) const = 0;
-};
-
-#define NS_DECL_NSIDTD \
- NS_IMETHOD_(const nsIID&) GetMostDerivedIID(void) const;\
- NS_IMETHOD CreateNewInstance(nsIDTD** aInstancePtrResult);\
- NS_IMETHOD_(eAutoDetectResult) CanParse(CParserContext& aParserContext, const nsString& aBuffer, PRInt32 aVersion);\
- NS_IMETHOD WillBuildModel( const CParserContext& aParserContext, nsITokenizer* aTokenizer, nsIContentSink* aSink);\
- NS_IMETHOD DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink);\
- NS_IMETHOD BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver,nsIContentSink* aSink);\
- NS_IMETHOD HandleToken(CToken* aToken,nsIParser* aParser);\
- NS_IMETHOD WillResumeParse(nsIContentSink* aSink = 0);\
- NS_IMETHOD WillInterruptParse(nsIContentSink* aSink = 0);\
- NS_IMETHOD_(PRBool) CanContain(PRInt32 aParent,PRInt32 aChild) const;\
- NS_IMETHOD_(PRBool) IsContainer(PRInt32 aTag) const;\
- NS_IMETHOD CollectSkippedContent(PRInt32 aTag, nsAString& aContent, PRInt32 &aLineNo);\
- NS_IMETHOD_(void) Terminate();\
- NS_IMETHOD_(PRInt32) GetType(); \
- NS_IMETHOD StringTagToIntTag(const nsAString &aTag, PRInt32* aIntTag) const ;\
- NS_IMETHOD_(const PRUnichar *) IntTagToStringTag(PRInt32 aIntTag) const ;\
- NS_IMETHOD_(nsIAtom *) IntTagToAtom(PRInt32 aIntTag) const;\
- NS_IMETHOD_(PRBool) IsBlockElement(PRInt32 aTagID,PRInt32 aParentID) const;\
- NS_IMETHOD_(PRBool) IsInlineElement(PRInt32 aTagID,PRInt32 aParentID) const;
-#endif /* nsIDTD_h___ */
diff --git a/htmlparser/public/nsIElementObserver.h b/htmlparser/public/nsIElementObserver.h
deleted file mode 100644
index ce995842128a..000000000000
--- a/htmlparser/public/nsIElementObserver.h
+++ /dev/null
@@ -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) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-
-/**
- * MODULE NOTES:
- * @update rickg 03.23.2000 //removed unused NS_PARSER_SUBJECT and predecl of nsString
- *
- */
-
-#ifndef nsIElementObserver_h__
-#define nsIElementObserver_h__
-
-#include "nsISupports.h"
-#include "prtypes.h"
-#include "nsHTMLTags.h"
-#include "nsVoidArray.h"
-
-
-// {4672AA04-F6AE-11d2-B3B7-00805F8A6670}
-#define NS_IELEMENTOBSERVER_IID \
-{ 0x4672aa04, 0xf6ae, 0x11d2, { 0xb3, 0xb7, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }
-
-
-class nsIElementObserver : public nsISupports {
-public:
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IELEMENTOBSERVER_IID)
-
- enum { IS_DOCUMENT_WRITE = 1U };
- /*
- * Subject call observer when the parser hit the tag
- * @param aDocumentID- ID of the document
- * @param aTag- the tag
- * @param numOfAttributes - number of attributes
- * @param nameArray - array of name.
- * @param valueArray - array of value
- */
- NS_IMETHOD Notify(PRUint32 aDocumentID, eHTMLTags aTag,
- PRUint32 numOfAttributes, const PRUnichar* nameArray[],
- const PRUnichar* valueArray[]) = 0;
-
- NS_IMETHOD Notify(PRUint32 aDocumentID, const PRUnichar* aTag,
- PRUint32 numOfAttributes, const PRUnichar* nameArray[],
- const PRUnichar* valueArray[]) = 0;
-
- NS_IMETHOD Notify(nsISupports* aWebShell,
- nsISupports* aChannel,
- const PRUnichar* aTag,
- const nsStringArray* aKeys,
- const nsStringArray* aValues,
- const PRUint32 aFlags) = 0;
-
-};
-
-#endif /* nsIElementObserver_h__ */
-
diff --git a/htmlparser/public/nsIExpatSink.idl b/htmlparser/public/nsIExpatSink.idl
deleted file mode 100644
index 146d42e34956..000000000000
--- a/htmlparser/public/nsIExpatSink.idl
+++ /dev/null
@@ -1,131 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nsISupports.idl"
-
-/**
- * This interface should be implemented by any content sink that wants
- * to get output from expat and do something with it; in other words,
- * by any sink that handles some sort of XML dialect.
- */
-
-[scriptable, uuid(1DEEA160-C661-11d5-84CC-0010A4E0C706)]
-interface nsIExpatSink : nsISupports
-{
- /**
- * Called to handle the opening tag of an element.
- * @param aName the fully qualified tagname of the element
- * @param aAtts the array of attribute names and values. There are
- * aAttsCount/2 names and aAttsCount/2 values, so the total number of
- * elements in the array is aAttsCount. The names and values
- * alternate. Thus, if we number attributes starting with 0,
- * aAtts[2*k] is the name of the k-th attribute and aAtts[2*k+1] is
- * the value of that attribute Both explicitly specified attributes
- * and attributes that are defined to have default values in a DTD are
- * present in aAtts.
- * @param aAttsCount the number of elements in aAtts.
- * @param aIndex If the element has an attribute of type ID, then
- * aAtts[aIndex] is the name of that attribute. Otherwise, aIndex
- * is -1
- * @param aLineNumber the line number of the start tag in the data stream.
- */
- void HandleStartElement(in wstring aName,
- [array, size_is(aAttsCount)] in wstring aAtts,
- in unsigned long aAttsCount,
- in long aIndex,
- in unsigned long aLineNumber);
-
- /**
- * Called to handle the closing tag of an element.
- * @param aName the fully qualified tagname of the element
- */
- void HandleEndElement(in wstring aName);
-
- /**
- * Called to handle a comment
- * @param aCommentText the text of the comment (not including the
- * "")
- */
- void HandleComment(in wstring aCommentText);
-
- /**
- * Called to handle a CDATA section
- * @param aData the text in the CDATA section. This is null-terminated.
- * @param aLength the length of the aData string
- */
- void HandleCDataSection([size_is(aLength)] in wstring aData,
- in unsigned long aLength);
-
- /**
- * Called to handle the doctype declaration
- */
- void HandleDoctypeDecl(in AString aSubset,
- in AString aName,
- in AString aSystemId,
- in AString aPublicId,
- in nsISupports aCatalogData);
-
- /**
- * Called to handle character data. Note that this does NOT get
- * called for the contents of CDATA sections.
- * @param aData the data to handle. aData is NOT NULL-TERMINATED.
- * @param aLength the length of the aData string
- */
- void HandleCharacterData([size_is(aLength)] in wstring aData,
- in unsigned long aLength);
-
- /**
- * Called to handle a processing instruction
- * @param aTarget the PI target (e.g. xml-stylesheet)
- * @param aData all the rest of the data in the PI
- */
- void HandleProcessingInstruction(in wstring aTarget,
- in wstring aData);
-
- /**
- * Handle the XML Declaration.
- *
- * @param aData The string.
- * @param aLength The length of the declaration from
- * opening '<' to closing '>'.
- **/
- void HandleXMLDeclaration([size_is(aLength)] in wstring aData,
- in unsigned long aLength);
-
- void ReportError(in wstring aErrorText,
- in wstring aSourceText);
-};
diff --git a/htmlparser/public/nsIHTMLContentSink.h b/htmlparser/public/nsIHTMLContentSink.h
deleted file mode 100644
index 42fbed761376..000000000000
--- a/htmlparser/public/nsIHTMLContentSink.h
+++ /dev/null
@@ -1,329 +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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIHTMLContentSink_h___
-#define nsIHTMLContentSink_h___
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- * This file declares the concrete HTMLContentSink class.
- * This class is used during the parsing process as the
- * primary interface between the parser and the content
- * model.
- *
- * After the tokenizer completes, the parser iterates over
- * the known token list. As the parser identifies valid
- * elements, it calls the contentsink interface to notify
- * the content model that a new node or child node is being
- * created and added to the content model.
- *
- * The HTMLContentSink interface assumes 4 underlying
- * containers: HTML, HEAD, BODY and FRAMESET. Before
- * accessing any these, the parser will call the appropriate
- * OpennsIHTMLContentSink method: OpenHTML,OpenHead,OpenBody,OpenFrameSet;
- * likewise, the ClosensIHTMLContentSink version will be called when the
- * parser is done with a given section.
- *
- * IMPORTANT: The parser may Open each container more than
- * once! This is due to the irregular nature of HTML files.
- * For example, it is possible to encounter plain text at
- * the start of an HTML document (that preceeds the HTML tag).
- * Such text is treated as if it were part of the body.
- * In such cases, the parser will Open the body, pass the text-
- * node in and then Close the body. The body will likely be
- * re-Opened later when the actual
tag has been seen.
- *
- * Containers within the body are Opened and Closed
- * using the OpenContainer(...) and CloseContainer(...) calls.
- * It is assumed that the document or contentSink is
- * maintaining its state to manage where new content should
- * be added to the underlying document.
- *
- * NOTE: OpenHTML() and OpenBody() may get called multiple times
- * in the same document. That's fine, and it doesn't mean
- * that we have multiple bodies or HTML's.
- *
- * NOTE: I haven't figured out how sub-documents (non-frames)
- * are going to be handled. Stay tuned.
- */
-#include "nsIParserNode.h"
-#include "nsIContentSink.h"
-#include "nsHTMLTags.h"
-
-#define NS_IHTML_CONTENT_SINK_IID \
- { 0xa6cf9051, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-
-#ifdef XP_MAC
-#define MAX_REFLOW_DEPTH 75 //setting to 75 to prevent layout from crashing on mac. Bug 55095.
-#else
-#define MAX_REFLOW_DEPTH 200 //windows and linux (etc) can do much deeper structures.
-#endif
-
-class nsIHTMLContentSink : public nsIContentSink
-{
-public:
-
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IHTML_CONTENT_SINK_IID)
-
- /**
- * This method gets called by the parser when it encounters
- * a title tag and wants to set the document title in the sink.
- *
- * @update 4/1/98 gess
- * @param nsString reference to new title value
- */
- NS_IMETHOD SetTitle(const nsString& aValue) = 0;
-
- /**
- * This method is used to open the outer HTML container.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenHTML(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is used to close the outer HTML container.
- *
- */
- NS_IMETHOD CloseHTML() = 0;
-
- /**
- * This method is used to open the only HEAD container.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenHead(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is used to close the only HEAD container.
- */
- NS_IMETHOD CloseHead() = 0;
-
- /**
- * This method is used to open the main BODY container.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenBody(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is used to close the main BODY container.
- *
- */
- NS_IMETHOD CloseBody() = 0;
-
- /**
- * This method is used to open a new FORM container.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenForm(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is used to close the outer FORM container.
- *
- */
- NS_IMETHOD CloseForm() = 0;
-
- /**
- * This method is used to open a new MAP container.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenMap(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is used to close the MAP container.
- *
- */
- NS_IMETHOD CloseMap() = 0;
-
- /**
- * This method is used to open the FRAMESET container.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenFrameset(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is used to close the FRAMESET container.
- *
- */
- NS_IMETHOD CloseFrameset() = 0;
-
- /**
- * This gets called when handling illegal contents, especially
- * in dealing with tables. This method creates a new context.
- *
- * @update 04/04/99 harishd
- * @param aPosition - The position from where the new context begins.
- */
- NS_IMETHOD BeginContext(PRInt32 aPosition) = 0;
-
- /**
- * This method terminates any new context that got created by
- * BeginContext and switches back to the main context.
- *
- * @update 04/04/99 harishd
- * @param aPosition - Validates the end of a context.
- */
- NS_IMETHOD EndContext(PRInt32 aPosition) = 0;
-
- /**
- * @update 01/09/2003 harishd
- * @param aTag - Check if this tag is enabled or not.
- */
- NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) = 0;
-
- /**
- * This method is called when parser is about to begin
- * synchronously processing a chunk of tokens.
- */
- NS_IMETHOD WillProcessTokens(void) = 0;
-
- /**
- * This method is called when parser has
- * completed processing a chunk of tokens. The processing of the
- * tokens may be interrupted by returning NS_ERROR_HTMLPARSER_INTERRUPTED from
- * DidProcessAToken.
- */
- NS_IMETHOD DidProcessTokens() = 0;
-
- /**
- * This method is called when parser is about to
- * process a single token
- */
- NS_IMETHOD WillProcessAToken(void) = 0;
-
- /**
- * This method is called when parser has completed
- * the processing for a single token.
- * @return NS_OK if processing should not be interrupted
- * NS_ERROR_HTMLPARSER_INTERRUPTED if the parsing should be interrupted
- */
- NS_IMETHOD DidProcessAToken(void) = 0;
-
- /**
- * This method is used to open a generic container in the sink.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD OpenContainer(const nsIParserNode& aNode) = 0;
-
- /**
- * This method gets called by the parser when a close
- * container tag has been consumed and needs to be closed.
- *
- * @param aTag - The tag to be closed.
- */
- NS_IMETHOD CloseContainer(const nsHTMLTag aTag) = 0;
-
- /**
- * This gets called by the parser to contents to
- * the head container
- *
- */
- NS_IMETHOD AddHeadContent(const nsIParserNode& aNode) = 0;
-
- /**
- * This gets called by the parser when you want to add
- * a leaf node to the current container in the content
- * model.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD AddLeaf(const nsIParserNode& aNode) = 0;
-
- /**
- * This gets called by the parser when you want to add
- * a leaf node to the current container in the content
- * model.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD AddComment(const nsIParserNode& aNode) = 0;
-
- /**
- * This gets called by the parser when you want to add
- * a leaf node to the current container in the content
- * model.
- *
- * @update 4/1/98 gess
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode) = 0;
-
- /**
- * This method is called by the parser when it encounters
- * a document type declaration.
- *
- * XXX Should the parser also part the internal subset?
- *
- * @param nsIParserNode reference to parser node interface
- */
- NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode) = 0;
-
- /**
- * This gets called by the parser to notify observers of
- * the tag
- *
- * @param aErrorResult the error code
- */
- NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) = 0;
-
- /**
- * Call this method to determnine if a FORM is on the sink's stack
- *
- * @return PR_TRUE if found else PR_FALSE
- */
- NS_IMETHOD_(PRBool) IsFormOnStack() = 0;
-
-};
-
-#endif /* nsIHTMLContentSink_h___ */
-
diff --git a/htmlparser/public/nsIHTMLFragmentContentSink.h b/htmlparser/public/nsIHTMLFragmentContentSink.h
deleted file mode 100644
index b91219cad6bc..000000000000
--- a/htmlparser/public/nsIHTMLFragmentContentSink.h
+++ /dev/null
@@ -1,75 +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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIHTMLFragmentContentSink_h___
-#define nsIHTMLFragmentContentSink_h___
-
-#include "nsIHTMLContentSink.h"
-
-#define NS_HTMLFRAGMENTSINK_CONTRACTID "@mozilla.org/layout/htmlfragmentsink;1"
-#define NS_HTMLFRAGMENTSINK2_CONTRACTID "@mozilla.org/layout/htmlfragmentsink;2"
-
-class nsIDOMDocumentFragment;
-class nsIDocument;
-
-#define NS_IHTML_FRAGMENT_CONTENT_SINK_IID \
- {0xa6cf9102, 0x15b3, 0x11d2, \
- {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-class nsIHTMLFragmentContentSink : public nsIHTMLContentSink {
-public:
- /**
- * This method is used to obtain the fragment created by
- * a fragment content sink. The value returned will be null
- * if the content sink hasn't yet received parser notifications.
- *
- */
- NS_IMETHOD GetFragment(nsIDOMDocumentFragment** aFragment) = 0;
-
- /**
- * This method is used to set the target document for this fragment
- * sink. This document's nodeinfo manager will be used to create
- * the content objects. This MUST be called before the sink is used.
- *
- * If aDocument is null or has no nodeinfo manager, the sink will
- * create a brand-new nodeinfo manager.
- *
- * @param aDocument the document the new nodes will belong to
- */
- NS_IMETHOD SetTargetDocument(nsIDocument* aDocument) = 0;
-};
-
-#endif
diff --git a/htmlparser/public/nsILoggingSink.h b/htmlparser/public/nsILoggingSink.h
deleted file mode 100644
index ba39191a333f..000000000000
--- a/htmlparser/public/nsILoggingSink.h
+++ /dev/null
@@ -1,55 +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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsILoggingSink_h___
-#define nsILoggingSink_h___
-
-#include "nsIHTMLContentSink.h"
-#include "nsString.h"
-#include "prprf.h"
-
-// IID for nsILoggingSink
-#define NS_ILOGGING_SINK_IID \
- {0xa6cf9061, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-class nsILoggingSink : public nsIHTMLContentSink {
-public:
- NS_IMETHOD SetOutputStream(PRFileDesc *aStream,PRBool autoDelete=PR_FALSE) =0;
-};
-
-extern "C" nsresult NS_NewHTMLLoggingSink(nsIContentSink** aInstancePtrResult);
-
-#endif /* nsILoggingSink_h___ */
diff --git a/htmlparser/public/nsIParser.h b/htmlparser/public/nsIParser.h
deleted file mode 100644
index 28790aa2ce7e..000000000000
--- a/htmlparser/public/nsIParser.h
+++ /dev/null
@@ -1,387 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** 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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 NS_IPARSER___
-#define NS_IPARSER___
-
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- * This class defines the iparser interface. This XPCOM
- * inteface is all that parser clients ever need to see.
- *
- **/
-
-#include "nsISupports.h"
-#include "nsIStreamListener.h"
-#include "nsIDTD.h"
-#include "nsIInputStream.h"
-#include "nsHashtable.h"
-#include "nsVoidArray.h"
-
-#define NS_IPARSER_IID \
- {0x355cbba0, 0xbf7d, 0x11d1, \
- {0xaa, 0xd9, 0x00, 0x80, 0x5f, 0x8a, 0x3e, 0x14}}
-
-// {41421C60-310A-11d4-816F-000064657374}
-#define NS_IDEBUG_DUMP_CONTENT_IID \
-{ 0x41421c60, 0x310a, 0x11d4, { 0x81, 0x6f, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } };
-
-class nsIContentSink;
-class nsIRequestObserver;
-class nsIParserFilter;
-class nsString;
-class nsIURI;
-class nsIChannel;
-
-enum eParserCommands {
- eViewNormal,
- eViewSource,
- eViewFragment,
- eViewErrors
-};
-
-enum eCRCQuality {
- eCRCGood = 0,
- eCRCFair,
- eCRCPoor
-};
-
-
-enum eParserDocType {
- ePlainText = 0,
- eXML,
- eHTML_Quirks,
- eHTML3_Quirks, // separate, for editor output, since HTML pre-4.0 lacks tbody
- eHTML_Strict
-};
-
-
-// define Charset source constants
-// note: the value order define the priority
-#define kCharsetUninitialized 0
-#define kCharsetFromWeakDocTypeDefault 1
-#define kCharsetFromUserDefault 2
-#define kCharsetFromDocTypeDefault 3
-#define kCharsetFromCache 4
-#define kCharsetFromParentFrame 5
-#define kCharsetFromBookmarks 6
-#define kCharsetFromAutoDetection 7
-#define kCharsetFromHintPrevDoc 8
-#define kCharsetFromMetaTag 9
-#define kCharsetFromByteOrderMark 10
-#define kCharsetFromChannel 11
-#define kCharsetFromParentForced 12
-#define kCharsetFromUserForced 13
-#define kCharsetFromOtherComponent 14
-#define kCharsetFromPreviousLoading 15
-
-enum eStreamState {eNone,eOnStart,eOnDataAvail,eOnStop};
-
-/**
- * FOR DEBUG PURPOSE ONLY
- *
- * Use this interface to query objects that contain content information.
- * Ex. Parser can trigger dump content by querying the sink that has
- * access to the content.
- *
- * @update harishd 05/25/00
- */
-class nsIDebugDumpContent : public nsISupports {
-public:
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDEBUG_DUMP_CONTENT_IID)
- NS_IMETHOD DumpContentModel()=0;
-};
-
-/**
- * This class defines the iparser interface. This XPCOM
- * inteface is all that parser clients ever need to see.
- *
- * @update gess 3/25/98
- */
-class nsIParser : public nsISupports {
- public:
-
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPARSER_IID)
-
- /**
- * Call this method if you have a DTD that you want to share with the parser.
- * Registered DTD's get remembered until the system shuts down.
- *
- * @update gess 3/25/98
- * @param aDTD -- ptr DTD that you're publishing the services of
- */
- NS_IMETHOD RegisterDTD(nsIDTD* aDTD)=0;
-
-
- /**
- * Select given content sink into parser for parser output
- * @update gess5/11/98
- * @param aSink is the new sink to be used by parser
- * @return
- */
- NS_IMETHOD_(void) SetContentSink(nsIContentSink* aSink)=0;
-
-
- /**
- * retrieve the sink set into the parser
- * @update gess5/11/98
- * @return current sink
- */
- NS_IMETHOD_(nsIContentSink*) GetContentSink(void)=0;
-
- /**
- * Call this method once you've created a parser, and want to instruct it
- * about the command which caused the parser to be constructed. For example,
- * this allows us to select a DTD which can do, say, view-source.
- *
- * @update gess 3/25/98
- * @param aCommand -- ptrs to string that contains command
- * @return nada
- */
- NS_IMETHOD_(void) GetCommand(nsString& aCommand)=0;
- NS_IMETHOD_(void) SetCommand(const char* aCommand)=0;
- NS_IMETHOD_(void) SetCommand(eParserCommands aParserCommand)=0;
-
- /**
- * Call this method once you've created a parser, and want to instruct it
- * about what charset to load
- *
- * @update ftang 4/23/99
- * @param aCharset- the charest of a document
- * @param aCharsetSource- the soure of the chares
- * @return nada
- */
- NS_IMETHOD_(void) SetDocumentCharset(const nsACString& aCharset, PRInt32 aSource)=0;
- NS_IMETHOD_(void) GetDocumentCharset(nsACString& oCharset, PRInt32& oSource)=0;
-
- NS_IMETHOD_(void) SetParserFilter(nsIParserFilter* aFilter) = 0;
-
- /**
- * Get the channel associated with this parser
- * @update harishd,gagan 07/17/01
- * @param aChannel out param that will contain the result
- * @return NS_OK if successful
- */
- NS_IMETHOD GetChannel(nsIChannel** aChannel) = 0;
-
- /**
- * Get the DTD associated with this parser
- * @update vidur 9/29/99
- * @param aDTD out param that will contain the result
- * @return NS_OK if successful, NS_ERROR_FAILURE for runtime error
- */
- NS_IMETHOD GetDTD(nsIDTD** aDTD) = 0;
-
- /******************************************************************************************
- * Parse methods always begin with an input source, and perform conversions
- * until you wind up being emitted to the given contentsink (which may or may not
- * be a proxy for the NGLayout content model).
- ******************************************************************************************/
-
- // Call this method to resume the parser from the blocked state..
- NS_IMETHOD ContinueParsing() = 0;
-
- // Stops parsing temporarily.
- NS_IMETHOD_(void) BlockParser() = 0;
-
- // Open up the parser for tokenization, building up content
- // model..etc. However, this method does not resume parsing
- // automatically. It's the callers' responsibility to restart
- // the parsing engine.
- NS_IMETHOD_(void) UnblockParser() = 0;
-
- NS_IMETHOD_(PRBool) IsParserEnabled() = 0;
- NS_IMETHOD_(PRBool) IsComplete() = 0;
-
- NS_IMETHOD Parse(nsIURI* aURL,
- nsIRequestObserver* aListener = nsnull,
- PRBool aEnableVerify = PR_FALSE,
- void* aKey = 0,
- nsDTDMode aMode = eDTDMode_autodetect) = 0;
- NS_IMETHOD Parse(nsIInputStream* aStream,
- const nsACString& aMimeType,
- PRBool aEnableVerify = PR_FALSE,
- void* aKey = 0,
- nsDTDMode aMode = eDTDMode_autodetect) = 0;
- NS_IMETHOD Parse(const nsAString& aSourceBuffer,
- void* aKey,
- const nsACString& aMimeType,
- PRBool aEnableVerify,
- PRBool aLastCall,
- nsDTDMode aMode = eDTDMode_autodetect) = 0;
-
- NS_IMETHOD Terminate(void) = 0;
-
- NS_IMETHOD ParseFragment(const nsAString& aSourceBuffer,
- void* aKey,
- nsVoidArray& aTagStack,
- PRUint32 anInsertPos,
- const nsACString& aContentType,
- nsDTDMode aMode = eDTDMode_autodetect) = 0;
-
- /**
- * This method gets called when the tokens have been consumed, and it's time
- * to build the model via the content sink.
- * @update gess5/11/98
- * @return error code -- 0 if model building went well .
- */
- NS_IMETHOD BuildModel(void) = 0;
-
-
- /**
- * Retrieve the parse mode from the parser...
- *
- * @update gess 6/9/98
- * @return ptr to scanner
- */
- NS_IMETHOD_(nsDTDMode) GetParseMode(void) = 0;
-
- /**
- * Call this method to cancel any pending parsing events.
- * Parsing events may be pending if all of the document's content
- * has been passed to the parser but the parser has been interrupted
- * because processing the tokens took too long.
- *
- * @update kmcclusk 05/18/01
- * @return NS_OK if succeeded else ERROR.
- */
-
- NS_IMETHOD CancelParsingEvents() = 0;
-};
-
-/* ===========================================================*
- Some useful constants...
- * ===========================================================*/
-
-#include "prtypes.h"
-#include "nsError.h"
-
-#define NS_ERROR_HTMLPARSER_EOF NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1000)
-#define NS_ERROR_HTMLPARSER_UNKNOWN NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1001)
-#define NS_ERROR_HTMLPARSER_CANTPROPAGATE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1002)
-#define NS_ERROR_HTMLPARSER_CONTEXTMISMATCH NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1003)
-#define NS_ERROR_HTMLPARSER_BADFILENAME NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1004)
-#define NS_ERROR_HTMLPARSER_BADURL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1005)
-#define NS_ERROR_HTMLPARSER_INVALIDPARSERCONTEXT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1006)
-#define NS_ERROR_HTMLPARSER_INTERRUPTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1007)
-#define NS_ERROR_HTMLPARSER_BLOCK NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1008)
-#define NS_ERROR_HTMLPARSER_BADTOKENIZER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1009)
-#define NS_ERROR_HTMLPARSER_BADATTRIBUTE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1010)
-#define NS_ERROR_HTMLPARSER_UNRESOLVEDDTD NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1011)
-#define NS_ERROR_HTMLPARSER_MISPLACEDTABLECONTENT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1012)
-#define NS_ERROR_HTMLPARSER_BADDTD NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1013)
-#define NS_ERROR_HTMLPARSER_BADCONTEXT NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1014)
-#define NS_ERROR_HTMLPARSER_STOPPARSING NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1015)
-#define NS_ERROR_HTMLPARSER_UNTERMINATEDSTRINGLITERAL NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1016)
-#define NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_HTMLPARSER,1017)
-
-
-#define NS_ERROR_HTMLPARSER_CONTINUE NS_OK
-
-
-const PRUint32 kEOF = NS_ERROR_HTMLPARSER_EOF;
-const PRUint32 kUnknownError = NS_ERROR_HTMLPARSER_UNKNOWN;
-const PRUint32 kCantPropagate = NS_ERROR_HTMLPARSER_CANTPROPAGATE;
-const PRUint32 kContextMismatch = NS_ERROR_HTMLPARSER_CONTEXTMISMATCH;
-const PRUint32 kBadFilename = NS_ERROR_HTMLPARSER_BADFILENAME;
-const PRUint32 kBadURL = NS_ERROR_HTMLPARSER_BADURL;
-const PRUint32 kInvalidParserContext = NS_ERROR_HTMLPARSER_INVALIDPARSERCONTEXT;
-const PRUint32 kBlocked = NS_ERROR_HTMLPARSER_BLOCK;
-const PRUint32 kBadStringLiteral = NS_ERROR_HTMLPARSER_UNTERMINATEDSTRINGLITERAL;
-const PRUint32 kHierarchyTooDeep = NS_ERROR_HTMLPARSER_HIERARCHYTOODEEP;
-
-const PRUnichar kNewLine = '\n';
-const PRUnichar kCR = '\r';
-const PRUnichar kLF = '\n';
-const PRUnichar kTab = '\t';
-const PRUnichar kSpace = ' ';
-const PRUnichar kQuote = '"';
-const PRUnichar kApostrophe = '\'';
-const PRUnichar kLessThan = '<';
-const PRUnichar kGreaterThan = '>';
-const PRUnichar kAmpersand = '&';
-const PRUnichar kForwardSlash = '/';
-const PRUnichar kBackSlash = '\\';
-const PRUnichar kEqual = '=';
-const PRUnichar kMinus = '-';
-const PRUnichar kPlus = '+';
-const PRUnichar kExclamation = '!';
-const PRUnichar kSemicolon = ';';
-const PRUnichar kHashsign = '#';
-const PRUnichar kAsterisk = '*';
-const PRUnichar kUnderbar = '_';
-const PRUnichar kComma = ',';
-const PRUnichar kLeftParen = '(';
-const PRUnichar kRightParen = ')';
-const PRUnichar kLeftBrace = '{';
-const PRUnichar kRightBrace = '}';
-const PRUnichar kQuestionMark = '?';
-const PRUnichar kLeftSquareBracket = '[';
-const PRUnichar kRightSquareBracket = ']';
-const PRUnichar kNullCh = '\0';
-
-#define kHTMLTextContentType "text/html"
-#define kXMLTextContentType "text/xml"
-#define kXMLApplicationContentType "application/xml"
-#define kXHTMLApplicationContentType "application/xhtml+xml"
-#define kXULTextContentType "application/vnd.mozilla.xul+xml"
-#define kRDFTextContentType "text/rdf"
-#define kXIFTextContentType "text/xif"
-#define kPlainTextContentType "text/plain"
-#define kViewSourceCommand "view-source"
-#define kViewFragmentCommand "view-fragment"
-#define kTextCSSContentType "text/css"
-#define kApplicationJSContentType "application/x-javascript"
-#define kTextJSContentType "text/javascript"
-#define kSGMLTextContentType "text/sgml"
-#define kSVGTextContentType "image/svg+xml"
-
-#define NS_IPARSER_FLAG_UNKNOWN_MODE 0x00000000
-#define NS_IPARSER_FLAG_QUIRKS_MODE 0x00000002
-#define NS_IPARSER_FLAG_STRICT_MODE 0x00000004
-#define NS_IPARSER_FLAG_AUTO_DETECT_MODE 0x00000010
-#define NS_IPARSER_FLAG_VIEW_NORMAL 0x00000020
-#define NS_IPARSER_FLAG_VIEW_SOURCE 0x00000040
-#define NS_IPARSER_FLAG_VIEW_ERRORS 0x00000080
-#define NS_IPARSER_FLAG_PRESERVE_CONTENT 0x00000100
-#define NS_IPARSER_FLAG_PLAIN_TEXT 0x00000200
-#define NS_IPARSER_FLAG_XML 0x00000400
-#define NS_IPARSER_FLAG_HTML 0x00000800
-
-#endif
diff --git a/htmlparser/public/nsIParserFilter.h b/htmlparser/public/nsIParserFilter.h
deleted file mode 100644
index 030b32064cd8..000000000000
--- a/htmlparser/public/nsIParserFilter.h
+++ /dev/null
@@ -1,78 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-/**
- * MODULE NOTES:
- * @update jevering 6/17/98
- *
- * This interface is not yet used; it was intended to allow an observer object
- * to "look at" the i/o stream coming into the parser before, during and after
- * the parser saw it. The intention of this was to allow an observer to modify
- * the stream at various stages.
- */
-
-#ifndef IPARSERFILTER
-#define IPARSERFILTER
-
-#include "nsISupports.h"
-
-class CToken;
-
-#define NS_IPARSERFILTER_IID \
- {0x14d6ff0, 0x0610, 0x11d2, \
- {0x8c, 0x3f, 0x00, 0x80, 0x5f, 0x8a, 0x1d, 0xb7}}
-
-
-class nsIParserFilter : public nsISupports {
- public:
-
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPARSERFILTER_IID)
-
- NS_IMETHOD RawBuffer(const char * buffer, PRUint32 * buffer_length) = 0;
-
- NS_IMETHOD WillAddToken(CToken & token) = 0;
-
- NS_IMETHOD ProcessTokens( /* dont know what goes here yet */ void ) = 0;
-
- NS_IMETHOD Finish() = 0;
-
-};
-
-
-
-#endif
-
diff --git a/htmlparser/public/nsIParserNode.h b/htmlparser/public/nsIParserNode.h
deleted file mode 100644
index cb17e96f145f..000000000000
--- a/htmlparser/public/nsIParserNode.h
+++ /dev/null
@@ -1,179 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- * This class is defines the basic interface between the
- * parser and the content sink. The parser will iterate
- * over the collection of tokens that it sees from the
- * tokenizer, coverting each related "group" into one of
- * these. This object gets passed to the sink, and is
- * then immediately reused.
- *
- * If you want to hang onto one of these, you should
- * make your own copy.
- *
- */
-
-#ifndef NS_IPARSERNODE__
-#define NS_IPARSERNODE__
-
-#include "nsISupports.h"
-#include "prtypes.h"
-#include "nsString.h"
-#include "nsDebug.h"
-
-//#define HEAP_ALLOCATED_NODES
-//#define DEBUG_TRACK_NODES
-
-class nsIAtom;
-class CToken;
-
-// 6e59f160-2717-11d2-9246-00805f8a7ab6
-#define NS_IPARSER_NODE_IID \
- {0x6e59f160, 0x2717, 0x11d1, \
- {0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6}}
-
-/**
- * Parser nodes are the unit of exchange between the
- * parser and the content sink. Nodes offer access to
- * the current token, its attributes, and its skipped-
- * content if applicable.
- *
- * @update gess 3/25/98
- */
-class nsIParserNode { // XXX Should be nsAParserNode
-
- public:
-
-
- /**
- * Retrieve the name of the node
- * @update gess5/11/98
- * @return string containing node name
- */
- virtual const nsAString& GetTagName() const = 0; //to get name of tag
-
- /**
- * Retrieve the text from the given node
- * @update gess5/11/98
- * @return string containing node text
- */
- virtual const nsAString& GetText() const = 0; //get plain text if available
-
- /**
- * Retrieve the type of the parser node.
- * @update gess5/11/98
- * @return node type.
- */
- virtual PRInt32 GetNodeType() const =0;
-
- /**
- * Retrieve token type of parser node
- * @update gess5/11/98
- * @return token type
- */
- virtual PRInt32 GetTokenType() const =0;
-
- /**
- * Retrieve the number of attributes in this node.
- * @update gess5/11/98
- * @return count of attributes (may be 0)
- */
- virtual PRInt32 GetAttributeCount(PRBool askToken=PR_FALSE) const =0;
-
- /**
- * Retrieve the key (of key/value pair) at given index
- * @update gess5/11/98
- * @param anIndex is the index of the key you want
- * @return string containing key.
- */
- virtual const nsAString& GetKeyAt(PRUint32 anIndex) const = 0;
-
- /**
- * Retrieve the value (of key/value pair) at given index
- * @update gess5/11/98
- * @param anIndex is the index of the value you want
- * @return string containing value.
- */
- virtual const nsAString& GetValueAt(PRUint32 anIndex) const = 0;
-
- /**
- * NOTE: When the node is an entity, this will translate the entity
- * to it's unicode value, and store it in aString.
- * @update gess5/11/98
- * @param aString will contain the resulting unicode string value
- * @return int (unicode char or unicode index from table)
- */
- virtual PRInt32 TranslateToUnicodeStr(nsString& aString) const = 0;
-
-
- virtual void AddAttribute(CToken* aToken)=0;
-
- /**
- * This getter retrieves the line number from the input source where
- * the token occured. Lines are interpreted as occuring between \n characters.
- * @update gess7/24/98
- * @return int containing the line number the token was found on
- */
- virtual PRInt32 GetSourceLineNumber(void) const =0;
-
- /**
- * This pair of methods allows us to set a generic bit (for arbitrary use)
- * on each node stored in the context.
- * @update gess 11May2000
- */
- virtual PRBool GetGenericState(void) const =0;
- virtual void SetGenericState(PRBool aState) =0;
-
- /** Retrieve a string containing the tag and its attributes in "source" form
- * @update rickg 06June2000
- * @return void
- */
- virtual void GetSource(nsString& aString)=0;
-
- /** Release all the objects you're holding
- * @update harishd 08/02/00
- * @return void
- */
- virtual nsresult ReleaseAll()=0;
-};
-
-#endif
diff --git a/htmlparser/public/nsIParserService.h b/htmlparser/public/nsIParserService.h
deleted file mode 100644
index c1884980d84a..000000000000
--- a/htmlparser/public/nsIParserService.h
+++ /dev/null
@@ -1,113 +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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIParserService_h__
-#define nsIParserService_h__
-
-#include "nsISupports.h"
-#include "nsString.h"
-#include "nsHTMLTags.h"
-#include "nsIParserNode.h"
-#include "nsIParser.h"
-#include "nsVoidArray.h"
-#include "nsIElementObserver.h"
-
-#define NS_PARSER_CONTRACTID_PREFIX "@mozilla.org/parser"
-
-// {90a92e37-abd6-441b-9b39-4064d98e1ede}
-#define NS_IPARSERSERVICE_IID \
-{ 0x90a92e37, 0xabd6, 0x441b, { 0x9b, 0x39, 0x40, 0x64, 0xd9, 0x8e, 0x1e, 0xde } };
-
-// {78081E70-AD53-11d5-8498-0010A4E0C706}
-#define NS_IOBSERVERENTRY_IID \
-{ 0x78081e70, 0xad53, 0x11d5, { 0x84, 0x98, 0x00, 0x10, 0xa4, 0xe0, 0xc7, 0x06 } };
-
-
-class nsIObserverEntry : public nsISupports {
- public:
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IOBSERVERENTRY_IID)
-
- NS_IMETHOD Notify(nsIParserNode* aNode,
- nsIParser* aParser,
- nsISupports* aWebShell,
- const PRUint32 aFlags) = 0;
-
-};
-
-
-class nsIParserService : public nsISupports {
- public:
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPARSERSERVICE_IID)
-
- NS_IMETHOD HTMLAtomTagToId(nsIAtom* aAtom, PRInt32* aId) const = 0;
-
- NS_IMETHOD HTMLCaseSensitiveAtomTagToId(nsIAtom* aAtom,
- PRInt32* aId) const = 0;
-
- NS_IMETHOD HTMLStringTagToId(const nsAString &aTagName,
- PRInt32* aId) const = 0;
-
- NS_IMETHOD HTMLIdToStringTag(PRInt32 aId,
- const PRUnichar **aTagName) const = 0;
-
- NS_IMETHOD HTMLConvertEntityToUnicode(const nsAString& aEntity,
- PRInt32* aUnicode) const = 0;
-
- NS_IMETHOD HTMLConvertUnicodeToEntity(PRInt32 aUnicode,
- nsCString& aEntity) const = 0;
-
- NS_IMETHOD IsContainer(PRInt32 aId, PRBool& aIsContainer) const = 0;
- NS_IMETHOD IsBlock(PRInt32 aId, PRBool& aIsBlock) const = 0;
-
- // Observer mechanism
- NS_IMETHOD RegisterObserver(nsIElementObserver* aObserver,
- const nsAString& aTopic,
- const eHTMLTags* aTags = nsnull) = 0;
-
- NS_IMETHOD UnregisterObserver(nsIElementObserver* aObserver,
- const nsAString& aTopic) = 0;
- NS_IMETHOD GetTopicObservers(const nsAString& aTopic,
- nsIObserverEntry** aEntry) = 0;
-
- virtual nsresult CheckQName(const nsASingleFragmentString& aQName,
- PRBool aNamespaceAware,
- const PRUnichar** aColon) = 0;
- virtual PRBool IsXMLLetter(PRUnichar aChar) = 0;
- virtual PRBool IsXMLNCNameChar(PRUnichar aChar) = 0;
-};
-
-#endif // nsIParserService_h__
diff --git a/htmlparser/public/nsITokenizer.h b/htmlparser/public/nsITokenizer.h
deleted file mode 100644
index 11b243770255..000000000000
--- a/htmlparser/public/nsITokenizer.h
+++ /dev/null
@@ -1,108 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- */
-
-#ifndef __NSITOKENIZER__
-#define __NSITOKENIZER__
-
-#include "nsISupports.h"
-#include "prtypes.h"
-
-class CToken;
-class nsScanner;
-class nsDeque;
-class nsTokenAllocator;
-
-#define NS_ITOKENIZER_IID \
- {0xe4238ddc, 0x9eb6, 0x11d2, {0xba, 0xa5, 0x0, 0x10, 0x4b, 0x98, 0x3f, 0xd4 }}
-
-/**
- * This interface is used as a callback to objects interested
- * in observing the token stream created from the parse process.
- */
-class nsITokenObserver {
-public:
- virtual PRBool operator()(CToken* aToken)=0;
-};
-
-/***************************************************************
- Notes:
- ***************************************************************/
-
-
-class nsITokenizer : public nsISupports {
-public:
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITOKENIZER_IID)
-
- NS_IMETHOD WillTokenize(PRBool aIsFinalChunk,nsTokenAllocator* aTokenAllocator)=0;
- NS_IMETHOD ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens)=0;
- NS_IMETHOD DidTokenize(PRBool aIsFinalChunk)=0;
-
- NS_IMETHOD_(CToken*) PushTokenFront(CToken* aToken)=0;
- NS_IMETHOD_(CToken*) PushToken(CToken* aToken)=0;
- NS_IMETHOD_(CToken*) PopToken(void)=0;
- NS_IMETHOD_(CToken*) PeekToken(void)=0;
- NS_IMETHOD_(CToken*) GetTokenAt(PRInt32 anIndex)=0;
- NS_IMETHOD_(PRInt32) GetCount(void)=0;
- NS_IMETHOD_(nsTokenAllocator*) GetTokenAllocator(void)=0;
- NS_IMETHOD_(void) PrependTokens(nsDeque& aDeque)=0;
- NS_IMETHOD CopyState(nsITokenizer* aTokenizer) = 0;
-
-};
-
-#define NS_DECL_NSITOKENIZER \
- NS_IMETHOD WillTokenize(PRBool aIsFinalChunk,nsTokenAllocator* aTokenAllocator);\
- NS_IMETHOD ConsumeToken(nsScanner& aScanner,PRBool& aFlushTokens);\
- NS_IMETHOD DidTokenize(PRBool aIsFinalChunk);\
- NS_IMETHOD_(CToken*) PushTokenFront(CToken* aToken);\
- NS_IMETHOD_(CToken*) PushToken(CToken* aToken);\
- NS_IMETHOD_(CToken*) PopToken(void);\
- NS_IMETHOD_(CToken*) PeekToken(void);\
- NS_IMETHOD_(CToken*) GetTokenAt(PRInt32 anIndex);\
- NS_IMETHOD_(PRInt32) GetCount(void);\
- NS_IMETHOD_(nsTokenAllocator*) GetTokenAllocator(void);\
- NS_IMETHOD_(void) PrependTokens(nsDeque& aDeque);\
- NS_IMETHOD CopyState(nsITokenizer* aTokenizer);
-
-
-#endif
diff --git a/htmlparser/public/nsParserCIID.h b/htmlparser/public/nsParserCIID.h
deleted file mode 100644
index a3758cc6f9d3..000000000000
--- a/htmlparser/public/nsParserCIID.h
+++ /dev/null
@@ -1,83 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsParserCIID_h__
-#define nsParserCIID_h__
-
-#include "nsISupports.h"
-#include "nsIFactory.h"
-#include "nsIComponentManager.h"
-
-// {2ce606b0-bee6-11d1-aad9-00805f8a3e14}
-#define NS_PARSER_CID \
-{ 0x2ce606b0, 0xbee6, 0x11d1, { 0xaa, 0xd9, 0x0, 0x80, 0x5f, 0x8a, 0x3e, 0x14 } }
-
-// XXX: This object should not be exposed outside of the parser.
-// Remove when CNavDTD subclasses do not need access
-#define NS_PARSER_NODE_IID \
- {0x9039c670, 0x2717, 0x11d2, \
- {0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6}}
-
-// {a6cf9107-15b3-11d2-932e-00805f8add32}
-#define NS_CNAVDTD_CID \
-{ 0xa6cf9107, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
-
-// Class IID for the logging sink
-#define NS_LOGGING_SINK_CID \
- {0xa6cf9060, 0x15b3, 0x11d2,{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-// {4611d482-960a-11d4-8eb0-b617661b6f7c}
-#define NS_CTRANSITIONAL_DTD_CID \
-{ 0x4611d482, 0x960a, 0x11d4, { 0x8e, 0xb0, 0xb6, 0x17, 0x66, 0x1b, 0x6f, 0x7c } }
-
-// {8323FAD0-2102-11d4-8142-000064657374}
-#define NS_VIEWSOURCE_DTD_CID \
-{ 0x8323fad0, 0x2102, 0x11d4, { 0x81, 0x42, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
-
-// {FFF4FBE9-528A-4b37-819D-FC18F3A401A7}
-#define NS_EXPAT_DRIVER_CID \
-{ 0xfff4fbe9, 0x528a, 0x4b37, { 0x81, 0x9d, 0xfc, 0x18, 0xf3, 0xa4, 0x1, 0xa7 } }
-
-// {a6cf910f-15b3-11d2-932e-00805f8add32}
-#define NS_HTMLCONTENTSINKSTREAM_CID \
-{ 0xa6cf910f, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
-
-// {a6cf9112-15b3-11d2-932e-00805f8add32}
-#define NS_PARSERSERVICE_CID \
-{ 0xa6cf9112, 0x15b3, 0x11d2, { 0x93, 0x2e, 0x0, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } }
-
-#endif
diff --git a/htmlparser/public/nsParserError.h b/htmlparser/public/nsParserError.h
deleted file mode 100644
index 8260ccc4fe7b..000000000000
--- a/htmlparser/public/nsParserError.h
+++ /dev/null
@@ -1,64 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-
-/**
- * MODULE NOTES:
- * @update nra 3/3/99
- *
- * nsParserError structifies the notion of a parser error.
- */
-
-
-#ifndef PARSERERROR__
-#define PARSERERROR__
-
-#include "prtypes.h"
-#include "nsString.h"
-
-typedef struct _nsParserError {
- PRInt32 code;
- PRInt32 lineNumber;
- PRInt32 colNumber;
- nsString description;
- nsString sourceLine;
- nsString sourceURL;
-} nsParserError;
-
-#endif
-
-
diff --git a/htmlparser/public/nsScannerString.h b/htmlparser/public/nsScannerString.h
deleted file mode 100644
index ea8a0cf15319..000000000000
--- a/htmlparser/public/nsScannerString.h
+++ /dev/null
@@ -1,583 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* ***** 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.
- *
- * The Initial Developer of the Original Code is IBM Corporation.
- * Portions created by IBM Corporation are Copyright (C) 2003
- * IBM Corporation. All Rights Reserved.
- *
- * Contributor(s):
- * Darin Fisher
- *
- * 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 nsScannerString_h___
-#define nsScannerString_h___
-
-#include "nsString.h"
-#include "nsUnicharUtils.h" // for nsCaseInsensitiveStringComparator
-#include "prclist.h"
-
-
- /**
- * NOTE: nsScannerString (and the other classes defined in this file) are
- * not related to nsAString or any of the other xpcom/string classes.
- *
- * nsScannerString is based on the nsSlidingString implementation that used
- * to live in xpcom/string. Now that nsAString is limited to representing
- * only single fragment strings, nsSlidingString can no longer be used.
- *
- * An advantage to this design is that it does not employ any virtual
- * functions.
- *
- * This file uses SCC-style indenting in deference to the nsSlidingString
- * code from which this code is derived ;-)
- */
-
-class nsScannerIterator;
-class nsScannerSubstring;
-class nsScannerString;
-
-
- /**
- * nsScannerBufferList
- *
- * This class maintains a list of heap-allocated Buffer objects. The buffers
- * are maintained in a circular linked list. Each buffer has a usage count
- * that is decremented by the owning nsScannerSubstring.
- *
- * The buffer list itself is reference counted. This allows the buffer list
- * to be shared by multiple nsScannerSubstring objects. The reference
- * counting is not threadsafe, which is not at all a requirement.
- *
- * When a nsScannerSubstring releases its reference to a buffer list, it
- * decrements the usage count of the first buffer in the buffer list that it
- * was referencing. It informs the buffer list that it can discard buffers
- * starting at that prefix. The buffer list will do so if the usage count of
- * that buffer is 0 and if it is the first buffer in the list. It will
- * continue to prune buffers starting from the front of the buffer list until
- * it finds a buffer that has a usage count that is non-zero.
- */
-class nsScannerBufferList
- {
- public:
-
- /**
- * Buffer objects are directly followed by a data segment. The start
- * of the data segment is determined by increment the |this| pointer
- * by 1 unit.
- */
- class Buffer : public PRCList
- {
- public:
-
- void IncrementUsageCount() { ++mUsageCount; }
- void DecrementUsageCount() { --mUsageCount; }
-
- PRBool IsInUse() const { return mUsageCount != 0; }
-
- const PRUnichar* DataStart() const { return (const PRUnichar*) (this+1); }
- PRUnichar* DataStart() { return ( PRUnichar*) (this+1); }
-
- const PRUnichar* DataEnd() const { return mDataEnd; }
- PRUnichar* DataEnd() { return mDataEnd; }
-
- const Buffer* Next() const { return NS_STATIC_CAST(const Buffer*, next); }
- Buffer* Next() { return NS_STATIC_CAST( Buffer*, next); }
-
- const Buffer* Prev() const { return NS_STATIC_CAST(const Buffer*, prev); }
- Buffer* Prev() { return NS_STATIC_CAST( Buffer*, prev); }
-
- PRUint32 DataLength() const { return mDataEnd - DataStart(); }
- void SetDataLength(PRUint32 len) { mDataEnd = DataStart() + len; }
-
- private:
-
- friend class nsScannerBufferList;
-
- PRInt32 mUsageCount;
- PRUnichar* mDataEnd;
- };
-
- /**
- * Position objects serve as lightweight pointers into a buffer list.
- * The mPosition member must be contained with mBuffer->DataStart()
- * and mBuffer->DataEnd().
- */
- class Position
- {
- public:
-
- Position() {}
-
- Position( Buffer* buffer, PRUnichar* position )
- : mBuffer(buffer)
- , mPosition(position)
- {}
-
- inline
- Position( const nsScannerIterator& aIter );
-
- inline
- Position& operator=( const nsScannerIterator& aIter );
-
- static size_t Distance( const Position& p1, const Position& p2 );
-
- Buffer* mBuffer;
- PRUnichar* mPosition;
- };
-
- static Buffer* AllocBufferFromString( const nsAString& );
- static Buffer* AllocBuffer( PRUint32 capacity ); // capacity = number of chars
-
- nsScannerBufferList( Buffer* buf )
- : mRefCnt(0)
- {
- PR_INIT_CLIST(&mBuffers);
- PR_APPEND_LINK(buf, &mBuffers);
- }
-
- void AddRef() { ++mRefCnt; }
- void Release() { if (--mRefCnt == 0) delete this; }
-
- void Append( Buffer* buf ) { PR_APPEND_LINK(buf, &mBuffers); }
- void InsertAfter( Buffer* buf, Buffer* prev ) { PR_INSERT_AFTER(buf, prev); }
- void SplitBuffer( const Position& );
- void DiscardUnreferencedPrefix( Buffer* );
-
- Buffer* Head() { return NS_STATIC_CAST( Buffer*, PR_LIST_HEAD(&mBuffers)); }
- const Buffer* Head() const { return NS_STATIC_CAST(const Buffer*, PR_LIST_HEAD(&mBuffers)); }
-
- Buffer* Tail() { return NS_STATIC_CAST( Buffer*, PR_LIST_TAIL(&mBuffers)); }
- const Buffer* Tail() const { return NS_STATIC_CAST(const Buffer*, PR_LIST_TAIL(&mBuffers)); }
-
- private:
-
- friend class nsScannerSubstring;
-
- ~nsScannerBufferList() { ReleaseAll(); }
- void ReleaseAll();
-
- PRInt32 mRefCnt;
- PRCList mBuffers;
- };
-
-
- /**
- * nsScannerFragment represents a "slice" of a Buffer object.
- */
-struct nsScannerFragment
- {
- typedef nsScannerBufferList::Buffer Buffer;
-
- const Buffer* mBuffer;
- const PRUnichar* mFragmentStart;
- const PRUnichar* mFragmentEnd;
- };
-
-
- /**
- * nsScannerSubstring is the base class for nsScannerString. It provides
- * access to iterators and methods to bind the substring to another
- * substring or nsAString instance.
- *
- * This class owns the buffer list.
- */
-class nsScannerSubstring
- {
- public:
- typedef nsScannerBufferList::Buffer Buffer;
- typedef nsScannerBufferList::Position Position;
- typedef PRUint32 size_type;
-
- nsScannerSubstring();
- nsScannerSubstring( const nsAString& s );
-
- ~nsScannerSubstring();
-
- nsScannerIterator& BeginReading( nsScannerIterator& iter ) const;
- nsScannerIterator& EndReading( nsScannerIterator& iter ) const;
-
- size_type Length() const { return mLength; }
-
- PRInt32 CountChar( PRUnichar ) const;
-
- void Rebind( const nsScannerSubstring&, const nsScannerIterator&, const nsScannerIterator& );
- void Rebind( const nsAString& );
-
- const nsString& AsString() const;
-
- PRBool GetNextFragment( nsScannerFragment& ) const;
- PRBool GetPrevFragment( nsScannerFragment& ) const;
-
- static inline Buffer* AllocBufferFromString( const nsAString& aStr ) { return nsScannerBufferList::AllocBufferFromString(aStr); }
- static inline Buffer* AllocBuffer( size_type aCapacity ) { return nsScannerBufferList::AllocBuffer(aCapacity); }
-
- protected:
-
- void acquire_ownership_of_buffer_list() const
- {
- mBufferList->AddRef();
- mStart.mBuffer->IncrementUsageCount();
- }
-
- void release_ownership_of_buffer_list()
- {
- if (mBufferList)
- {
- mStart.mBuffer->DecrementUsageCount();
- mBufferList->DiscardUnreferencedPrefix(mStart.mBuffer);
- mBufferList->Release();
- }
- }
-
- void init_range_from_buffer_list()
- {
- mStart.mBuffer = mBufferList->Head();
- mStart.mPosition = mStart.mBuffer->DataStart();
-
- mEnd.mBuffer = mBufferList->Tail();
- mEnd.mPosition = mEnd.mBuffer->DataEnd();
-
- mLength = Position::Distance(mStart, mEnd);
- }
-
- Position mStart;
- Position mEnd;
- nsScannerBufferList *mBufferList;
- size_type mLength;
-
- // these fields are used to implement AsString
- nsString mFlattenedRep;
- PRBool mIsDirty;
- };
-
-
- /**
- * nsScannerString provides methods to grow and modify a buffer list.
- */
-class nsScannerString : public nsScannerSubstring
- {
- public:
-
- nsScannerString( Buffer* );
-
- // you are giving ownership to the string, it takes and keeps your
- // buffer, deleting it when done.
- // Use AllocBuffer or AllocBufferFromString to create a Buffer object
- // for use with this function.
- void AppendBuffer( Buffer* );
-
- void DiscardPrefix( const nsScannerIterator& );
- // any other way you want to do this?
-
- void UngetReadable(const nsAString& aReadable, const nsScannerIterator& aCurrentPosition);
- void ReplaceCharacter(nsScannerIterator& aPosition, PRUnichar aChar);
- };
-
-
- /**
- * nsScannerIterator works just like nsReadingIterator except that
- * it knows how to iterate over a list of scanner buffers.
- */
-class nsScannerIterator
- {
- public:
- typedef nsScannerIterator self_type;
- typedef ptrdiff_t difference_type;
- typedef PRUnichar value_type;
- typedef const PRUnichar* pointer;
- typedef const PRUnichar& reference;
- typedef nsScannerSubstring::Buffer Buffer;
-
- protected:
-
- nsScannerFragment mFragment;
- const PRUnichar* mPosition;
- const nsScannerSubstring* mOwner;
-
- friend class nsScannerSubstring;
-
- public:
- nsScannerIterator() {}
- // nsScannerIterator( const nsScannerIterator& ); // auto-generated copy-constructor OK
- // nsScannerIterator& operator=( const nsScannerIterator& ); // auto-generated copy-assignment operator OK
-
- inline void normalize_forward();
- inline void normalize_backward();
-
- pointer get() const
- {
- return mPosition;
- }
-
- PRUnichar operator*() const
- {
- return *get();
- }
-
- const nsScannerFragment& fragment() const
- {
- return mFragment;
- }
-
- const Buffer* buffer() const
- {
- return mFragment.mBuffer;
- }
-
- self_type& operator++()
- {
- ++mPosition;
- normalize_forward();
- return *this;
- }
-
- self_type operator++( int )
- {
- self_type result(*this);
- ++mPosition;
- normalize_forward();
- return result;
- }
-
- self_type& operator--()
- {
- normalize_backward();
- --mPosition;
- return *this;
- }
-
- self_type operator--( int )
- {
- self_type result(*this);
- normalize_backward();
- --mPosition;
- return result;
- }
-
- difference_type size_forward() const
- {
- return mFragment.mFragmentEnd - mPosition;
- }
-
- difference_type size_backward() const
- {
- return mPosition - mFragment.mFragmentStart;
- }
-
- self_type& advance( difference_type n )
- {
- while ( n > 0 )
- {
- difference_type one_hop = NS_MIN(n, size_forward());
-
- NS_ASSERTION(one_hop>0, "Infinite loop: can't advance a reading iterator beyond the end of a string");
- // perhaps I should |break| if |!one_hop|?
-
- mPosition += one_hop;
- normalize_forward();
- n -= one_hop;
- }
-
- while ( n < 0 )
- {
- normalize_backward();
- difference_type one_hop = NS_MAX(n, -size_backward());
-
- NS_ASSERTION(one_hop<0, "Infinite loop: can't advance (backward) a reading iterator beyond the end of a string");
- // perhaps I should |break| if |!one_hop|?
-
- mPosition += one_hop;
- n -= one_hop;
- }
-
- return *this;
- }
- };
-
-
-inline
-PRBool
-SameFragment( const nsScannerIterator& a, const nsScannerIterator& b )
- {
- return a.fragment().mFragmentStart == b.fragment().mFragmentStart;
- }
-
-
- /**
- * this class is needed in order to make use of the methods in nsAlgorithm.h
- */
-NS_SPECIALIZE_TEMPLATE
-struct nsCharSourceTraits
- {
- typedef nsScannerIterator::difference_type difference_type;
-
- static
- PRUint32
- readable_distance( const nsScannerIterator& first, const nsScannerIterator& last )
- {
- return PRUint32(SameFragment(first, last) ? last.get() - first.get() : first.size_forward());
- }
-
- static
- const nsScannerIterator::value_type*
- read( const nsScannerIterator& iter )
- {
- return iter.get();
- }
-
- static
- void
- advance( nsScannerIterator& s, difference_type n )
- {
- s.advance(n);
- }
- };
-
-
- /**
- * inline methods follow
- */
-
-inline
-void
-nsScannerIterator::normalize_forward()
- {
- while (mPosition == mFragment.mFragmentEnd && mOwner->GetNextFragment(mFragment))
- mPosition = mFragment.mFragmentStart;
- }
-
-inline
-void
-nsScannerIterator::normalize_backward()
- {
- while (mPosition == mFragment.mFragmentStart && mOwner->GetPrevFragment(mFragment))
- mPosition = mFragment.mFragmentEnd;
- }
-
-inline
-PRBool
-operator==( const nsScannerIterator& lhs, const nsScannerIterator& rhs )
- {
- return lhs.get() == rhs.get();
- }
-
-inline
-PRBool
-operator!=( const nsScannerIterator& lhs, const nsScannerIterator& rhs )
- {
- return lhs.get() != rhs.get();
- }
-
-
-inline
-nsScannerBufferList::Position::Position(const nsScannerIterator& aIter)
- : mBuffer(NS_CONST_CAST(Buffer*, aIter.buffer()))
- , mPosition(NS_CONST_CAST(PRUnichar*, aIter.get()))
- {}
-
-inline
-nsScannerBufferList::Position&
-nsScannerBufferList::Position::operator=(const nsScannerIterator& aIter)
- {
- mBuffer = NS_CONST_CAST(Buffer*, aIter.buffer());
- mPosition = NS_CONST_CAST(PRUnichar*, aIter.get());
- return *this;
- }
-
-
- /**
- * scanner string utils
- *
- * These methods mimic the API provided by nsReadableUtils in xpcom/string.
- * Here we provide only the methods that the htmlparser module needs.
- */
-
-inline
-size_t
-Distance( const nsScannerIterator& aStart, const nsScannerIterator& aEnd )
- {
- typedef nsScannerBufferList::Position Position;
- return Position::Distance(Position(aStart), Position(aEnd));
- }
-
-void
-CopyUnicodeTo( const nsScannerIterator& aSrcStart,
- const nsScannerIterator& aSrcEnd,
- nsAString& aDest );
-
-inline
-void
-CopyUnicodeTo( const nsScannerSubstring& aSrc, nsAString& aDest )
- {
- nsScannerIterator begin, end;
- CopyUnicodeTo(aSrc.BeginReading(begin), aSrc.EndReading(end), aDest);
- }
-
-void
-AppendUnicodeTo( const nsScannerIterator& aSrcStart,
- const nsScannerIterator& aSrcEnd,
- nsAString& aDest );
-
-inline
-void
-AppendUnicodeTo( const nsScannerSubstring& aSrc, nsAString& aDest )
- {
- nsScannerIterator begin, end;
- AppendUnicodeTo(aSrc.BeginReading(begin), aSrc.EndReading(end), aDest);
- }
-
-PRBool
-FindCharInReadable( PRUnichar aChar,
- nsScannerIterator& aStart,
- const nsScannerIterator& aEnd );
-
-PRBool
-FindInReadable( const nsAString& aPattern,
- nsScannerIterator& aStart,
- nsScannerIterator& aEnd,
- const nsStringComparator& = nsDefaultStringComparator() );
-
-PRBool
-RFindInReadable( const nsAString& aPattern,
- nsScannerIterator& aStart,
- nsScannerIterator& aEnd,
- const nsStringComparator& = nsDefaultStringComparator() );
-
-inline
-PRBool
-CaseInsensitiveFindInReadable( const nsAString& aPattern,
- nsScannerIterator& aStart,
- nsScannerIterator& aEnd )
- {
- return FindInReadable(aPattern, aStart, aEnd,
- nsCaseInsensitiveStringComparator());
- }
-
-#endif // !defined(nsScannerString_h___)
diff --git a/htmlparser/public/nsToken.h b/htmlparser/public/nsToken.h
deleted file mode 100644
index fc6c470cf17b..000000000000
--- a/htmlparser/public/nsToken.h
+++ /dev/null
@@ -1,296 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-
-/**
- * MODULE NOTES:
- * @update gess 4/1/98
- *
- * This class is defines the basic notion of a token
- * within our system. All other tokens are derived from
- * this one. It offers a few basic interfaces, but the
- * most important is consume(). The consume() method gets
- * called during the tokenization process when an instance
- * of that particular token type gets detected in the
- * input stream.
- *
- * CToken objects that are allocated from the heap _must_ be allocated
- * using the nsTokenAllocator: the nsTokenAllocator object uses an
- * arena to manage the tokens.
- *
- * The nsTokenAllocator object's arena implementation requires
- * object size at destruction time to properly recycle the object;
- * therefore, CToken::operator delete() is not public. Instead,
- * heap-allocated tokens should be destroyed using the static
- * Destroy() method, which accepts a token and the arena from which
- * the token was allocated.
- *
- * Leaf classes (that are actually instantiated from the heap) must
- * implement the SizeOf() method, which Destroy() uses to determine
- * the size of the token in order to properly recycle it.
- */
-
-
-#ifndef CTOKEN__
-#define CTOKEN__
-
-#include "prtypes.h"
-#include "nsString.h"
-#include "nsError.h"
-#include "nsFixedSizeAllocator.h"
-
-#define NS_HTMLTOKENS_NOT_AN_ENTITY \
- NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_HTMLPARSER,2000)
-
-class nsScanner;
-class nsTokenAllocator;
-
-enum eContainerInfo {
- eWellFormed,
- eMalformed,
- eFormUnknown
-};
-
-/**
- * Implement the SizeOf() method; leaf classes derived from CToken
- * must declare this.
- */
-#define CTOKEN_IMPL_SIZEOF \
-protected: \
- virtual size_t SizeOf() const { return sizeof(*this); } \
-public:
-
-/**
- * Token objects represent sequences of characters as they
- * are consumed from the input stream (URL). While they're
- * pretty general in nature, we use subclasses (found in
- * nsHTMLTokens.h) to define , , ,
- * , <&entity>, , and tokens.
- *
- * @update gess 3/25/98
- */
-class CToken {
- public:
-
- enum eTokenOrigin {eSource,eResidualStyle};
-
- protected:
-
- // nsTokenAllocator should be the only class that tries to
- // allocate tokens from the heap.
- friend class nsTokenAllocator;
-
- /**
- *
- * @update harishd 08/01/00
- * @param aSize -
- * @param aArena - Allocate memory from this pool.
- */
- static void * operator new (size_t aSize,nsFixedSizeAllocator& anArena) CPP_THROW_NEW
- {
- return anArena.Alloc(aSize);
- }
-
- /**
- * Hide operator delete; clients should use Destroy() instead.
- */
- static void operator delete (void*,size_t) {}
-
- public:
- /**
- * destructor
- * @update gess5/11/98
- */
- virtual ~CToken();
-
- /**
- * Destroy a token.
- */
- static void Destroy(CToken* aToken,nsFixedSizeAllocator& aArenaPool)
- {
- size_t sz = aToken->SizeOf();
- aToken->~CToken();
- aArenaPool.Free(aToken, sz);
- }
-
- /**
- * Make a note on number of times you have been referenced
- * @update harishd 08/02/00
- */
- void AddRef() { ++mUseCount; }
-
- /**
- * Free yourself if no one is holding you.
- * @update harishd 08/02/00
- */
- void Release(nsFixedSizeAllocator& aArenaPool) {
- if(--mUseCount==0)
- Destroy(this, aArenaPool);
- }
-
- /**
- * Default constructor
- * @update gess7/21/98
- */
- CToken(PRInt32 aTag=0);
-
- /**
- * Retrieve string value of the token
- * @update gess5/11/98
- * @return reference to string containing string value
- */
- virtual const nsAString& GetStringValue(void) = 0;
-
- /**
- * Get string of full contents, suitable for debug dump.
- * It should look exactly like the input source.
- * @update gess5/11/98
- * @return reference to string containing string value
- */
- virtual void GetSource(nsString& anOutputString);
-
- /** @update harishd 03/23/00
- * @return reference to string containing string value
- */
- virtual void AppendSourceTo(nsAString& anOutputString);
-
- /**
- * Sets the ordinal value of this token (not currently used)
- * @update gess5/11/98
- * @param value is the new ord value for this token
- */
- void SetTypeID(PRInt32 aValue) {
- mTypeID = aValue;
- }
-
- /**
- * Getter which retrieves the current ordinal value for this token
- * @update gess5/11/98
- * @return current ordinal value
- */
- virtual PRInt32 GetTypeID(void);
-
- /**
- * Getter which retrieves the current attribute count for this token
- * @update gess5/11/98
- * @return current attribute count
- */
- virtual PRInt16 GetAttributeCount(void);
-
- /**
- * Causes token to consume data from given scanner.
- * Note that behavior varies wildly between CToken subclasses.
- * @update gess5/11/98
- * @param aChar -- most recent char consumed
- * @param aScanner -- input source where token should get data
- * @return error code (0 means ok)
- */
- virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode);
-
- /**
- * Getter which retrieves type of token
- * @update gess5/11/98
- * @return int containing token type
- */
- virtual PRInt32 GetTokenType(void);
-
- /**
- * For tokens who care, this can tell us whether the token is
- * well formed or not.
- *
- * @update gess 8/30/00
- * @return PR_FALSE; subclasses MUST override if they care.
- */
- virtual PRBool IsWellFormed(void) const {return PR_FALSE;}
-
- virtual PRBool IsEmpty(void) { return PR_FALSE; }
-
- /**
- * If aValue is TRUE then the token represents a short-hand tag
- */
- virtual void SetEmpty(PRBool aValue) { return ; }
-
- PRInt32 GetNewlineCount()
- {
- return mNewlineCount;
- }
-
- void SetNewlineCount(PRInt32 aCount)
- {
- mNewlineCount = aCount;
- }
-
- PRInt32 GetLineNumber()
- {
- return mLineNumber;
- }
-
- void SetLineNumber(PRInt32 aLineNumber)
- {
- mLineNumber = mLineNumber == 0 ? aLineNumber : mLineNumber;
- }
-
- void SetAttributeCount(PRInt16 aValue) { mAttrCount = aValue; }
-
- /**
- * perform self test.
- * @update gess5/11/98
- */
- virtual void SelfTest(void);
-
- static int GetTokenCount();
-
-
-
-protected:
- /**
- * Returns the size of the token object.
- */
- virtual size_t SizeOf() const = 0;
-
- PRInt32 mTypeID;
- PRInt32 mUseCount;
- PRInt32 mNewlineCount;
- PRInt32 mLineNumber;
- PRInt16 mAttrCount;
-};
-
-
-
-#endif
-
-
diff --git a/htmlparser/robot/.cvsignore b/htmlparser/robot/.cvsignore
deleted file mode 100644
index 4a7ba5f079bf..000000000000
--- a/htmlparser/robot/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-htmlrobot
diff --git a/htmlparser/robot/nsDebugRobot.cpp b/htmlparser/robot/nsDebugRobot.cpp
deleted file mode 100644
index 5bb2d544ed10..000000000000
--- a/htmlparser/robot/nsDebugRobot.cpp
+++ /dev/null
@@ -1,356 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Pierre Phaneuf
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nsIRobotSink.h"
-#include "nsIRobotSinkObserver.h"
-#include "nsIParser.h"
-#include "nsIDocShell.h"
-#include "nsIWebNavigation.h"
-#include "nsIWebProgress.h"
-#include "nsIWebProgressListener.h"
-#include "nsWeakReference.h"
-#include "nsVoidArray.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "nsIURL.h"
-#include "nsIServiceManager.h"
-#include "nsIURL.h"
-#include "nsIIOService.h"
-#include "nsNetCID.h"
-#include "nsIComponentManager.h"
-#include "nsParserCIID.h"
-#include "nsIInterfaceRequestor.h"
-#include "nsIInterfaceRequestorUtils.h"
-
-static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
-
-class RobotSinkObserver : public nsIRobotSinkObserver {
-public:
- RobotSinkObserver() {
- }
-
- virtual ~RobotSinkObserver() {
- }
-
- NS_DECL_ISUPPORTS
-
- NS_IMETHOD ProcessLink(const nsString& aURLSpec);
- NS_IMETHOD VerifyDirectory (const char * verify_dir);
-
-};
-
-static nsVoidArray * g_workList;
-static nsVoidArray * g_duplicateList;
-static int g_iProcessed;
-static int g_iMaxProcess = 5000;
-static PRBool g_bHitTop;
-static PRBool g_bReadyForNextUrl;
-
-NS_IMPL_ISUPPORTS1(RobotSinkObserver, nsIRobotSinkObserver)
-
-NS_IMETHODIMP RobotSinkObserver::VerifyDirectory(const char * verify_dir)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSinkObserver::ProcessLink(const nsString& aURLSpec)
-{
- if (!g_bHitTop) {
-
- nsAutoString str;
- // Geez this is ugly. temporary hack to only process html files
- str.Truncate();
- nsString(aURLSpec).Right(str,1);
- if (!str.Equals(NS_LITERAL_STRING("/")))
- {
- str.Truncate();
- nsString(aURLSpec).Right(str,4);
- if (!str.Equals(NS_LITERAL_STRING("html")))
- {
- str.Truncate();
- nsString(aURLSpec).Right(str,3);
- if (!str.Equals(NS_LITERAL_STRING("htm")))
- return NS_OK;
- }
- }
- PRInt32 nCount = g_duplicateList->Count();
- if (nCount > 0)
- {
- for (PRInt32 n = 0; n < nCount; ++n)
- {
- nsString * pstr = (nsString *)g_duplicateList->ElementAt(n);
- if (pstr->Equals(aURLSpec)) {
- fputs ("Robot: (duplicate '",stdout);
- fputs (NS_LossyConvertUCS2toASCII(aURLSpec).get(),stdout);
- fputs ("')\n",stdout);
- return NS_OK;
- }
- }
- }
- g_duplicateList->AppendElement(new nsString(aURLSpec));
- str.Truncate();
- nsString(aURLSpec).Left(str,5);
- if (str.Equals(NS_LITERAL_STRING("http:"))) {
- ++g_iProcessed;
- if (g_iProcessed == (g_iMaxProcess > 0 ? g_iMaxProcess-1 : 0))
- g_bHitTop = PR_TRUE;
- g_workList->AppendElement(new nsString(aURLSpec));
- }
- else {
- fputs ("Robot: (cannot process URL types '",stdout);
- fputs (NS_LossyConvertUCS2toASCII(aURLSpec).get(),stdout);
- fputs ("')\n",stdout);
- }
- }
- return NS_OK;
-}
-
-extern "C" NS_EXPORT void SetVerificationDirectory(char * verify_dir);
-
-class CStreamListener: public nsIWebProgressListener,
- public nsSupportsWeakReference
-{
-public:
- CStreamListener() {
- }
-
- virtual ~CStreamListener() {
- }
-
- NS_DECL_ISUPPORTS
-
- // nsIWebProgressListener
- NS_DECL_NSIWEBPROGRESSLISTENER
-};
-
-// nsIWebProgressListener implementation
-NS_IMETHODIMP
-CStreamListener::OnStateChange(nsIWebProgress* aWebProgress,
- nsIRequest *aRequest,
- PRUint32 progressStateFlags,
- nsresult aStatus)
-{
- if (progressStateFlags & nsIWebProgressListener::STATE_IS_DOCUMENT)
- if (progressStateFlags & nsIWebProgressListener::STATE_STOP) {
- fputs("done.\n",stdout);
- g_bReadyForNextUrl = PR_TRUE;
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-CStreamListener::OnProgressChange(nsIWebProgress *aWebProgress,
- nsIRequest *aRequest,
- PRInt32 aCurSelfProgress,
- PRInt32 aMaxSelfProgress,
- PRInt32 aCurTotalProgress,
- PRInt32 aMaxTotalProgress)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-NS_IMETHODIMP
-CStreamListener::OnLocationChange(nsIWebProgress* aWebProgress,
- nsIRequest* aRequest,
- nsIURI *location)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-
-NS_IMETHODIMP
-CStreamListener::OnStatusChange(nsIWebProgress* aWebProgress,
- nsIRequest* aRequest,
- nsresult aStatus,
- const PRUnichar* aMessage)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-
-NS_IMETHODIMP
-CStreamListener::OnSecurityChange(nsIWebProgress *aWebProgress,
- nsIRequest *aRequest,
- PRUint32 state)
-{
- NS_NOTREACHED("notification excluded in AddProgressListener(...)");
- return NS_OK;
-}
-
-NS_IMPL_ISUPPORTS2(CStreamListener,
- nsIWebProgressListener,
- nsISupportsWeakReference)
-
-extern "C" NS_EXPORT void DumpVectorRecord(void);
-//----------------------------------------------------------------------
-extern "C" NS_EXPORT int DebugRobot(
- nsVoidArray * workList,
- nsIDocShell * docShell,
- int iMaxLoads,
- char * verify_dir,
- void (*yieldProc )(const char *)
- )
-{
- int iCount = 1;
- CStreamListener * pl = new CStreamListener;
- NS_ADDREF(pl);
-
- if (nsnull==workList)
- return -1;
- g_iMaxProcess = iMaxLoads;
- g_iProcessed = 0;
- g_bHitTop = PR_FALSE;
- g_duplicateList = new nsVoidArray();
- RobotSinkObserver* myObserver = new RobotSinkObserver();
- NS_ADDREF(myObserver);
- g_workList = workList;
-
- for (;;) {
- PRInt32 n = g_workList->Count();
- if (0 == n) {
- break;
- }
- nsString* urlName = (nsString*) g_workList->ElementAt(n - 1);
- g_workList->RemoveElementAt(n - 1);
-
- // Create url
- nsIURI* url;
- nsresult rv;
- nsCOMPtr service(do_GetService(kIOServiceCID, &rv));
- if (NS_FAILED(rv)) return rv;
-
- nsIURI *uri = nsnull;
- NS_ConvertUCS2toUTF8 uriStr(*urlName);
- rv = service->NewURI(uriStr, nsnull, nsnull, &uri);
- if (NS_FAILED(rv)) return rv;
-
- rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&url);
- NS_RELEASE(uri);
- if (NS_OK != rv) {
- printf("invalid URL: '");
- fputs(uriStr.get(), stdout);
- printf("'\n");
- NS_RELEASE(myObserver);
- return -1;
- }
-
- char str_num[25];
- sprintf (str_num,"%d",iCount++);
- fputs ("Robot: parsing(",stdout);
- fputs (str_num,stdout);
- fputs (") ",stdout);
- fputs (NS_LossyConvertUCS2toASCII(*urlName).get(),stdout);
- fputs ("...",stdout);
-
- delete urlName;
-
- nsIParser* parser;
-
- static NS_DEFINE_IID(kCParserIID, NS_IPARSER_IID);
- static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
-
- rv = nsComponentManager::CreateInstance(kCParserCID,
- nsnull,
- kCParserIID,
- (void **)&parser);
-
- if (NS_OK != rv) {
- printf("can't make parser\n");
- NS_RELEASE(myObserver);
- return -1;
- }
-
- nsIRobotSink* sink;
- rv = NS_NewRobotSink(&sink);
- if (NS_OK != rv) {
- printf("can't make parser\n");
- NS_RELEASE(myObserver);
- return -1;
- }
- sink->Init(url);
- sink->AddObserver(myObserver);
-
- parser->SetContentSink(sink);
- g_bReadyForNextUrl = PR_FALSE;
-
- parser->Parse(url, nsnull,PR_TRUE);/* XXX hook up stream listener here! */
- while (!g_bReadyForNextUrl) {
- if (yieldProc != NULL) {
- nsCAutoString spec;
- (void)url->GetSpec(spec);
- (*yieldProc)(spec.get());
- }
- }
- g_bReadyForNextUrl = PR_FALSE;
- if (docShell) {
- nsCOMPtr progress(do_GetInterface(docShell, &rv));
- if (NS_FAILED(rv)) return rv;
-
- (void) progress->AddProgressListener(pl, nsIWebProgress::NOTIFY_STATE_DOCUMENT);
-
- nsCAutoString spec;
- (void)url->GetSpec(spec);
- NS_ConvertUTF8toUCS2 theSpec(spec);
- nsCOMPtr webNav(do_QueryInterface(docShell));
- webNav->LoadURI(theSpec.get(),
- nsIWebNavigation::LOAD_FLAGS_NONE,
- nsnull,
- nsnull,
- nsnull);/* XXX hook up stream listener here! */
- while (!g_bReadyForNextUrl) {
- if (yieldProc != NULL) {
- (void)url->GetSpec(spec);
- (*yieldProc)(spec.get());
- }
- }
- }
-
- NS_RELEASE(sink);
- NS_RELEASE(parser);
- NS_RELEASE(url);
- }
-
- fputs ("Robot completed.\n", stdout);
-
- NS_RELEASE(pl);
- NS_RELEASE(myObserver);
-
- return 0;
-}
diff --git a/htmlparser/robot/nsIRobotSink.h b/htmlparser/robot/nsIRobotSink.h
deleted file mode 100644
index cd5d0b166375..000000000000
--- a/htmlparser/robot/nsIRobotSink.h
+++ /dev/null
@@ -1,59 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIRobotSink_h___
-#define nsIRobotSink_h___
-
-#include "nsIHTMLContentSink.h"
-class nsIURI;
-class nsIRobotSinkObserver;
-
-/* 61256800-cfd8-11d1-9328-00805f8add32 */
-#define NS_IROBOTSINK_IID \
-{ 0x61256800, 0xcfd8, 0x11d1, \
- {0x93, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
-
-class nsIRobotSink : public nsIHTMLContentSink {
-public:
- NS_IMETHOD Init(nsIURI* aDocumentURL) = 0;
- NS_IMETHOD AddObserver(nsIRobotSinkObserver* aObserver) = 0;
- NS_IMETHOD RemoveObserver(nsIRobotSinkObserver* aObserver) = 0;
-
-};
-
-extern nsresult NS_NewRobotSink(nsIRobotSink** aInstancePtrResult);
-
-#endif /* nsIRobotSink_h___ */
diff --git a/htmlparser/robot/nsIRobotSinkObserver.h b/htmlparser/robot/nsIRobotSinkObserver.h
deleted file mode 100644
index 88b19aef080f..000000000000
--- a/htmlparser/robot/nsIRobotSinkObserver.h
+++ /dev/null
@@ -1,56 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 nsIRobotSinkObserver_h___
-#define nsIRobotSinkObserver_h___
-
-#include "nsISupports.h"
-class nsString;
-
-/* fab1d970-cfda-11d1-9328-00805f8add32 */
-#define NS_IROBOTSINKOBSERVER_IID \
-{ 0xfab1d970, 0xcfda, 0x11d1, \
- {0x93, 0x28, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
-
-class nsIRobotSinkObserver : public nsISupports {
-public:
- NS_DEFINE_STATIC_IID_ACCESSOR(NS_IROBOTSINKOBSERVER_IID)
-
- NS_IMETHOD ProcessLink(const nsString& aURLSpec) = 0;
- NS_IMETHOD VerifyDirectory(const char * verify_dir) = 0;
-};
-
-#endif /* nsIRobotSinkObserver_h___ */
diff --git a/htmlparser/robot/nsRobotSink.cpp b/htmlparser/robot/nsRobotSink.cpp
deleted file mode 100644
index ef2ed62cd967..000000000000
--- a/htmlparser/robot/nsRobotSink.cpp
+++ /dev/null
@@ -1,401 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Pierre Phaneuf
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 "nsIRobotSink.h"
-#include "nsIRobotSinkObserver.h"
-#include "nsIParserNode.h"
-#include "nsIParser.h"
-#include "nsString.h"
-#include "nsReadableUtils.h"
-#include "nsUnicharUtils.h"
-#include "nsIURL.h"
-#include "nsIURL.h"
-#include "nsIServiceManager.h"
-#include "nsIIOService.h"
-#include "nsNetCID.h"
-#include "nsCRT.h"
-#include "nsVoidArray.h"
-class nsIDocument;
-
-// TODO
-// - add in base tag support
-// - get links from other sources:
-// - LINK tag
-// - STYLE SRC
-// - IMG SRC
-// - LAYER SRC
-
-static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
-static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-static NS_DEFINE_IID(kIHTMLContentSinkIID, NS_IHTML_CONTENT_SINK_IID);
-static NS_DEFINE_IID(kIRobotSinkIID, NS_IROBOTSINK_IID);
-
-class RobotSink : public nsIRobotSink {
-public:
- RobotSink();
- virtual ~RobotSink();
-
- NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
-
- // nsISupports
- NS_DECL_ISUPPORTS
-
- // nsIHTMLContentSink
- NS_IMETHOD SetTitle(const nsString& aValue);
- NS_IMETHOD OpenHTML(const nsIParserNode& aNode);
- NS_IMETHOD CloseHTML();
- NS_IMETHOD OpenHead(const nsIParserNode& aNode);
- NS_IMETHOD CloseHead();
- NS_IMETHOD OpenBody(const nsIParserNode& aNode);
- NS_IMETHOD CloseBody();
- NS_IMETHOD OpenForm(const nsIParserNode& aNode);
- NS_IMETHOD CloseForm();
- NS_IMETHOD OpenMap(const nsIParserNode& aNode);
- NS_IMETHOD CloseMap();
- NS_IMETHOD OpenFrameset(const nsIParserNode& aNode);
- NS_IMETHOD CloseFrameset();
- NS_IMETHOD IsEnabled(PRInt32 aTag, PRBool* aReturn) { return NS_OK; }
- NS_IMETHOD_(PRBool) IsFormOnStack() { return PR_FALSE; }
-
- NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
- NS_IMETHOD CloseContainer(const nsHTMLTag aTag);
- NS_IMETHOD CloseTopmostContainer();
- NS_IMETHOD AddHeadContent(const nsIParserNode& aNode);
- NS_IMETHOD AddLeaf(const nsIParserNode& aNode);
- NS_IMETHOD AddComment(const nsIParserNode& aNode);
- NS_IMETHOD AddProcessingInstruction(const nsIParserNode& aNode);
- NS_IMETHOD AddDocTypeDecl(const nsIParserNode& aNode);
- NS_IMETHOD WillBuildModel(void) { return NS_OK; }
- NS_IMETHOD DidBuildModel(void) { return NS_OK; }
- NS_IMETHOD WillInterrupt(void) { return NS_OK; }
- NS_IMETHOD WillResume(void) { return NS_OK; }
- NS_IMETHOD SetParser(nsIParser* aParser) { return NS_OK; }
- NS_IMETHOD FlushPendingNotifications() { return NS_OK; }
- NS_IMETHOD SetDocumentCharset(nsACString& aCharset) { return NS_OK; }
- NS_IMETHOD WillProcessTokens(void) { return NS_OK; }
- NS_IMETHOD DidProcessTokens(void) { return NS_OK; }
- NS_IMETHOD WillProcessAToken(void) { return NS_OK; }
- NS_IMETHOD DidProcessAToken(void) { return NS_OK; }
- NS_IMETHOD NotifyTagObservers(nsIParserNode* aNode) { return NS_OK; }
-
- NS_IMETHOD BeginContext(PRInt32 aPosition){ return NS_OK; }
- NS_IMETHOD EndContext(PRInt32 aPosition){ return NS_OK; }
-
- // nsIRobotSink
- NS_IMETHOD Init(nsIURI* aDocumentURL);
- NS_IMETHOD AddObserver(nsIRobotSinkObserver* aObserver);
- NS_IMETHOD RemoveObserver(nsIRobotSinkObserver* aObserver);
-
- void ProcessLink(const nsString& aLink);
-
-protected:
- nsIURI* mDocumentURL;
- nsVoidArray mObservers;
-};
-
-nsresult NS_NewRobotSink(nsIRobotSink** aInstancePtrResult)
-{
- RobotSink* it = new RobotSink();
- if(it)
- return it->QueryInterface(kIRobotSinkIID, (void**) aInstancePtrResult);
- return NS_OK;
-}
-
-RobotSink::RobotSink()
-{
-}
-
-RobotSink::~RobotSink()
-{
- NS_IF_RELEASE(mDocumentURL);
- PRInt32 i, n = mObservers.Count();
- for (i = 0; i < n; ++i) {
- nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
- NS_RELEASE(cop);
- }
-}
-
-NS_IMPL_ADDREF(RobotSink)
-
-NS_IMPL_RELEASE(RobotSink)
-
-NS_IMETHODIMP RobotSink::QueryInterface(REFNSIID aIID, void** aInstancePtr)
-{
- if (NULL == aInstancePtr) {
- return NS_ERROR_NULL_POINTER;
- }
- if (aIID.Equals(kIRobotSinkIID)) {
- *aInstancePtr = (void*) this;
- AddRef();
- return NS_OK;
- }
- if (aIID.Equals(kIHTMLContentSinkIID)) {
- *aInstancePtr = (void*) this;
- AddRef();
- return NS_OK;
- }
- if (aIID.Equals(kISupportsIID)) {
- *aInstancePtr = (void*) ((nsISupports*)this);
- AddRef();
- return NS_OK;
- }
- return NS_NOINTERFACE;
-}
-
-NS_IMETHODIMP RobotSink::SetTitle(const nsString& aValue)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenHTML(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseHTML()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenHead(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseHead()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenBody(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseBody()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenForm(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseForm()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenMap(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseMap()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenFrameset(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseFrameset()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::OpenContainer(const nsIParserNode& aNode)
-{
- nsAutoString tmp; tmp.Assign(aNode.GetText());
- ToLowerCase(tmp);
- if (tmp.Equals(NS_LITERAL_STRING("a"))) {
- nsAutoString k, v;
- PRInt32 ac = aNode.GetAttributeCount();
- for (PRInt32 i = 0; i < ac; ++i) {
- // Get upper-cased key
- const nsAString& key = aNode.GetKeyAt(i);
- k.Assign(key);
- ToLowerCase(k);
- if (k.Equals(NS_LITERAL_STRING("href"))) {
- // Get value and remove mandatory quotes
- v.Truncate();
- v.Append(aNode.GetValueAt(i));
- PRUnichar first = v.First();
- if ((first == '"') || (first == '\'')) {
- if (v.Last() == first) {
- v.Cut(0, 1);
- PRInt32 pos = v.Length() - 1;
- if (pos >= 0) {
- v.Cut(pos, 1);
- }
- } else {
- // Mismatched quotes - leave them in
- }
- }
- ProcessLink(v);
- }
- }
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseContainer(const nsHTMLTag aTag)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::CloseTopmostContainer()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::AddHeadContent(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::AddLeaf(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-/**
- * This gets called by the parsing system when we find a comment
- * @update gess11/9/98
- * @param aNode contains a comment token
- * @return error code
- */
-NS_IMETHODIMP RobotSink::AddComment(const nsIParserNode& aNode) {
- nsresult result= NS_OK;
- return result;
-}
-
-/**
- * This gets called by the parsing system when we find a PI
- * @update gess11/9/98
- * @param aNode contains a comment token
- * @return error code
- */
-NS_IMETHODIMP RobotSink::AddProcessingInstruction(const nsIParserNode& aNode) {
- nsresult result= NS_OK;
- return result;
-}
-
-/**
- * This gets called by the parser when it encounters
- * a DOCTYPE declaration in the HTML document.
- */
-
-NS_IMETHODIMP
-RobotSink::AddDocTypeDecl(const nsIParserNode& aNode)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::Init(nsIURI* aDocumentURL)
-{
- NS_IF_RELEASE(mDocumentURL);
- mDocumentURL = aDocumentURL;
- NS_IF_ADDREF(aDocumentURL);
- return NS_OK;
-}
-
-NS_IMETHODIMP RobotSink::AddObserver(nsIRobotSinkObserver* aObserver)
-{
- if (mObservers.AppendElement(aObserver)) {
- NS_ADDREF(aObserver);
- return NS_OK;
- }
- return NS_ERROR_OUT_OF_MEMORY;
-}
-
-NS_IMETHODIMP RobotSink::RemoveObserver(nsIRobotSinkObserver* aObserver)
-{
- if (mObservers.RemoveElement(aObserver)) {
- NS_RELEASE(aObserver);
- return NS_OK;
- }
- //XXX return NS_ERROR_NOT_FOUND;
- return NS_OK;
-}
-
-void RobotSink::ProcessLink(const nsString& aLink)
-{
- nsAutoString absURLSpec; absURLSpec.Assign(aLink);
-
- // Make link absolute
- // XXX base tag handling
- nsIURI* docURL = mDocumentURL;
- if (nsnull != docURL) {
- nsIURI* absurl;
- nsresult rv;
- nsCOMPtr service(do_GetService(kIOServiceCID, &rv));
- if (NS_FAILED(rv)) return;
-
- nsIURI *uri = nsnull, *baseUri = nsnull;
-
- rv = mDocumentURL->QueryInterface(NS_GET_IID(nsIURI), (void**)&baseUri);
- if (NS_FAILED(rv)) return;
-
- NS_ConvertUCS2toUTF8 uriStr(aLink);
- rv = service->NewURI(uriStr, nsnull, baseUri, &uri);
- NS_RELEASE(baseUri);
- if (NS_FAILED(rv)) return;
-
- rv = uri->QueryInterface(NS_GET_IID(nsIURI), (void**)&absurl);
- NS_RELEASE(uri);
-
- if (NS_OK == rv) {
- absURLSpec.Truncate();
- nsCAutoString str;
- absurl->GetSpec(str);
- absURLSpec = NS_ConvertUTF8toUCS2(str);
- }
- }
-
- // Now give link to robot observers
- PRInt32 i, n = mObservers.Count();
- for (i = 0; i < n; ++i) {
- nsIRobotSinkObserver* cop = (nsIRobotSinkObserver*)mObservers.ElementAt(i);
- cop->ProcessLink(absURLSpec);
- }
-}
-
-
diff --git a/htmlparser/robot/test/.cvsignore b/htmlparser/robot/test/.cvsignore
deleted file mode 100644
index 4a7ba5f079bf..000000000000
--- a/htmlparser/robot/test/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-htmlrobot
diff --git a/htmlparser/robot/test/RobotMain.cpp b/htmlparser/robot/test/RobotMain.cpp
deleted file mode 100644
index 785054b568d2..000000000000
--- a/htmlparser/robot/test/RobotMain.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "nsXPCOM.h"
-#include "nsVoidArray.h"
-#include "nsString.h"
-class nsIWebShell;
-
-extern "C" NS_EXPORT int DebugRobot(nsVoidArray * workList, nsIWebShell * ww);
-
-int main(int argc, char **argv)
-{
- nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
- if (NS_FAILED(rv)) {
- printf("NS_InitXPCOM2 failed\n");
- return 1;
- }
-
- nsVoidArray * gWorkList = new nsVoidArray();
- if(gWorkList) {
- int i;
- for (i = 1; i < argc; ++i) {
- nsString *tempString = new nsString;
- tempString->AssignWithConversion(argv[i]);
- gWorkList->AppendElement(tempString);
- }
- }
-
- return DebugRobot(gWorkList, nsnull);
-}
-
diff --git a/htmlparser/src/.cvsignore b/htmlparser/src/.cvsignore
deleted file mode 100644
index f3c7a7c5da68..000000000000
--- a/htmlparser/src/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-Makefile
diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp
deleted file mode 100644
index 6076756640e8..000000000000
--- a/htmlparser/src/CNavDTD.cpp
+++ /dev/null
@@ -1,3923 +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) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of 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 ***** */
-
-//#define ENABLE_CRC
-//#define ALLOW_TR_AS_CHILD_OF_TABLE //by setting this to true, TR is allowable directly in TABLE.
-
-#define ENABLE_RESIDUALSTYLE
-
-
-#include "nsDebug.h"
-#include "nsIAtom.h"
-#include "CNavDTD.h"
-#include "nsHTMLTokens.h"
-#include "nsCRT.h"
-#include "nsParser.h"
-#include "nsIParser.h"
-#include "nsIHTMLContentSink.h"
-#include "nsScanner.h"
-#include "prenv.h" //this is here for debug reasons...
-#include "prtypes.h" //this is here for debug reasons...
-#include "prio.h"
-#include "plstr.h"
-#include "nsDTDUtils.h"
-#include "nsHTMLTokenizer.h"
-#include "nsTime.h"
-#include "nsParserNode.h"
-#include "nsHTMLEntities.h"
-#include "nsLinebreakConverter.h"
-#include "nsIFormProcessor.h"
-#include "nsVoidArray.h"
-#include "nsReadableUtils.h"
-#include "nsUnicharUtils.h"
-#include "prmem.h"
-#include "nsIServiceManager.h"
-
-#ifdef NS_DEBUG
-#include "nsLoggingSink.h"
-#endif
-
-
-static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
-static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
-static NS_DEFINE_IID(kClassIID, NS_INAVHTML_DTD_IID);
-
-static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
-
-#ifdef DEBUG
-static const char kNullToken[] = "Error: Null token given";
-static const char kInvalidTagStackPos[] = "Error: invalid tag stack position";
-#endif
-
-#ifdef ENABLE_CRC
-static char gShowCRC;
-#endif
-
-#include "nsElementTable.h"
-
-
-#ifdef MOZ_PERF_METRICS
-# define START_TIMER() \
- if(mParser) MOZ_TIMER_START(mParser->mParseTime); \
- if(mParser) MOZ_TIMER_START(mParser->mDTDTime);
-
-# define STOP_TIMER() \
- if(mParser) MOZ_TIMER_STOP(mParser->mParseTime); \
- if(mParser) MOZ_TIMER_STOP(mParser->mDTDTime);
-#else
-# define STOP_TIMER()
-# define START_TIMER()
-#endif
-
-/************************************************************************
- And now for the main class -- CNavDTD...
- ************************************************************************/
-
-
-#define NS_DTD_FLAG_NONE 0x00000000
-#define NS_DTD_FLAG_HAS_OPEN_HEAD 0x00000001
-#define NS_DTD_FLAG_HAS_OPEN_BODY 0x00000002
-#define NS_DTD_FLAG_HAS_OPEN_FORM 0x00000004
-#define NS_DTD_FLAG_HAS_OPEN_SCRIPT 0x00000008
-#define NS_DTD_FLAG_HAD_BODY 0x00000010
-#define NS_DTD_FLAG_HAD_FRAMESET 0x00000020
-#define NS_DTD_FLAG_ENABLE_RESIDUAL_STYLE 0x00000040
-#define NS_DTD_FLAG_SCRIPT_ENABLED 0x00000100
-#define NS_DTD_FLAG_FRAMES_ENABLED 0x00000200
-#define NS_DTD_FLAG_ALTERNATE_CONTENT 0x00000400 // NOFRAMES, NOSCRIPT
-#define NS_DTD_FLAG_MISPLACED_CONTENT 0x00000800
-#define NS_DTD_FLAG_STOP_PARSING 0x00001000
-
-/**
- * This method gets called as part of our COM-like interfaces.
- * Its purpose is to create an interface to parser object
- * of some type.
- *
- * @update gess 4/8/98
- * @param nsIID id of object to discover
- * @param aInstancePtr ptr to newly discovered interface
- * @return NS_xxx result code
- */
-nsresult CNavDTD::QueryInterface(const nsIID& aIID, void** aInstancePtr)
-{
- if (NULL == aInstancePtr) {
- return NS_ERROR_NULL_POINTER;
- }
-
- if(aIID.Equals(kISupportsIID)) { //do IUnknown...
- *aInstancePtr = (nsIDTD*)(this);
- }
- else if(aIID.Equals(kIDTDIID)) { //do IParser base class...
- *aInstancePtr = (nsIDTD*)(this);
- }
- else if(aIID.Equals(kClassIID)) { //do this class...
- *aInstancePtr = (CNavDTD*)(this);
- }
- else {
- *aInstancePtr=0;
- return NS_NOINTERFACE;
- }
- NS_ADDREF_THIS();
- return NS_OK;
-}
-
-NS_IMPL_ADDREF(CNavDTD)
-NS_IMPL_RELEASE(CNavDTD)
-
-/**
- * Default constructor
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
-CNavDTD::CNavDTD() : nsIDTD(),
- mMisplacedContent(0),
- mSkippedContent(0),
- mSink(0),
- mTokenAllocator(0),
- mTempContext(0),
- mParser(0),
- mTokenizer(0),
- mDTDMode(eDTDMode_quirks),
- mDocType(eHTML3_Quirks), // why not eHTML_Quirks?
- mParserCommand(eViewNormal),
- mSkipTarget(eHTMLTag_unknown),
- mLineNumber(1),
- mOpenMapCount(0),
- mFlags(NS_DTD_FLAG_NONE)
-#ifdef ENABLE_CRC
- ,mComputedCRC32(0),
- mExpectedCRC32(0)
-#endif
-{
- mBodyContext=new nsDTDContext();
-}
-
-/**
- *
- * @update gess1/8/99
- * @param
- * @return
- */
-const nsIID& CNavDTD::GetMostDerivedIID(void)const {
- return kClassIID;
-}
-
-
-#ifdef NS_DEBUG
-
-nsLoggingSink* GetLoggingSink() {
-
- //these are used when you want to generate a log file for contentsink construction...
-
- static PRBool checkForPath=PR_TRUE;
- static nsLoggingSink *theSink=0;
- static const char* gLogPath=0;
-
- if(checkForPath) {
-
- // we're only going to check the environment once per session.
-
- gLogPath = /* "c:/temp/parse.log"; */ PR_GetEnv("PARSE_LOGFILE");
- checkForPath=PR_FALSE;
- }
-
-
- if(gLogPath && (!theSink)) {
- static nsLoggingSink gLoggingSink;
-
- PRIntn theFlags = 0;
-
- // create the file exists, only open for read/write
- // otherwise, create it
- if(PR_Access(gLogPath,PR_ACCESS_EXISTS) != PR_SUCCESS)
- theFlags = PR_CREATE_FILE;
- theFlags |= PR_RDWR;
-
- // open the record file
- PRFileDesc *theLogFile = PR_Open(gLogPath,theFlags,0);
- gLoggingSink.SetOutputStream(theLogFile,PR_TRUE);
- theSink=&gLoggingSink;
- }
-
- return theSink;
-}
-
-#endif
-
-/**
- * Default destructor
- *
- * @update gess 4/9/98
- * @param
- * @return
- */
-CNavDTD::~CNavDTD(){
- if(mBodyContext) {
- delete mBodyContext;
- mBodyContext=0;
- }
-
- if(mTempContext) {
- delete mTempContext;
- mTempContext=0;
- }
-
-
-#ifdef NS_DEBUG
- if(mSink) {
- nsLoggingSink *theLogSink=GetLoggingSink();
- if(mSink==theLogSink) {
- theLogSink->ReleaseProxySink();
- }
- }
-#endif
-
- NS_IF_RELEASE(mSink);
-}
-
-
-/**
- * Call this method if you want the DTD to construct a fresh
- * instance of itself.
- * @update gess 25May2000
- * @param
- * @return
- */
-nsresult CNavDTD::CreateNewInstance(nsIDTD** aInstancePtrResult)
-{
- nsresult result = NS_NewNavHTMLDTD(aInstancePtrResult);
- NS_ENSURE_SUCCESS(result, result);
-
- CNavDTD* dtd = NS_STATIC_CAST(CNavDTD*, *aInstancePtrResult);
-
- dtd->mDTDMode = mDTDMode;
- dtd->mParserCommand = mParserCommand;
- dtd->mDocType = mDocType;
-
- return result;
-}
-
-/**
- * This method is called to determine if the given DTD can parse
- * a document in a given source-type.
- * NOTE: Parsing always assumes that the end result will involve
- * storing the result in the main content model.
- * @update gess 02/24/00
- * @param
- * @return TRUE if this DTD can satisfy the request; FALSE otherwise.
- */
-NS_IMETHODIMP_(eAutoDetectResult)
-CNavDTD::CanParse(CParserContext& aParserContext,
- const nsString& aBuffer, PRInt32 aVersion)
-{
- eAutoDetectResult result=eUnknownDetect;
-
- if(aParserContext.mParserCommand != eViewSource) {
- if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kHTMLTextContentType))) {
- result=ePrimaryDetect;
- }
- else if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kPlainTextContentType))) {
- result=ePrimaryDetect;
- }
- else if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kTextCSSContentType))) {
- result=ePrimaryDetect;
- }
- else if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kApplicationJSContentType))) {
- result=ePrimaryDetect;
- }
- else if(PR_TRUE==aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kTextJSContentType))) {
- result=ePrimaryDetect;
- }
- // do this for XML-based content-types so that we don't fall back
- // to BufferContainsHTML() for known content types
- // see bug 132681
- // this will be cleaned up after moz 1.0 -alecf
- else if (aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kRDFTextContentType)) ||
- aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXULTextContentType)) ||
- aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXMLTextContentType)) ||
-#ifdef MOZ_SVG
- aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kSVGTextContentType)) ||
-#endif
- aParserContext.mMimeType.Equals(NS_LITERAL_CSTRING(kXMLApplicationContentType))) {
- result=eUnknownDetect;
- }
- else {
- //otherwise, look into the buffer to see if you recognize anything...
- PRBool theBufHasXML=PR_FALSE;
- if(BufferContainsHTML(aBuffer,theBufHasXML)){
- result = eValidDetect ;
- if(0==aParserContext.mMimeType.Length()) {
- aParserContext.SetMimeType(NS_LITERAL_CSTRING(kHTMLTextContentType));
- if(!theBufHasXML) {
- switch(aParserContext.mDTDMode) {
- case eDTDMode_full_standards:
- case eDTDMode_almost_standards:
- result=eValidDetect;
- break;
- default:
- result=ePrimaryDetect;
- break;
- }
- }
- else result=eValidDetect;
- }
- }
- }
- }
- return result;
-}
-
-/**
- * The parser uses a code sandwich to wrap the parsing process. Before
- * the process begins, WillBuildModel() is called. Afterwards the parser
- * calls DidBuildModel().
- * @update rickg 03.20.2000
- * @param aParserContext
- * @param aSink
- * @return error code (almost always 0)
- */
-nsresult CNavDTD::WillBuildModel(const CParserContext& aParserContext,
- nsITokenizer* aTokenizer,
- nsIContentSink* aSink) {
- nsresult result=NS_OK;
-
- mFilename=aParserContext.mScanner->GetFilename();
- mFlags = NS_DTD_FLAG_ENABLE_RESIDUAL_STYLE; // residual style is always on. This will also reset the flags
- mLineNumber = 1;
- mDTDMode = aParserContext.mDTDMode;
- mParserCommand = aParserContext.mParserCommand;
- mMimeType = aParserContext.mMimeType;
- mDocType = aParserContext.mDocType;
- mSkipTarget = eHTMLTag_unknown;
- mTokenizer = aTokenizer;
- mBodyContext->SetNodeAllocator(&mNodeAllocator);
-
- if(!aParserContext.mPrevContext && aSink) {
-
-#ifdef DEBUG
- mBodyContext->ResetCounters();
-#endif
-
- STOP_TIMER();
- MOZ_TIMER_DEBUGLOG(("Stop: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
-
- result = aSink->WillBuildModel();
-
- MOZ_TIMER_DEBUGLOG(("Start: Parse Time: CNavDTD::WillBuildModel(), this=%p\n", this));
- START_TIMER();
-
- if (NS_SUCCEEDED(result) && !mSink) {
- result = CallQueryInterface(aSink, &mSink);
- if (NS_FAILED(result)) {
- mFlags |= NS_DTD_FLAG_STOP_PARSING;
- return result;
- }
- }
-
- //let's see if the environment is set up for us to write output to
- //a logging sink. If so, then we'll create one, and make it the
- //proxy for the real sink we're given from the parser.
-#ifdef NS_DEBUG
- nsLoggingSink *theLogSink=GetLoggingSink();
- if(theLogSink) {
- theLogSink->SetProxySink(mSink);
- mSink=theLogSink;
- }
-#endif
-
- if(mSink) {
- PRBool enabled;
- mSink->IsEnabled(eHTMLTag_frameset, &enabled);
- if(enabled) {
- mFlags |= NS_DTD_FLAG_FRAMES_ENABLED;
- }
-
- mSink->IsEnabled(eHTMLTag_script, &enabled);
- if(enabled) {
- mFlags |= NS_DTD_FLAG_SCRIPT_ENABLED;
- }
- }
-
-#ifdef ENABLE_CRC
- mComputedCRC32=0;
- mExpectedCRC32=0;
-#endif
- }
-
- return result;
-}
-
-
-/**
- * This is called when it's time to read as many tokens from the tokenizer
- * as you can. Not all tokens may make sense, so you may not be able to
- * read them all (until more come in later).
- *
- * @update gess5/18/98
- * @param aParser is the parser object that's driving this process
- * @return error code (almost always NS_OK)
- */
-nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver,nsIContentSink* aSink) {
- NS_PRECONDITION(mBodyContext!=nsnull,"Create a context before calling build model");
-
- nsresult result = NS_OK;
-
- if (aTokenizer && aParser) {
- nsITokenizer* oldTokenizer = mTokenizer;
-
- mTokenizer = aTokenizer;
- mParser = (nsParser*)aParser;
- mTokenAllocator = mTokenizer->GetTokenAllocator();
-
- if (mSink) {
- if (mBodyContext->GetCount() == 0) {
- CStartToken* theToken=nsnull;
- if(ePlainText==mDocType) {
- //we do this little trick for text files, in both normal and viewsource mode...
- theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_pre));
- if(theToken) {
- mTokenizer->PushTokenFront(theToken);
- }
- }
-
- // always open a body if frames are disabled....
- if(!(mFlags & NS_DTD_FLAG_FRAMES_ENABLED)) {
- theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body")));
- mTokenizer->PushTokenFront(theToken);
- }
- //if the content model is empty, then begin by opening ...
- theToken = (CStartToken*)mTokenizer->GetTokenAt(0);
- if (theToken) {
- eHTMLTags theTag = (eHTMLTags)theToken->GetTypeID();
- eHTMLTokenTypes theType = eHTMLTokenTypes(theToken->GetTokenType());
- if (theTag != eHTMLTag_html || theType != eToken_start) {
- theToken = NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")));
- if (theToken) {
- mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack.
- }
- }
- }
- else {
- theToken = NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")));
- if (theToken) {
- mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack.
- }
- }
- }
-
- mSink->WillProcessTokens();
-
- while (NS_SUCCEEDED(result)) {
- if (!(mFlags & NS_DTD_FLAG_STOP_PARSING)) {
- CToken* theToken = mTokenizer->PopToken();
- if (theToken) {
- result = HandleToken(theToken,aParser);
- }
- else break;
- }
- else {
- result = NS_ERROR_HTMLPARSER_STOPPARSING;
- break;
- }
-
- if ((NS_ERROR_HTMLPARSER_INTERRUPTED == mSink->DidProcessAToken())) {
- // The content sink has requested that DTD interrupt processing tokens
- // So we need to make sure the parser is in a state where it can be
- // interrupted.
- // The mParser->CanInterrupt will return TRUE if BuildModel was called
- // from a place in the parser where it prepared to handle a return value of
- // NS_ERROR_HTMLPARSER_INTERRUPTED.
- // If the parser has mPrevContext then it may be processing
- // Script so we should not allow it to be interrupted.
-
- if ((mParser->CanInterrupt()) &&
- (nsnull == mParser->PeekContext()->mPrevContext) &&
- (eHTMLTag_unknown==mSkipTarget)) {
- result = NS_ERROR_HTMLPARSER_INTERRUPTED;
- break;
- }
- }
- }//while
- mTokenizer = oldTokenizer;
- }
- else {
- result = mFlags & NS_DTD_FLAG_STOP_PARSING ? NS_ERROR_HTMLPARSER_STOPPARSING : result;
- }
- }
-
- return result;
-}
-
-/**
- * @param aTarget - Tag that was neglected in the document.
- * @param aType - Specifies the type of the target. Ex. start, end, text, etc.
- * @param aParser - Parser to drive this process
- * @param aSink - HTML Content sink
- */
-nsresult
-CNavDTD::BuildNeglectedTarget(eHTMLTags aTarget,
- eHTMLTokenTypes aType,
- nsIParser* aParser,
- nsIContentSink* aSink)
-{
- NS_ASSERTION(mTokenizer, "tokenizer is null! unable to build target.");
- NS_ASSERTION(mTokenAllocator, "unable to create tokens without an allocator.");
- if (!mTokenizer || !mTokenAllocator)
- return NS_OK;
- if (eHTMLTag_unknown != mSkipTarget && eHTMLTag_title == aTarget) {
- PRInt32 size = mSkippedContent.GetSize();
- // Note: The first location of the skipped content
- // deque contains the opened-skip-target. Do not include
- // that when guessing title contents. The term "guessing"
- // is used because the document did not contain an end title
- // and hence it's almost impossible to know what markup
- // should belong in the title. The assumption used here is that
- // if the markup is anything other than "text", or "entity" or,
- // "whitespace" then it's least likely to belong in the title.
- PRInt32 index;
- for (index = 1; index < size; index++) {
- CHTMLToken* token =
- NS_REINTERPRET_CAST(CHTMLToken*, mSkippedContent.ObjectAt(index));
- NS_ASSERTION(token, "there is a null token in the skipped content list!");
- eHTMLTokenTypes type = eHTMLTokenTypes(token->GetTokenType());
- if (eToken_whitespace != type &&
- eToken_newline != type &&
- eToken_text != type &&
- eToken_entity != type &&
- eToken_attribute != type) {
- // Now pop the tokens that do not belong ( just a guess work )
- // in the title and push them into the tokens queue.
- while (size != index++) {
- token = NS_REINTERPRET_CAST(CHTMLToken*, mSkippedContent.Pop());
- mTokenizer->PushTokenFront(token);
- }
- break;
- }
- }
- }
- CHTMLToken* target =
- NS_STATIC_CAST(CHTMLToken*, mTokenAllocator->CreateTokenOfType(aType, aTarget));
- mTokenizer->PushTokenFront(target);
- return BuildModel(aParser, mTokenizer, 0, aSink);
-}
-
-/**
- *
- * @update gess5/18/98
- * @param
- * @return
- */
-nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,
- PRBool aNotifySink,
- nsIParser* aParser,
- nsIContentSink* aSink)
-{
- if (!aSink)
- return NS_OK;
- nsresult result = NS_OK;
- if (aParser && aNotifySink) {
- if (NS_OK == anErrorCode) {
- if (eHTMLTag_unknown != mSkipTarget) {
- // Looks like there is an open target ( ex. ,