|
| 1 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | +<html lang="en"> |
| 3 | +<!-- $Id: process.src,v 1.1 1997-10-29 04:28:19 ian Exp $ --> |
| 4 | +<HEAD> |
| 5 | +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| 6 | +<TITLE>CSS2 processing model</TITLE> |
| 7 | +<LINK rel="next" href="syndata.html"> |
| 8 | +<LINK rel="previous" href="convent.html"> |
| 9 | +<LINK rel="STYLESHEET" href="style/default.css" type="text/css"> |
| 10 | +</HEAD> |
| 11 | +<BODY> |
| 12 | +<H1 align="center">CSS2 processing model</H1> |
| 13 | +<H2>Introduction to the CSS2 processing model</H2> |
| 14 | +In this section we present a model that describes how |
| 15 | +user agents may implement style sheets. The model consists |
| 16 | +of the following steps: |
| 17 | + |
| 18 | +<ol> |
| 19 | +<li>Create a <a href="#doctree">document tree</a>. |
| 20 | + |
| 21 | +<li>From the document tree, generate a tree of <a |
| 22 | +href="#rendobj">rendering objects</a> based on the |
| 23 | +destination medium, style rules, and formatting algorithms. |
| 24 | + |
| 25 | +<li>Transfer the tree of <a href="#rendobj">rendering objects</a> to |
| 26 | +the destination <a href="media.html">medium</a> (e.g., print the |
| 27 | +results, display them on the screen, render text as speech, etc.). |
| 28 | +</ol> |
| 29 | + |
| 30 | +<P>Step one lies outside the scope of this specification (see, for |
| 31 | +example, <a rel="biblioentry" href="./refs.src#ref-DOM">[DOM]</a>). |
| 32 | + |
| 33 | +<P>Step two is addressed by the bulk of this specification: |
| 34 | + |
| 35 | +<ul> |
| 36 | +<li>For what <a href="media.html">media</a> can style sheets present |
| 37 | +documents? |
| 38 | +<li>How do competing style rules interact? |
| 39 | +<li>What formatting algorithms apply for a given medium? |
| 40 | +</ul> |
| 41 | + |
| 42 | +<P>Step three is addressed in part by this specification: |
| 43 | + |
| 44 | +<ul> |
| 45 | +<li>What can user agents do when certain system resources are |
| 46 | +not available (e.g., fonts)? |
| 47 | +<li>How do style sheets interact |
| 48 | +with system resources (cursors, colors, fonts)? |
| 49 | +<li>How do style sheet properties assist certain devices |
| 50 | +(e.g., page orientation for a printer)? |
| 51 | +</ul> |
| 52 | + |
| 53 | +<P>Please note that most transfer issues lie outside the scope of this |
| 54 | +specification. |
| 55 | + |
| 56 | +<H2><a name="doctree">The document tree</a></H2> |
| 57 | + |
| 58 | +<P>User agents transform a document written in the document language |
| 59 | +into a <dfn>document tree</dfn> where every element except one has |
| 60 | +exactly one <span class="index-def" title="parent">parent</span> |
| 61 | +element. (See the SGML (<a href="refs.html#ref-ISO8879">[ISO8879]</a>) |
| 62 | +and XML (<a href="refs.html#ref-XML">[XML]</a>) specifications for the |
| 63 | +definition of parent.) The one exception is the <span |
| 64 | +class="index-def" title="root">root</span> element, which has no |
| 65 | +parent. An element A is called a <span class="index-def" |
| 66 | +title="child">child</span> of an element B, if and only if B is the |
| 67 | +parent of A. |
| 68 | + |
| 69 | +<P>An element A is called a <span class="index-def" |
| 70 | +title="ancestor">ancestor</span> of an element B, if either (1) A is |
| 71 | +the parent B, or (2) A is the parent of some element C that is an |
| 72 | +ancestor of B. |
| 73 | + |
| 74 | +<P>An element A is called a <span class="index-def" |
| 75 | +title="descendant">descendant</span> of an element B, if and only if B |
| 76 | +is an ancestor of A. |
| 77 | + |
| 78 | +<div class="example"><P> |
| 79 | +For example, the following HTML document: |
| 80 | +<PRE> |
| 81 | + <HTML> |
| 82 | + <TITLE>My home page</TITLE> |
| 83 | + <BODY> |
| 84 | + <H1>My home page</H1> |
| 85 | + <P>Welcome to my home page! Let me tell you about my favorite |
| 86 | + composers: |
| 87 | + <UL> |
| 88 | + <LI> Elvis Costello |
| 89 | + <LI> Johannes Brahms |
| 90 | + <LI> Georges Brassens |
| 91 | + </UL> |
| 92 | + </BODY> |
| 93 | + </HTML> |
| 94 | +</PRE> |
| 95 | + |
| 96 | +<P>results in the following tree:</P> |
| 97 | + |
| 98 | +<IMG src="images/doctree.gif" alt="Sample document tree"> |
| 99 | + |
| 100 | +<P>Notice that although the source program does not explicitly refer |
| 101 | +to the HEAD element, it is inferred during parsing and becomes part of |
| 102 | +the document tree. |
| 103 | +</div> |
| 104 | + |
| 105 | +<H2><a name="renderobj">Rendering objects</a></H2> |
| 106 | + |
| 107 | +<P>Once a user agent has a document tree, it generates a tree of |
| 108 | +rendering objects. A <dfn>rendering object</dfn> is defined by a set |
| 109 | +of CSS properties and a formatting algorithm. The properties and |
| 110 | +algorithsm generally relate to the intended target medium. Thus, a |
| 111 | +rendering object destined to be printed requires certain CSS |
| 112 | +properties (e.g., related to margins, widths, heights, colors, |
| 113 | +positioning, etc.) while a rendering object destined for a speech |
| 114 | +synthesizer requires others (e.g., volume, pitch, voice family, etc.). |
| 115 | + |
| 116 | +<ul> |
| 117 | +<li><em>The destination <a href="media.html">medium</a>.</em> For instance, |
| 118 | +if the document is to be read aloud, the rendering tree will be much |
| 119 | +different than if the document is to be laid out on paper. |
| 120 | +<li><em>Style rules</em>. CSS2 style rules |
| 121 | +</ul> |
| 122 | + |
| 123 | +<!-- |
| 124 | +<ol> |
| 125 | +<li>Style sheets are <a href="cascade.html">cascaded</a> and <a |
| 126 | +href="#inheritance">inheritance</a> rules applied so that for each node in |
| 127 | +the document tree, each property has a single value. |
| 128 | +property. |
| 129 | + |
| 130 | +<li>The user agent generates zero or more <dfn>rendering objects</dfn> |
| 131 | +for each node in the document tree and creates a tree of these |
| 132 | +rendering objects. The type of the rendering object depends on the |
| 133 | +destination <a href="media.html">media type</a>. For screens, for |
| 134 | +example, a rendering object would be a box placed according to the |
| 135 | +<a href="flowobj.html">visual rendering model</a>. For paper output, a |
| 136 | +rendering object would be a box placed according to the <a |
| 137 | +href="page.html">page model</a>. For speech synthesizers, a |
| 138 | +rendering object would be speakable data with associated aural |
| 139 | +properties (see the section on <a href="aural.html">aural style |
| 140 | +sheets</a>). |
| 141 | + |
| 142 | +<li>These rendering objects are transferred to the destination medium. |
| 143 | +For example, abstract pages are printed to sheets of paper, |
| 144 | +audio rendering objects are transferred to a speech synthesizer, etc. |
| 145 | +The details of any transfer lie outside the scope of this |
| 146 | +specification. |
| 147 | +</ol> |
| 148 | +--> |
| 149 | + |
| 150 | +</BODY> |
| 151 | +</html> |
| 152 | +<!-- Keep this comment at the end of the file |
| 153 | +Local variables: |
| 154 | +mode: sgml |
| 155 | +sgml-declaration:"~/SGML/HTML4.decl" |
| 156 | +sgml-default-doctype-name:"html" |
| 157 | +sgml-minimize-attributes:t |
| 158 | +sgml-nofill-elements:("pre" "style" "br") |
| 159 | +sgml-live-element-indicator:t |
| 160 | +End: |
| 161 | +--> |
| 162 | + |
0 commit comments