path: root/Docs
diff options
authorMichael Drake <>2009-07-27 14:39:33 +0000
committerMichael Drake <>2009-07-27 14:39:33 +0000
commitabd76d327e00fd991488f248e66faa33e0b78c2d (patch)
tree39512da13234a41b14780f5d8b7818b2d1432bba /Docs
parent3f62ae40d44812d08ef531d04c51937e9273b193 (diff)
Delete old CSS document, because it's out-of-date. Should we move the other docs to the wiki?
svn path=/trunk/netsurf/; revision=8823
Diffstat (limited to 'Docs')
1 files changed, 0 insertions, 81 deletions
diff --git a/Docs/03-css b/Docs/03-css
deleted file mode 100644
index 5744e27b7..000000000
--- a/Docs/03-css
+++ /dev/null
@@ -1,81 +0,0 @@
-CSS parser
-CSS is tokenised by a re2c-generated scanner (scanner.l), and then parsed into a
-memory representation by a lemon-generated parser (parser.y, ruleset.c).
-Styles are retrieved using css_get_style(). They can be cascaded by
-Implementing a new CSS property
-In this section I go through adding a CSS property to NetSurf, using the
-'white-space' property as an example. -- James Bursa
-First read and understand the description of the property in the CSS
-specification (I have worked from CSS 2, but now 2.1 is probably better).
-Add the property to css_enums. This file is used to generate css_enum.h and
- css_white_space inherit normal nowrap pre
-(I'm not doing pre-wrap and pre-line for now.)
-Add fields to struct css_style to represent the property:
- css_white_space white_space;
-Add a parser function for the property to ruleset.c. Declare a new function:
- static void parse_white_space(struct css_style * const s, const struct css_node * const v);
-and add it to property_table:
- { "white-space", parse_white_space },
-This will cause the function to be called when the parser comes to a rule giving
-a value for white-space. The function is passed a linked list of struct
-::css_node, each of which corresponds to a token in the CSS source, and must
-update s to correspond to that rule. For white-space, the implementation is
- void parse_white_space(struct css_style * const s, const struct css_node * const v)
- {
- css_white_space z;
- if (v->type != CSS_NODE_IDENT || v->next != 0)
- return;
- z = css_white_space_parse(v->data, v->data_length);
- s->white_space = z;
- }
-First we check that the value consists of exactly one identifier, as described
-in the specification. If it is not, we ignore it, since it may be some future
-CSS. The css_white_space_parse() function is generated in css_enum.c, and
-converts a string giving a value to a constant. If the conversion succeeds, the
-style s is updated.
-Add defaults for the style to css_base_style, css_empty_style, and
-css_blank_style in css.c. The value in css_base_style should be the one given as
-'Initial' in the spec, and the value in css_empty_style should be inherit. If
-'Inherited' is yes in the spec, the value in css_blank_style should be inherit,
-otherwise it should be the one given as 'Initial'. Thus for white-space, which
-has "Initial: normal, Inherited: yes" in the spec, we use CSS_WHITE_SPACE_NORMAL
-in css_base_style and CSS_WHITE_SPACE_INHERIT in the other two.
-Edit css_cascade() and css_merge() in css.c to handle the property. In both
-cases for white-space this looks like:
- if (apply->white_space != CSS_WHITE_SPACE_INHERIT)
- style->white_space = apply->white_space;
-Add the property to css_dump_style() (not essential).
-Now the box, layout and / or redraw code needs to be changed to use the new
-style property. This varies much more depending on the property.
-For white-space, convert_xml_to_box() was changed to split text at newlines if
-white-space was pre, and to replace spaces with hard spaces for nowrap.
-Additionally, calculate_inline_container_widths() was changed to give the
-appropriate minimum width for pre and nowrap.