virtual PRBool BackwardPropagate(nsEntryStack& aTagStack,eHTMLTags aParentTag,eHTMLTags aChildTag) const;
virtual PRBool BackwardPropagate(nsString& aSequence,eHTMLTags aParentTag,eHTMLTags aChildTag) const;   nsresult CreateContextStackFor(eHTMLTags aChildTag);
CLASS_EXPORT_HTMLPARS CNavDTD : public nsIDTD {#if defined(XP_PC)#pragma warning( default : 4275 )#endif  public:    /**      *  Common constructor for navdtd. You probably want to call  	  *  NS_NewNavHTMLDTD().	    *       *  @update  gess 7/9/98      */    CNavDTD();    /**     *  Virtual destructor -- you know what to do     *  @update  gess 7/9/98     */    virtual ~CNavDTD();    virtual const nsIID&  GetMostDerivedIID(void) const;    /**     * Call this method if you want the DTD to construct a clone of itself.     * @update	gess7/23/98     * @param      * @return     */    virtual nsresult CreateNewInstance(nsIDTD** aInstancePtrResult);    NS_DECL_ISUPPORTS    /**     * This method is called to determine if the given DTD can parse     * a document of a given source-type.      * Note that parsing assumes that the end result will always be stored 	   * in the main content model. Of course, it's up to you which content-	   * model you pass in to the parser, so you can always control the process.	   *     * @update	gess 7/15/98     * @param	aContentType contains the name of a filetype that you are   	 *			being asked to parse).     * @return  TRUE if this DTD parse the given type; FALSE otherwise.     */    virtual eAutoDetectResult CanParse(nsString& aContentType, nsString& aCommand, nsString& aBuffer, PRInt32 aVersion);    /**     * Called by the parser to initiate dtd verification of the     * internal context stack.     * @update	gess 7/23/98     * @param      * @return     */    virtual PRBool Verify(nsString& aURLRef,nsIParser* aParser);       /**      * The parser uses a code sandwich to wrap the parsing process. Before      * the process begins, WillBuildModel() is called. Afterwards the parser      * calls DidBuildModel().       * @update	gess5/18/98      * @param	aFilename is the name of the file being parsed.      * @return	error code (almost always 0)      */    NS_IMETHOD WillBuildModel(nsString& aFilename,PRBool aNotifySink,nsString& aSourceType,nsIContentSink* aSink=0);    /**      * The parser uses a code sandwich to wrap the parsing process. Before      * the process begins, WillBuildModel() is called. Afterwards the parser      * calls DidBuildModel().       * @update	gess5/18/98      * @param	aFilename is the name of the file being parsed.      * @return	error code (almost always 0)      */    NS_IMETHOD BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITokenObserver* anObserver=0,nsIContentSink* aSink=0);   /**     * The parser uses a code sandwich to wrap the parsing process. Before     * the process begins, WillBuildModel() is called. Afterwards the parser     * calls DidBuildModel().      * @update	gess5/18/98     * @param	anErrorCode contans the last error that occured     * @return	error code     */    NS_IMETHOD DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParser* aParser,nsIContentSink* aSink=0);    /**     *  This method is called by the parser, once for each token	   *	that has been constructed during the tokenization phase.     *  @update  gess 3/25/98     *  @param   aToken -- token object to be put into content model     *  @return  0 if all is well; non-zero is an error     */    NS_IMETHOD HandleToken(CToken* aToken,nsIParser* aParser);    /**     *  This method causes all tokens to be dispatched to the given tag handler.     *     *  @update  gess 3/25/98  	 *  @param   aHandler -- object to receive subsequent tokens...	   *  @return	 error code (usually 0)     */    NS_IMETHOD CaptureTokenPump(nsITagHandler* aHandler);    /**     *  This method releases the token-pump capture obtained in CaptureTokenPump()     *     *  @update  gess 3/25/98  	 *  @param   aHandler -- object that received tokens...	   *  @return	 error code (usually 0)     */    NS_IMETHOD ReleaseTokenPump(nsITagHandler* aHandler);    /**     *      * @update	gess12/28/98     * @param      * @return     */    nsITokenizer* GetTokenizer(void);        /**     *      * @update	gess12/28/98     * @param      * @return     */    virtual  nsITokenRecycler* GetTokenRecycler(void);    /**     * If the parse process gets interrupted, this method gets called	   * prior to the process resuming.     * @update	gess5/18/98     * @return	error code -- usually NS_OK (0)     */    NS_IMETHOD WillResumeParse(void);    /**     * If the parse process is about to be interrupted, this method	   * will be called just prior.     * @update	gess5/18/98     * @return	error code  -- usually NS_OK (0)     */    NS_IMETHOD WillInterruptParse(void);    /**     *  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     */    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 -- int tag of parent container     *  @param   aChild -- int tag of child container     *  @return  PR_TRUE if parent can contain child     */    virtual PRBool CanPropagate(eHTMLTags aParent,eHTMLTags aChild) const;    /**     *  This method gets called to determine whether a given      *  child tag can be omitted by the given parent.     *       *  @update  gess 3/25/98     *  @param   aParent -- parent tag being asked about omitting given child     *  @param   aChild -- child tag being tested for omittability by parent     *  @return  PR_TRUE if given tag can be omitted     */    virtual PRBool CanOmit(eHTMLTags aParent,eHTMLTags 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 aTag) 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  True if closure was achieved -- other false     */    virtual PRBool ForwardPropagate(nsEntryStack& aTagStack,eHTMLTags aParentTag,eHTMLTags aChildTag);    /**     * This method tries to design a context map (without actually     * changing our parser state) from the child up to the parent.     *     * @update  gess4/6/98     * @param   aParent -- tag type of parent     * @param   aChild -- tag type of child     * @return  True if closure was achieved -- other false     */    virtual PRBool BackwardPropagate(nsEntryStack& aTagStack,eHTMLTags aParentTag,eHTMLTags aChildTag) const;    /**     * Ask parser if a given container is open ANYWHERE on stack     * @update	gess5/11/98     * @param   id of container you want to test for     * @return  TRUE if the given container type is open -- otherwise FALSE     */    virtual PRBool HasOpenContainer(eHTMLTags aContainer) const;    /**     * Ask parser if a given container is open ANYWHERE on stack     * @update	gess5/11/98     * @param   id of container you want to test for     * @return  TRUE if the given container type is open -- otherwise FALSE     */    virtual PRBool HasOpenContainer(const eHTMLTags aTagSet[],PRInt32 aCount) const;    /**     * Accessor that retrieves the tag type of the topmost item on context 	   * vector stack.	   *     * @update	gess5/11/98     * @return  tag type (may be unknown)     */    virtual eHTMLTags GetTopNode() const;    /**     * Finds the topmost occurance of given tag within context vector stack.     * @update	gess5/11/98     * @param   tag to be found     * @return  index of topmost tag occurance -- may be -1 (kNotFound).     */    virtual PRInt32 GetTopmostIndexOf(eHTMLTags aTag) const;    /**     * Finds the topmost occurance of given tag within context vector stack.     * @update	gess5/11/98     * @param   tag to be found     * @return  index of topmost tag occurance -- may be -1 (kNotFound).     */    virtual PRInt32 GetTopmostIndexOf(eHTMLTags aTagSet[],PRInt32 aCount) const;    /**     * 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     */    virtual nsresult  Terminate(void) { return mDTDState=NS_ERROR_HTMLPARSER_STOPPARSING; }    /**     * Give rest of world access to our tag enums, so that CanContain(), etc,     * become useful.     */    NS_IMETHOD StringTagToIntTag(nsString &aTag, PRInt32* aIntTag) const;    /**      * The following methods are use to create and manage     * the dynamic set of token handlers.     * @update	gess5/11/98     */    void            InitializeDefaultTokenHandlers();    CITokenHandler* GetTokenHandler(eHTMLTokenTypes aType) const;    CITokenHandler* AddTokenHandler(CITokenHandler* aHandler);    void            DeleteTokenHandlers(void);    /**     * The following set of methods are used to partially construct      * the content model (via the sink) according to the type of token.     * @update	gess5/11/98     * @param   aToken is the token (of a given type) to be handled     * @return  error code representing construction state; usually 0.     */    nsresult    HandleStartToken(CToken* aToken);    nsresult    HandleDefaultStartToken(CToken* aToken,eHTMLTags aChildTag,nsIParserNode& aNode);    nsresult    HandleEndToken(CToken* aToken);    nsresult    HandleEntityToken(CToken* aToken);    nsresult    HandleCommentToken(CToken* aToken);    nsresult    HandleAttributeToken(CToken* aToken);    nsresult    HandleScriptToken(nsCParserNode& aNode);    nsresult    HandleStyleToken(CToken* aToken);    nsresult    HandleProcessingInstructionToken(CToken* aToken);    nsresult    HandleDocTypeDeclToken(CToken* aToken);    //*************************************************    //these cover methods mimic the sink, and are used    //by the parser to manage its context-stack.    //*************************************************    /**     * The next set of method open given HTML elements of	   * various types.     *      * @update	gess5/11/98     * @param   node to be opened in content sink.     * @return  error code representing error condition-- usually 0.     */    nsresult OpenHTML(const nsIParserNode& aNode);    nsresult OpenHead(const nsIParserNode& aNode);    nsresult OpenBody(const nsIParserNode& aNode);    nsresult OpenForm(const nsIParserNode& aNode);    nsresult OpenMap(const nsIParserNode& aNode);    nsresult OpenFrameset(const nsIParserNode& aNode);    nsresult OpenContainer(const nsIParserNode& aNode,PRBool aClosedByStartTag);    /**     * The next set of methods close the given HTML element.     *      * @update	gess5/11/98     * @param   HTML (node) to be opened in content sink.     * @return  error code - 0 if all went well.     */    nsresult CloseHTML(const nsIParserNode& aNode);    nsresult CloseHead(const nsIParserNode& aNode);    nsresult CloseBody(const nsIParserNode& aNode);    nsresult CloseForm(const nsIParserNode& aNode);    nsresult CloseMap(const nsIParserNode& aNode);    nsresult CloseFrameset(const nsIParserNode& aNode);    nsresult CloseContainer(const nsIParserNode& aNode,eHTMLTags anActualTag,PRBool aClosedByStartTag);        /**     * The special purpose methods automatically close     * one or more open containers.     * @update	gess5/11/98     * @return  error code - 0 if all went well.     */    nsresult CloseTopmostContainer();    nsresult CloseContainersTo(eHTMLTags aTag,PRBool aClosedByStartTag);    nsresult CloseContainersTo(PRInt32 anIndex,eHTMLTags aTag,PRBool aClosedByStartTag);    /**     * Causes leaf to be added to sink at current vector pos.     * @update	gess5/11/98     * @param   aNode is leaf node to be added.     * @return  error code - 0 if all went well.     */    nsresult AddLeaf(const nsIParserNode& aNode);    nsresult AddHeadLeaf(nsIParserNode& aNode);    /**     * Causes auto-closures of context vector stack in order to find a      * proper home for the given child. Propagation may also occur as      * a fall out.     * @update	gess5/11/98     * @param   child to be added (somewhere) to context vector stack.     * @return  error code - 0 if all went well.     */    nsresult ReduceContextStackFor(eHTMLTags aChildTag);    /**     * Attempt forward and/or backward propagation for the given     * child within the current context vector stack.     * @update	gess5/11/98     * @param   type of child to be propagated.     * @return  TRUE if succeeds, otherwise FALSE     */    nsresult CreateContextStackFor(eHTMLTags aChildTag);    /**     * This set of methods is used to create and manage the set of	   * transient styles that occur as a result of poorly formed HTML   	 * or bugs in the original navigator.	   *     * @update	gess5/11/98     * @param   aTag -- represents the transient style tag to be handled.     * @return  error code -- usually 0     */    nsresult  OpenTransientStyles(eHTMLTags aChildTag);    nsresult  CloseTransientStyles(eHTMLTags aChildTag);    nsresult  UpdateStyleStackForOpenTag(eHTMLTags aTag,eHTMLTags aActualTag);    nsresult  UpdateStyleStackForCloseTag(eHTMLTags aTag,eHTMLTags aActualTag);    nsresult  DoFragment(PRBool aFlag);protected:		nsresult        CollectAttributes(nsCParserNode& aNode,eHTMLTags aTag,PRInt32 aCount);		nsresult        CollectSkippedContent(nsCParserNode& aNode,PRInt32& aCount);    nsresult        WillHandleStartTag(CToken* aToken,eHTMLTags aChildTag,nsCParserNode& aNode);    nsresult        DidHandleStartTag(nsCParserNode& aNode,eHTMLTags aChildTag);    nsresult        HandleOmittedTag(CToken* aToken,eHTMLTags aChildTag,eHTMLTags aParent,nsIParserNode& aNode);    nsresult        HandleSavedTokensAbove(eHTMLTags aTag);    nsCParserNode*  CreateNode(void);    void            RecycleNode(nsCParserNode* aNode);    nsIHTMLContentSink* mSink;    CITokenHandler*     mTokenHandlers[eToken_last];    nsDTDContext*       mHeadContext;    nsDTDContext*       mBodyContext;    nsDTDContext*       mFormContext;    nsDTDContext*       mMapContext;    PRBool              mHasOpenForm;    PRBool              mHasOpenMap;    PRInt32             mHasOpenHead;    PRBool              mHasOpenBody;    PRBool              mHadFrameset;    PRBool              mHadBody;    nsString            mFilename;    nsIDTDDebug*		    mDTDDebug;    PRInt32             mLineNumber;    nsParser*           mParser;    nsITokenizer*       mTokenizer;    nsDeque             mMisplacedContent;    nsDeque             mSkippedContent;    PRBool              mHasOpenScript;    PRBool              mSaveBadTokens;    eHTMLTags           mSkipTarget;    nsDeque             mSharedNodes;    nsresult            mDTDState;    PRUint32            mComputedCRC32;    PRUint32            mExpectedCRC32;};