diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp
new file mode 100644
index 00000000000..6b4b54b57bc
--- /dev/null
+++ b/mozilla/htmlparser/src/CNavDTD.cpp
@@ -0,0 +1,298 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+/**
+ * MODULE NOTES:
+ * @update gess 4/8/98
+ *
+ *
+ */
+
+#include "CNavDTD.h"
+#include "nsHTMLTokens.h"
+#include "nsCRT.h"
+#include "nsParserTypes.h"
+
+static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
+static NS_DEFINE_IID(kIDTDIID, NS_IDTD_IID);
+static NS_DEFINE_IID(kHTMLDTDIID, NS_IHTML_DTD_IID);
+static NS_DEFINE_IID(kClassIID, NS_INAVHTML_DTD_IID);
+
+
+/**-------------------------------------------------------
+ * 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;
+ }
+ ((nsISupports*) *aInstancePtr)->AddRef();
+ return NS_OK;
+}
+
+/**-------------------------------------------------------
+ * This method is defined in nsIParser. It is used to
+ * cause the COM-like construction of an nsHTMLParser.
+ *
+ * @update gess 4/8/98
+ * @param nsIParser** ptr to newly instantiated parser
+ * @return NS_xxx error result
+ *------------------------------------------------------*/
+NS_HTMLPARS nsresult NS_NewNavHTMLDTD(nsIDTD** aInstancePtrResult)
+{
+ CNavDTD* it = new CNavDTD();
+
+ if (it == 0) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return it->QueryInterface(kClassIID, (void **) aInstancePtrResult);
+}
+
+
+NS_IMPL_ADDREF(CNavDTD)
+NS_IMPL_RELEASE(CNavDTD)
+
+
+/**-------------------------------------------------------
+ * Default constructor
+ *
+ * @update gess 4/9/98
+ * @param
+ * @return
+ *------------------------------------------------------*/
+CNavDTD::CNavDTD() : nsHTMLDTD() {
+}
+
+/**-------------------------------------------------------
+ * Default destructor
+ *
+ * @update gess 4/9/98
+ * @param
+ * @return
+ *------------------------------------------------------*/
+CNavDTD::~CNavDTD(){
+}
+
+/** ------------------------------------------------------
+ * This method is called to determine whether or not a tag
+ * of one type can contain a tag of another type.
+ *
+ * @update gess 4/8/98
+ * @param aParent -- tag enum of parent container
+ * @param aChild -- tag enum of child container
+ * @return PR_TRUE if parent can contain child
+ */ //----------------------------------------------------
+PRBool CNavDTD::CanContain(PRInt32 aParent,PRInt32 aChild) const {
+ PRBool result=nsHTMLDTD::CanContain(aParent,aChild);
+ return result;
+}
+
+
+/** ------------------------------------------------------
+ * This method is called to determine whether or not a tag
+ * of one type can contain a tag of another type.
+ *
+ * @update gess 4/8/98
+ * @param aParent -- tag enum of parent container
+ * @param aChild -- tag enum of child container
+ * @return PR_TRUE if parent can contain child
+ */ //----------------------------------------------------
+PRBool CNavDTD::CanContainIndirect(PRInt32 aParent,PRInt32 aChild) const {
+ PRBool result=nsHTMLDTD::CanContainIndirect(aParent,aChild);
+ return result;
+}
+
+/** -------------------------------------------------------
+ * This method gets called to determine whether a given
+ * tag can contain newlines. Most do not.
+ *
+ * @update gess 3/25/98
+ * @param aTag -- tag to test for containership
+ * @return PR_TRUE if given tag can contain other tags
+ */ //----------------------------------------------------
+PRBool CNavDTD::CanOmit(PRInt32 aParent,PRInt32 aChild) const {
+ PRBool result=PR_FALSE;
+
+ switch((eHTMLTags)aParent) {
+ case eHTMLTag_tr:
+ case eHTMLTag_table:
+ case eHTMLTag_thead:
+ case eHTMLTag_tfoot:
+ case eHTMLTag_tbody:
+ case eHTMLTag_col:
+ case eHTMLTag_colgroup:
+ if((aChild==eHTMLTag_newline) ||
+ (aChild==eHTMLTag_whitespace))
+ result=PR_TRUE;
+ break;
+
+ default:
+ result=PR_FALSE;
+ break;
+ }
+ return result;
+}
+
+/** -------------------------------------------------------
+ * This method gets called to determine whether a given
+ * tag is itself a container
+ *
+ * @update gess 4/8/98
+ * @param aTag -- tag to test for containership
+ * @return PR_TRUE if given tag can contain other tags
+ */ //----------------------------------------------------
+PRBool CNavDTD::IsContainer(PRInt32 aTag) const {
+ PRBool result=nsHTMLDTD::IsContainer(aTag);
+ return result;
+}
+
+/*-------------------------------------------------------
+ * This method does two things: 1st, help construct
+ * our own internal model of the content-stack; and
+ * 2nd, pass this message on to the sink.
+ * @update gess4/6/98
+ * @param aNode -- next node to be added to model
+ * @return TRUE if ok, FALSE if error
+ *------------------------------------------------------*/
+PRInt32 CNavDTD::GetDefaultParentTagFor(PRInt32 aTag) const{
+ eHTMLTags result=eHTMLTag_unknown;
+ switch(aTag) {
+ case eHTMLTag_html:
+ result=(eHTMLTags)kNotFound; break;
+
+ case eHTMLTag_body:
+ case eHTMLTag_head:
+ case eHTMLTag_header:
+ case eHTMLTag_footer:
+ case eHTMLTag_frameset:
+ result=eHTMLTag_html; break;
+
+ //These tags are head specific...
+ case eHTMLTag_style:
+ case eHTMLTag_meta:
+ case eHTMLTag_title:
+ case eHTMLTag_base:
+ case eHTMLTag_link:
+ result=eHTMLTag_head; break;
+
+ //These tags are table specific...
+ case eHTMLTag_caption:
+ case eHTMLTag_colgroup:
+ case eHTMLTag_tbody:
+ case eHTMLTag_tfoot:
+ case eHTMLTag_thead:
+ case eHTMLTag_tr:
+ result=eHTMLTag_table; break;
+
+ case eHTMLTag_td:
+ case eHTMLTag_th:
+ result=eHTMLTag_tr; break;
+
+ case eHTMLTag_col:
+ result=eHTMLTag_colgroup; break;
+
+ //These have to do with listings...
+ case eHTMLTag_listitem:
+ result=eHTMLTag_ul; break;
+
+ case eHTMLTag_dd:
+ case eHTMLTag_dt:
+ result=eHTMLTag_dl; break;
+
+ case eHTMLTag_option:
+ result=eHTMLTag_select; break;
+
+ //These have to do with image maps...
+ case eHTMLTag_area:
+ result=eHTMLTag_map; break;
+
+ //These have to do with applets...
+ case eHTMLTag_param:
+ result=eHTMLTag_applet; break;
+
+ //These have to do with frames...
+ case eHTMLTag_frame:
+ result=eHTMLTag_frameset; break;
+
+ default:
+ result=eHTMLTag_body; //XXX Hack! Just for now.
+ break;
+ }
+ return result;
+}
+
+
+/** ------------------------------------------------------
+ * This method gets called at various times by the parser
+ * whenever we want to verify a valid context stack. This
+ * method also gives us a hook to add debugging metrics.
+ *
+ * @update gess4/6/98
+ * @param aStack[] array of ints (tokens)
+ * @param aCount number of elements in given array
+ * @return TRUE if stack is valid, else FALSE
+ */ //-----------------------------------------------------
+PRBool CNavDTD::VerifyContextStack(eHTMLTags aStack[],PRInt32 aCount) const {
+ PRBool result=PR_TRUE;
+
+ if(aCount>0) {
+
+ }
+ return result;
+}
+
+
+/** -------------------------------------------------------
+ * This method tries to design a context map (without actually
+ * changing our parser state) from the parent down to the
+ * child.
+ *
+ * @update gess4/6/98
+ * @param aParent -- tag type of parent
+ * @param aChild -- tag type of child
+ * @return Non zero count of intermediate nodes;
+ * 0 if unable to comply
+ */ //----------------------------------------------------
+PRInt32 CNavDTD::CreateContextMapBetween(PRInt32 aParent,PRInt32 aChild) const {
+ PRInt32 result=0;
+ return result;
+}
+
diff --git a/mozilla/htmlparser/src/CNavDTD.h b/mozilla/htmlparser/src/CNavDTD.h
new file mode 100644
index 00000000000..6014335290a
--- /dev/null
+++ b/mozilla/htmlparser/src/CNavDTD.h
@@ -0,0 +1,147 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+/**
+ * MODULE NOTES:
+ * @update gess 4/8/98
+ *
+ *
+ */
+
+#ifndef NS_NAVHTMLDTD__
+#define NS_NAVHTMLDTD__
+
+#include "nsHTMLDTD.h"
+#include "nsHTMLTokens.h"
+#include "nshtmlpars.h"
+
+
+#define NS_INAVHTML_DTD_IID \
+ {0x5c5cce40, 0xcfd6, 0x11d1, \
+ {0xaa, 0xda, 0x00, 0x80, 0x5f, 0x8a, 0x3e, 0x14}}
+
+
+
+class CNavDTD : public nsHTMLDTD {
+
+ public:
+
+ NS_DECL_ISUPPORTS
+
+
+ /** -------------------------------------------------------
+ *
+ *
+ * @update gess 4/9/98
+ * @param
+ * @return
+ */ //------------------------------------------------------
+ CNavDTD();
+
+ /** -------------------------------------------------------
+ *
+ *
+ * @update gess 4/9/98
+ * @param
+ * @return
+ */ //------------------------------------------------------
+ virtual ~CNavDTD();
+
+ /** ------------------------------------------------------
+ * 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 -- tag enum of parent container
+ * @param aChild -- tag enum of child container
+ * @return PR_TRUE if parent can contain child
+ */ //----------------------------------------------------
+ virtual PRBool CanContain(PRInt32 aParent,PRInt32 aChild) const;
+
+ /** ------------------------------------------------------
+ * 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 -- tag enum of parent container
+ * @param aChild -- tag enum of child container
+ * @return PR_TRUE if parent can contain child
+ */ //----------------------------------------------------
+ virtual PRBool CanContainIndirect(PRInt32 aParent,PRInt32 aChild) const;
+
+ /** -------------------------------------------------------
+ * This method gets called to determine whether a given
+ * tag can contain newlines. Most do not.
+ *
+ * @update gess 3/25/98
+ * @param aTag -- tag to test for containership
+ * @return PR_TRUE if given tag can contain other tags
+ */ //----------------------------------------------------
+ virtual PRBool CanOmit(PRInt32 aParent,PRInt32 aChild)const;
+
+ /** -------------------------------------------------------
+ * 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
+ */ //----------------------------------------------------
+ virtual PRBool IsContainer(PRInt32 aTags) const;
+
+ /** ------------------------------------------------------
+ * This method does two things: 1st, help construct
+ * our own internal model of the content-stack; and
+ * 2nd, pass this message on to the sink.
+ * @update gess4/6/98
+ * @param aNode -- next node to be added to model
+ * @return TRUE if ok, FALSE if error
+ */ //----------------------------------------------------
+ virtual PRInt32 GetDefaultParentTagFor(PRInt32 aTag) const;
+
+
+ /** ------------------------------------------------------
+ * This method gets called at various times by the parser
+ * whenever we want to verify a valid context stack. This
+ * method also gives us a hook to add debugging metrics.
+ *
+ * @update gess4/6/98
+ * @param aStack[] array of ints (tokens)
+ * @param aCount number of elements in given array
+ * @return TRUE if stack is valid, else FALSE
+ */ //-----------------------------------------------------
+ virtual PRBool VerifyContextStack(eHTMLTags aStack[],PRInt32 aCount) const;
+
+ /** -------------------------------------------------------
+ * This method tries to design a context map (without actually
+ * changing our parser state) from the parent down to the
+ * child.
+ *
+ * @update gess4/6/98
+ * @param aParent -- tag type of parent
+ * @param aChild -- tag type of child
+ * @return Non zero count of intermediate nodes;
+ * 0 if unable to comply
+ */ //----------------------------------------------------
+ virtual PRInt32 CreateContextMapBetween(PRInt32 aParent,PRInt32 aChild) const;
+
+};
+
+
+#endif
+
diff --git a/mozilla/htmlparser/src/CNavDelegate.cpp b/mozilla/htmlparser/src/CNavDelegate.cpp
new file mode 100644
index 00000000000..46af8b8ad1e
--- /dev/null
+++ b/mozilla/htmlparser/src/CNavDelegate.cpp
@@ -0,0 +1,232 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * The contents of this file are subject to the Netscape Public License
+ * Version 1.0 (the "NPL"); you may not use this file except in
+ * compliance with the NPL. You may obtain a copy of the NPL at
+ * http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the NPL is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
+ * for the specific language governing rights and limitations under the
+ * NPL.
+ *
+ * The Initial Developer of this code under the NPL is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All Rights
+ * Reserved.
+ */
+
+#include
+#include "CNavDelegate.h"
+#include "nsHTMLTokens.h"
+#include "nsScanner.h"
+#include "nsParserTypes.h"
+
+
+// Note: We already handle the following special case conditions:
+// 1) If you see >, simply treat it as a bad tag.
+// 2) If you see ...>, treat it like a comment.
+// 3) If you see <> or <_ (< space) simply treat it as text.
+// 4) If you see <~ (< followed by non-alpha), treat it as text.
+
+static char gIdentChars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
+
+
+/**-------------------------------------------------------
+ * Default constructor
+ *
+ * @updated gess 3/25/98
+ * @param
+ * @return
+ *-----------------------------------------------------*/
+CNavDelegate::CNavDelegate() : CHTMLTokenizerDelegate(){
+}
+
+/**-------------------------------------------------------
+ * Default constructor
+ *
+ * @updated gess 3/25/98
+ * @param
+ * @return
+ *-----------------------------------------------------*/
+CNavDelegate::CNavDelegate(CNavDelegate& aDelegate) : CHTMLTokenizerDelegate() {
+}
+
+
+/*-------------------------------------------------------
+ *
+ * @update gess4/11/98
+ * @param
+ * @return
+ *------------------------------------------------------*/
+eParseMode CNavDelegate::GetParseMode() const {
+ return eParseMode_navigator;
+}
+
+/**-------------------------------------------------------
+ * This method is called just after a "<" has been consumed
+ * and we know we're at the start of some kind of tagged
+ * element. We don't know yet if it's a tag or a comment.
+ *
+ * @update gess 3/25/98
+ * @param
+ * @return
+ *-----------------------------------------------------*/
+CToken* CNavDelegate::ConsumeTag(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode) {
+ CToken* result=0;
+ nsAutoString empty("");
+ anErrorCode=anErrorCode=aScanner.GetChar(aChar);
+
+ switch(aChar) {
+ case kForwardSlash:
+ PRUnichar ch;
+ anErrorCode=aScanner.Peek(ch);
+ if(nsString::IsAlpha(ch))
+ result=new CEndToken(empty);
+ else result=new CCommentToken(empty); //Special case: ...> is treated as a comment
+ break;
+ case kExclamation:
+ result=new CCommentToken(empty);
+ break;
+ default:
+ if(nsString::IsAlpha(aChar))
+ return ConsumeStartTag(aChar,aScanner,anErrorCode);
+ else if(kNotFound!=aChar) {
+ nsAutoString temp("<");
+ return ConsumeText(temp,aScanner,anErrorCode);
+ }
+ }
+
+ if(result!=0) {
+ anErrorCode= result->Consume(aChar,aScanner); //tell new token to finish consuming text...
+ if(anErrorCode) {
+ result=0;
+ delete result;
+ }
+ }
+ return result;
+}
+
+/*-------------------------------------------------------
+ * This is a special case method. It's job is to consume
+ * all of the given tag up to an including the end tag.
+ *
+ * @param aChar: last char read
+ * @param aScanner: see nsScanner.h
+ * @param anErrorCode: arg that will hold error condition
+ * @return new token or null
+ *------------------------------------------------------*/
+CToken* CNavDelegate::ConsumeContentToEndTag(const nsString& aString,PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode){
+
+ //In the case that we just read the given tag, we should go and
+ //consume all the input until we find a matching end tag.
+
+ nsAutoString endTag("");
+ endTag.Append(aString);
+ endTag.Append(">");
+ CSkippedContentToken* sc=new CSkippedContentToken(endTag);
+ anErrorCode= sc->Consume(aChar,aScanner); //tell new token to finish consuming text...
+ return sc;
+}
+
+/**-------------------------------------------------------
+ * This method is called just after a "<" has been consumed
+ * and we know we're at the start of a tag.
+ *
+ * @update gess 3/25/98
+ * @param aChar: last char read
+ * @param aScanner: see nsScanner.h
+ * @param anErrorCode: arg that will hold error condition
+ * @return new token or null
+ *------------------------------------------------------*/
+CToken* CNavDelegate::ConsumeStartTag(PRUnichar aChar,CScanner& aScanner,PRInt32& anErrorCode) {
+ CStartToken* result=new CStartToken(nsAutoString(""));
+ if(result) {
+ anErrorCode= result->Consume(aChar,aScanner); //tell new token to finish consuming text...
+ if(result->IsAttributed())
+ ConsumeAttributes(aChar,aScanner,anErrorCode);
+
+ //now that that's over with, we have one more problem to solve.
+ //In the case that we just read a