Content area
Full text
The Next-Generation Layout Engine
At the heart of every Web browser beats a powerful layout engine. A layout engine "consumes" (reads) a document file, identifies and separates the constituent elements (like graphic images and text), places those elements into geometric space using well-defined stylistic rules, and finally renders the result on the display screen. That all sounds easy enough, but sophisticated layout engines take years of effort to design and build, requiring a highly skilled and experienced engineering team.
Unfortunately, a common complaint about layout systems in general (and browsers in particular) is that they're too big. It's not surprising, given the demands developers and users place upon these systems. The need for a powerful layout engine that could fit easily onto a portable device was a major reason why Netscape began developing its new layout engine-Gecko-back in 1997, under the project code name "NGLayout." Gecko will break with the large-size tradition by offering a surprising degree of layout flexibility in a very small package. In fact, a prototype browser based on Gecko was recently distributed on a single floppy disk. Contrast that with the 15 to 20MB installations of common browsers and you can see why many developers are so excited, and why Gecko will serve as the basis for future Netscape products.
In this article, I'll examine the Gecko engine, explain how it works, and talk about how you might put Gecko to work in your own applications. For more on the philosophy of Gecko, see the box titled "Gecko-Vision" on page 70.
Features and Availability
The Gecko design emphasizes standards, speed, size, and source. We expect that when Gecko ships, it will be the fastest, smallest, most standards-compliant HTML layout engine available. It offers intrinsic support for HTML 4.0, CSS1 and partially for CSS2, Resource Description Framework (RDF), and even a full Document Object Model (DOM) level-1 implementation. Gecko also natively supports both HTML and XML documents. By eliminating the need to transform XML to HTML, Gecko lets you truly exploit the system for XML processing, manipulation, and rendering applications. The Gecko DOM can support both HTML and XML documents equally well, allowing a common API for document manipulation. This will be essential as XML applications such as those for e-commerce...