You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

introduction.html 8.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <html>
  3. <head>
  4. <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  5. <title>Implementing Properties</title>
  6. <style type= "text/css" >
  7. body {
  8. font-family: Verdana, Helvetica, sans-serif;
  9. }
  10. .note { border: solid 1px #7099C5; background-color: #f0f0ff; }
  11. .note .label { background-color: #7099C5; color: #ffffff; }
  12. .content {
  13. padding: 5px 5px 5px 10px;
  14. font : Verdana, Helvetica, sans-serif; font-size : 90%;
  15. }
  16. </style>
  17. </head>
  18. <body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" text="#000000" bgcolor="#FFFFFF">
  19. <div class="content">
  20. <h1>Implementing Properties</h1>
  21. <p>
  22. <font size="-2">by&nbsp;Peter B. West</font>
  23. </p>
  24. <ul class="minitoc">
  25. <li>
  26. <a href="#N10014">An alternative properties implementation</a>
  27. <ul class="minitoc">
  28. <li>
  29. <a href="#N10043">The history problem</a>
  30. </li>
  31. <li>
  32. <a href="#N10061">The construction hierarchy</a>
  33. </li>
  34. <li>
  35. <a href="#N10082">Representing properties: &lt;property&gt; classes</a>
  36. </li>
  37. </ul>
  38. </li>
  39. </ul>
  40. <a name="N10014"></a>
  41. <h3>An alternative properties implementation</h3>
  42. <div class="frame note">
  43. <div class="label">Note</div>
  44. <div class="content">
  45. The following discussion focusses on the relationship between
  46. Flow Objects in the Flow Object tree, and properties. There
  47. is no (or only passing) discussion of the relationship between
  48. properties and traits, and by extension, between properties
  49. and the Area tree.
  50. </div>
  51. </div>
  52. <p>
  53. Property handling is complex and expensive. Varying numbers of
  54. properties <strong>apply</strong> to individual Flow Objects
  55. <strong>(FOs)</strong> in the <strong>FO tree </strong> but
  56. any property may effectively be assigned a value on any
  57. element of the tree. If that property is inheritable, its
  58. defined value will then be available to any children of the
  59. defining FO.
  60. </p>
  61. <div class="frame note">
  62. <div class="label">Note</div>
  63. <div class="content">
  64. <em>(XSL 1.0 Rec)</em> <strong>5.1.4 Inheritance</strong>
  65. ...The inheritable properties can be placed on any formatting
  66. object.
  67. </div>
  68. </div>
  69. <p>
  70. Even if the value is not inheritable, it may be accessed by
  71. its children through the <span class="codefrag">inherit</span>
  72. keyword or the <span class="codefrag">from-parent()</span>
  73. core function, and potentially by any of its descendents
  74. through the <span
  75. class="codefrag">from-nearest-specified-value()</span> core
  76. function.
  77. </p>
  78. <p>
  79. In addition to the assigned values of properties, almost every
  80. property has an <strong>initial value</strong> which is used
  81. when no value has been assigned.
  82. </p>
  83. <a name="N10043"></a>
  84. <h4>The history problem</h4>
  85. <p>
  86. The difficulty and expense of handling properties comes from
  87. this univeral inheritance possibility. The list of properties
  88. which are assigned values on any particular <em>FO</em>
  89. element will not generally be large, but a current value is
  90. required for each property which applies to the <em>FO</em>
  91. being processed.
  92. </p>
  93. <p>
  94. The environment from which these values may be selected
  95. includes, for each <em>FO</em>, <strong>for each applicable
  96. property</strong>, the value assigned on this <em>FO</em>,
  97. the value which applied to the parent of this <em>FO</em>,
  98. the nearest value specified on an ancestor of this element,
  99. and the initial value of the property.
  100. </p>
  101. <a name="N10061"></a>
  102. <h4>The construction hierarchy</h4>
  103. <p>
  104. Properties are resoved in the <strong>FO tree</strong> in a
  105. strictly hierarchical manner. Nodes are detected in the
  106. input in a <strong>pre-order</strong> traversal, and are
  107. built in the same order. This imples that there are two
  108. phases, or states, of property resolution and construction.
  109. Any particular FO node is either in a state of constructing
  110. its own subtree, or in a stable state where the subtree
  111. construction is complete. These states have differenct data
  112. requirements.
  113. </p>
  114. <dl>
  115. <dt>Subtree building</dt>
  116. <dd>
  117. In this state, all properties defined on this node, or any
  118. of its ancestors must be available to the subtree. In
  119. effect, any property defined on this node must be
  120. available to its descendants, as all properties defined on
  121. any ancestor are available to this node.
  122. </dd>
  123. <dt>Stable: subtree building complete</dt>
  124. <dd>
  125. In this state, only the properties <strong>applicable to
  126. this node</strong> need be available.
  127. </dd>
  128. </dl>
  129. <a name="N10082"></a>
  130. <h4>Representing properties: &lt;property&gt; classes</h4>
  131. <a name="N10087"></a>
  132. <h4>Class vs instance</h4>
  133. <p>
  134. What information is required of property objects?
  135. More particularly, what information is particular to the
  136. property classes, and what to the instantiated
  137. objects? The answer to this question depend largely on
  138. how the property objects are used in the context
  139. of layout and Area tree construction. The approach taken
  140. in this implementation is that properties are simply flags
  141. on certain data values associated with FOs. The semantics
  142. of these flags are determined within the layout engine.
  143. </p>
  144. <p>
  145. Certain constant information attaches to individual
  146. property classes. This information is detailed in
  147. the descriptions of individual properties in <em>Section
  148. 7</em> of the specification. Such information is
  149. represented in <strong>class</strong> fields and data
  150. structures within the classes.
  151. </p>
  152. <p>
  153. The "instance" information content of a property
  154. is:
  155. </p>
  156. <ul>
  157. <li>
  158. explicitly, the <span class="codefrag">PropertyValue</span> datum of
  159. the property, and
  160. </li>
  161. <li>
  162. implicitly, the <strong>Flow Object</strong> to which
  163. the property is attached.
  164. </li>
  165. </ul>
  166. <p>
  167. Properties, then, serve essentially to link <em>FO
  168. instances</em> with <em>PropertyValue instances</em>,
  169. attaching certain invariant semantic markers to the
  170. PropertyValues in the process. In this implementation,
  171. these functions can be realised entirely within the
  172. property <strong>classes</strong> themselves,
  173. without the need to instantiate any objects. In practice,
  174. <strong>property singletons</strong> are
  175. instantiated to make access to some invariants simpler.
  176. </p>
  177. <p>
  178. <strong>Next:</strong> <a href= "classes-overview.html"
  179. >Property classes overview.</a>
  180. </p>
  181. </div>
  182. <table summary="footer" cellspacing="0" cellpadding="0" width="100%" height="20" border="0">
  183. <tr>
  184. <td colspan="2" height="1" bgcolor="#4C6C8F"><img height="1"
  185. width="1" alt="" src="../../../skin/images/spacer.gif"><a
  186. href="../../../skin/images/label.gif"></a><a
  187. href="../../../skin/images/page.gif"></a><a
  188. href="../../../skin/images/chapter.gif"></a><a
  189. href="../../../skin/images/chapter_open.gif"></a><a
  190. href="../../../skin/images/current.gif"></a><a
  191. href="../../..//favicon.ico"></a></td>
  192. </tr>
  193. <tr>
  194. <td colspan="2" bgcolor="#CFDCED" class="copyright"
  195. align="center"><font size="2" face="Arial, Helvetica,
  196. Sans-Serif">Copyright &copy; 1999-2002&nbsp;The Apache
  197. Software Foundation. All rights reserved.<script
  198. type="text/javascript" language="JavaScript"><!--
  199. document.write(" - "+"Last Published: " +
  200. document.lastModified); // --></script></font></td>
  201. </tr>
  202. <tr>
  203. <td align="left" bgcolor="#CFDCED" class="logos"></td><td
  204. align="right" bgcolor="#CFDCED" class="logos"></td>
  205. </tr>
  206. </table>
  207. </body>
  208. </html>