Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
CNavDTD.h File Reference
#include "nsIDTD.h"
#include "nsISupports.h"
#include "nsIParser.h"
#include "nsHTMLTags.h"
#include "nsVoidArray.h"
#include "nsDeque.h"
#include "nsParserCIID.h"
#include "nsTime.h"
#include "nsDTDUtils.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


class  CNavDTD


 MODULE NOTES: gess 7/15/98.


nsresult NS_NewNavHTMLDTD (nsIDTD **aInstancePtrResult)

Define Documentation

{0x5c5cce40, 0xcfd6,  0x11d1,  \
  {0xaa, 0xda, 0x00,    0x80, 0x5f, 0x8a, 0x3e, 0x14}}

MODULE NOTES: gess 7/15/98.

NavDTD is an implementation of the nsIDTD interface. In particular, this class captures the behaviors of the original Navigator parser productions.

This DTD, like any other in NGLayout, provides a few basic services:

  • First, the DTD collaborates with the Parser class to convert plain text into a sequence of HTMLTokens.
  • Second, the DTD describes containment rules for known elements.
  • Third the DTD controls and coordinates the interaction between the parsing system and content sink. (The content sink is the interface that serves as a proxy for content model).
  • Fourth the DTD maintains an internal style-stack to handle residual (leaky) style tags.

You're most likely working in this class file because you want to add or change a behavior inherent in this DTD. The remainder of this section will describe what you need to do to affect the kind of change you want in this DTD.

RESIDUAL-STYLE HANDLNG: There are a number of ways to represent style in an HTML document. 1) explicit style tags (, etc) 2) implicit styles (like those implicit in <Hn>) 3) CSS based styles

Residual style handling results from explicit style tags that are not closed. Consider this example:

text bold

When the

tag closes, the tag is NOT automatically closed. Unclosed style tags are handled by the process we call residual-style tag handling.

There are two aspects to residual style tag handling. The first is the construction and managing of a stack of residual style tags. The second is the automatic emission of residual style tags onto leaf content in subsequent portions of the document.This step is necessary to propagate the expected style behavior to subsequent portions of the document.

Construction and managing the residual style stack is an inline process that occurs during the model building phase of the parse process. During the model- building phase of the parse process, a content stack is maintained which tracks the open container hierarchy. If a style tag(s) fails to be closed when a normal container is closed, that style tag is placed onto the residual style stack. If that style tag is subsequently closed (in most contexts), it is popped off the residual style stack -- and are of no further concern.

Residual style tag emission occurs when the style stack is not empty, and leaf content occurs. In our earlier example, the tag "leaked" out of the

container. Just before the next leaf is emitted (in this or another container) the style tags that are on the stack are emitted in succession. These same residual style tags get closed automatically when the leaf's container closes, or if a child container is opened.

Definition at line 109 of file CNavDTD.h.

Function Documentation

nsresult NS_NewNavHTMLDTD ( nsIDTD **  aInstancePtrResult) [inline]

Definition at line 404 of file CNavDTD.h.

  return CallCreateInstance(kNavDTDCID, aInstancePtrResult);

Here is the call graph for this function:

Here is the caller graph for this function: