MWContext Function Dispatch

The MWContext function dispatch mechanism enables PostScript printing and text translation.


History

The MWContext function dispatch mechanism was added in Navigator 1.0. Unfortunately, The concept of per-context functions has not been implemented in the entire browser, but a good start has been made. PostScript printing and text translation are both implemented.


How It Works

The idea is to use the HTML layout engine to convert HTML to other formats. The functions involved in laying out and displaying HTML elements are placed in a function table, and translation routines are plugged in. The translation routines generate a translated data stream, rather than displaying the elements.

Because of time constraints, context-specific functions were defined with the #define macro. This minimized the impact on the other developers: existing calls to FE_FOO(cx, .... ) were not required to be rewritten as cx->foo_func( ... ).  At this point, this shortcut is no longer advantageous.

More information about the MWContext structure is contained in the Windows front end description.


Where It's Headed

The fact that the context-function table is hidden has had a negative impact on the stability and maintainability of the browser.  The concept of a "context type" was introduced, and there are "if (context-type is MUMBLE)" at many points in the code. Instead, these should be implemented by extending the context function table and writing type-specific functions.
 
Copyright © 1998 Netscape Communications Corporation