path: root/Docs/02-layout
diff options
authorJames Bursa <>2006-10-02 21:58:33 +0000
committerJames Bursa <>2006-10-02 21:58:33 +0000
commitc88b268f846e5501e19b5d75b0e8ac9b11858857 (patch)
treee09f15adccc34647b590638c1416c1df4ca027ca /Docs/02-layout
parent118f435133cb5aa3a81fa84e29f69e563e2a0e35 (diff)
Split documentation into files by topic and convert to AsciiDoc format.
svn path=/trunk/netsurf/; revision=2975
Diffstat (limited to 'Docs/02-layout')
1 files changed, 31 insertions, 0 deletions
diff --git a/Docs/02-layout b/Docs/02-layout
new file mode 100644
index 000000000..ddc7cfd06
--- /dev/null
+++ b/Docs/02-layout
@@ -0,0 +1,31 @@
+HTML processing and layout
+The modules in the layout directory process and layout HTML pages.
+This is the process to render an HTML document:
+First the HTML is parsed to a tree of xmlNodes using the HTML parser in libxml.
+This happens simultaneously with the fetch [html_process_data()].
+Any stylesheets which the document depends on are fetched and parsed.
+The tree is converted to a 'box tree' by xml_to_box(). The box tree contains a
+node for each block, inline element, table, etc. The aim of this stage is to
+determine the 'display' or 'float' CSS property of each element, and create the
+corresponding node in the box tree. At this stage the style for each element is
+also calculated (from CSS rules and element attributes). The tree is normalised
+so that each node only has children of permitted types (eg. TABLE_CELLs must be
+within TABLE_ROWs) by adding missing boxes.
+The box tree is passed to the layout engine [layout_document()], which finds the
+space required by each element and assigns coordinates to the boxes, based on
+the style of each element and the available width. This includes formatting
+inline elements into lines, laying out tables, and positioning floats. The
+layout engine can be invoked again on a already laid out box tree to reformat it
+to a new width. Coordinates in the box tree are relative to the position of the
+parent node.
+The box tree can then be rendered using each node's coordinates.