gecko overview
Download
Skip this Video
Download Presentation
Gecko Overview

Loading in 2 Seconds...

play fullscreen
1 / 36

Gecko Overview - PowerPoint PPT Presentation


  • 96 Views
  • Uploaded on

Gecko Overview. Chris Waterson <[email protected]> June 10, 2002. Overview. Basic data flow Key data structures Detailed walk-through Incrementalism Future tech-talks Wrap-up, Q&A. Basic Data Flow. Source document arrives via network APIs

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Gecko Overview' - sharla


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
gecko overview

Gecko Overview

Chris Waterson

June 10, 2002

overview
Overview
  • Basic data flow
  • Key data structures
  • Detailed walk-through
  • Incrementalism
  • Future tech-talks
  • Wrap-up, Q&A
basic data flow
Basic Data Flow
  • Source document arrives via network APIs
  • Incrementally “pumped” through the single-threaded layout engine
    • Parse, compute style, render; repeat
    • CSS used for rendering all content
  • Content theoretically separate from “presentation”
basic data flow2
Basic Data Flow

DOM

HTML

Parser

Content Sink

Content Model

basic data flow3
Basic Data Flow

DOM

HTML

Parser

Content Sink

Content Model

Style Sheets

CSS Parser

Style Rules

basic data flow4
Basic Data Flow

DOM

HTML

Parser

Content Sink

Content Model

Frame Constructor

Frame Tree

Style Sheets

CSS Parser

Style Rules

basic data flow5
Basic Data Flow

DOM

HTML

Parser

Content Sink

Content Model

Reflow

Frame Constructor

Frame Tree

Style Sheets

CSS Parser

Style Rules

basic data flow6
Basic Data Flow

DOM

HTML

Parser

Content Sink

Content Model

Reflow

Frame Constructor

Frame Tree

Painting

Display

Style Sheets

CSS Parser

Style Rules

key data structures
Content node

Elements, attributes, leaves

DOM

Frame

Rectangular formatting primitive

Geometric information

[0..n] per content node

2nd thru nth are “continuations”

Style context

Non-geometric information

May be shared by adjacent frames

Reference counted, owned by frame

View

Clipping, z-order, transparency

[0..1] per frame, owned by frame

Widget

Native window

[0..1] per view, owned by view

Key Data Structures

Content Node

1

0..n

Frame

1

0..1

View

1

0..1

Widget

1..n

1

Style Context

key data structures2
Key Data Structures

Content

Frames

key data structures3
Key Data Structures

Content

Frames

Style Contexts

key data structures4
Key Data Structures

Content

Frames

Views

Style Contexts

key data structures5
Key Data Structures

Content

Frames

Views

Widgets

Style Contexts

key data structures6
Key Data Structures
  • The document owns the content model, and one or more presentations
    • Exposed programmatically via DOM APIs
  • The presentation owns the frame hierarchy
    • Frames own the style contexts, views, widgets
    • Presentation has media type, dimensions, etc.
    • May not be directly manipulated
detailed walk through
Detailed Walk-Through
  • Setting up
  • Content model construction
  • Frame construction
  • Style resolution
  • Reflow
  • Painting
setting up
Setting Up
  • Assume basic knowledge of embedding and network APIs (doc shell, streams)
  • Content DLL auto-registers a Document Loader Factory
    • @mozilla.org/content-viewer-factory/view;1?type=text/html
    • All MIME types mapped to the same class, nsContentDLF
  • nsDocShell
    • Receives inbound content via nsDSURIContentListener
    • Invokes nsIDLF::CreateInstance, passes MIME type to DLF
  • nsContentDLF
    • Creates a nsHTMLDocument object, invokes StartDocumentLoad.
      • Creates a parser, returned as nsIStreamListener back to the docshell
      • Creates a content sink, which is linked to the parser and the document
    • Creates a DocumentViewerImpl object, which is returned as nsIContentViewer back to the docshell
  • DocumentViewerImpl creates pres context and pres shell
setting up1
Setting Up

nsIStreamListener

nsParser

nsIContentSink

HTMLContentSink

nsIParser

mDocument

nsDocShell

nsIDocument

mContentViewer

nsHTMLDocument

mParser

DocumentViewerImpl

mDocument

nsIContentViewer

PresContext

PresShell

content model construction
Content Model Construction
  • Content arrives from network via nsIStreamListener::OnDataAvailable
  • Parser tokenizes & processes content; invokes methods on nsIContentSink with parser node objects
    • Some buffering and fixup occurs here
    • OpenContainer, CloseContainer, AddLeaf
  • Content sink creates and attaches content nodes using nsIContent interface
    • Content sink maintains stack of “live” elements
    • More buffering and fixup occurs here
    • InsertChildAt, AppendChildTo, RemoveChildAt
content model construction1
Content Model Construction

nsHTMLDocument

mRootContent

HTMLContentSink

nsGenericHTMLElement

mContextStack

nsIContent

mChildren

frame construction
Frame Construction
  • Content sink uses nsIDocument interface to notify of s in content model
    • ContentAppended, ContentInserted, ContentRemoved
  • PresShell is registered as document observer
    • Receives ContentAppended, etc. notifications
    • Passes these to the style set object, who in turn passes to the frame constructor
  • Frame constructor creates frames
    • ConstructFrameInternal recursively walks content tree, resolves style and creates frames
    • Either created by tag (
ad