The NGLayout Document Object Model (DOM) RoadmapAuthors: Vidur Apparao, Tom Pixley
Warning: the contents of this file is out of date. We are in the process of updating the DOM documentation on mozilla.org. The official DOM documentation is now located here.
The NGLayout engine will implement a union of the Communicator 4.0 and and W3C Level 1 Document Object Models. NGLayout's ability to incrementally relayout and redisplay content allow it to correctly handle arbitrary content modification, including element insertion/deletion, attribute value modifications and style changes. The following document describes the current state of implementation as well as an implementation strategy for a complete DOM.
The Current Implementation
The Core InterfacesThe implementation of the DOM released with the current version of the NGLayout source base contains most of the Level 1 Core interfaces. These interfaces are implemented directly by the base NGLayout classes (found in ns/layout). Specifically, the DOM Document interface is implemented by the NGLayout nsDocument class, the DOM Node interface is implemented by the NGLayout nsHTMLContent class and the DOM Element interfaces is implemented by the NGLayout nsHTMLTagContent class. The Level 1 interfaces have been translated into their xpcom equivalents (found in ns/dom/public/coreDom) using the following rules:
- All interfaces inherit from nsISupports.
- Interface names have been translated to include the nsIDOM prefix.
- All method signatures have been changed to return a nsresult result code.
- wstring parameters and return values have been replaced with nsString.
- Return values from the original interfaces now become pointers or references.
- All method names have been changed so that their first character is capitalized.
- Constants in the W3C DOM IDL are converted into static properties of the JSClass (i.e. properties of the class's constructor).
What's LeftThe implementation of the DOM in the released NGLayout source is very preliminary, but should serve as the model for future work. The following items represent the major categories of functionality necessary for completion of the DOM:
- As mentioned above, only the Level 1 Core DOM interfaces have been included and only a portion of the functionality enabled by these interfaces currently works. We intend to complete the implementation of the core interfaces, as well as those detailed in the Level 1 HTML specification. The individual HTML element interfaces will be implemented by the corresponding content model classes created by NGLayout.
- The W3C DOM standard will eventually include a mechanism for modifying the CSS style of a document. This will include ways of adding and removing style rules, modifying existing rules and changing the inline STYLE attribute of individual elements. The DOM style specification will be implemented by the NGLayout style system.
- Some of the functionality required to implement the Window and Navigator classes from the existing Level 0 DOM involves interaction with the application containing NGLayout. For example, the creation of new windows and modification of toolbars fall outside the domain of the core NGLayout engine. Interfaces that represent the functionality necessary to create these classes will be specified and implemented by Communicator.
- While the Level 1 Core DOM interfaces have been implemented by the document and content classes, not all methods have been correctly hooked up. Currently, methods that allow the DOM user to query Document, Node and Element state work, while methods that modify state do not.