<div>
<p>bla bla
</p>
<table>
<tr>
<td>
<img src="image.gif">
</td>
<td>
bla bla
</td>
</tr>
</table>
</div>
The Viewer
Architecture
Currently, all parser sources are in the htmlcssparser package. In this package, each html element has is
class (HtmlDIVNode for example). For the rendering, each node must having a rendering method.
HtmlDOMNode >>renderOn: aBuilder
children do:[:aChildNode | aChildNode renderOn: aBuilder].
The rendering process is made with the builder pattern. Each node will be throw to the builder which will construct
the node visual representation.
CSS properties
The visual representation depends of CSS properties. Before being displayed, a node has to "know" all its css properties.
Each node could load its properties with this method (here the simplified one):
HtmlDomNode>>stylePropertiesOn: aDictionary
self styles do:
[:rule | rule properties do:
[:prop |(self isInherited:prop propertyName)
ifTrue:[aDictionary at: prop propertyName ifAbsentPut: [prop].].
^self parent ifNotNil: [self parent stylePropertiesOn: aDictionary ] ifNil: [aDictionary].
Currently, a properties is not always added when absent in the dictionary - Some properties are not inherited.
For example, the float properties is not inherited (a lot of properties are not inherited too).
The Box Model
Each html element(P, DIV..) is insert in a box. This box has paddings, margins, borders... The viewer must have a class (Morph) which implements this model in order to repect the W3C's norm.