diff --git a/src/document/css/apply.c b/src/document/css/apply.c index 7e3045b62..69b289199 100644 --- a/src/document/css/apply.c +++ b/src/document/css/apply.c @@ -1,4 +1,10 @@ -/* CSS style applier */ +/** CSS style applier + * @file + * + * @todo TODO: A way to disable CSS completely, PLUS a way to stop + * various property groups from taking effect. (Ie. way to turn out + * effect of 'display: none' or aligning or colors but keeping all the + * others.) --pasky */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -28,11 +34,6 @@ #include "document/html/internal.h" -/* TODO: A way to disable CSS completely, PLUS a way to stop various property - * groups from taking effect. (Ie. way to turn out effect of 'display: none' - * or aligning or colors but keeping all the others.) --pasky */ - - typedef void (*css_applier_T)(struct html_context *html_context, struct html_element *element, struct css_property *prop); @@ -89,8 +90,9 @@ css_apply_font_attribute(struct html_context *html_context, element->attr.style.attr &= ~prop->value.font_attribute.rem; } -/* FIXME: Because the current CSS doesn't provide reasonable defaults for each - * HTML element this applier will cause bad rendering of
 tags. */
+/** @bug FIXME: Because the current CSS doesn't provide reasonable
+ * defaults for each HTML element this applier will cause bad
+ * rendering of @
 tags. */
 static void
 css_apply_text_align(struct html_context *html_context,
 		     struct html_element *element, struct css_property *prop)
@@ -99,7 +101,7 @@ css_apply_text_align(struct html_context *html_context,
 	element->parattr.align = prop->value.text_align;
 }
 
-/* XXX: Sort like the css_property_type */
+/*! XXX: Sort like the css_property_type */
 static css_applier_T css_appliers[CSS_PT_LAST] = {
 	/* CSS_PT_NONE */		NULL,
 	/* CSS_PT_BACKGROUND */		css_apply_background_color,
@@ -113,7 +115,7 @@ static css_applier_T css_appliers[CSS_PT_LAST] = {
 	/* CSS_PT_WHITE_SPACE */	css_apply_font_attribute,
 };
 
-/* This looks for a match in list of selectors. */
+/** This looks for a match in list of selectors. */
 static void
 examine_element(struct html_context *html_context, struct css_selector *base,
 		enum css_selector_type seltype, enum css_selector_relation rel,
diff --git a/src/document/css/apply.h b/src/document/css/apply.h
index 33bccb45a..c5e2fa7f1 100644
--- a/src/document/css/apply.h
+++ b/src/document/css/apply.h
@@ -1,3 +1,6 @@
+/*! @file
+ * This is the main entry point for the CSS micro-engine. It throws
+ * all the power of the stylesheets at a given element. */
 
 #ifndef EL__DOCUMENT_CSS_APPLY_H
 #define EL__DOCUMENT_CSS_APPLY_H
@@ -8,11 +11,8 @@ struct css_stylesheet;
 struct html_context;
 struct html_element;
 
-/* This is the main entry point for the CSS micro-engine. It throws all the
- * power of the stylesheets at a given element. */
-
-/* Gather all style information for the given @element, so it can later be
- * applied. Returned value should be freed using done_css_selector(). */
+/** Gather all style information for the given @a element, so it can later be
+ * applied. Returned value should be freed using done_css_selector().  */
 struct css_selector *
 get_css_selector_for_element(struct html_context *html_context,
 			     struct html_element *element,
@@ -20,13 +20,13 @@ get_css_selector_for_element(struct html_context *html_context,
 			     LIST_OF(struct html_element) *html_stack);
 
 
-/* Apply properties from an existing selector. */
+/** Apply properties from an existing selector. */
 void
 apply_css_selector_style(struct html_context *html_context,
 			 struct html_element *element,
 			 struct css_selector *selector);
 
-/* This function takes @element and applies its 'style' attribute onto its
+/** This function takes @a element and applies its 'style' attribute onto its
  * attributes (if it contains such an attribute). */
 void
 css_apply(struct html_context *html_context, struct html_element *element,
diff --git a/src/document/css/css.c b/src/document/css/css.c
index cf6cf084e..bbf803828 100644
--- a/src/document/css/css.c
+++ b/src/document/css/css.c
@@ -1,4 +1,5 @@
-/* CSS module management */
+/** CSS module management
+ * @file */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -124,7 +125,8 @@ static int
 change_hook_css(struct session *ses, struct option *current, struct option *changed)
 {
 	if (!strcmp(changed->name, "stylesheet")) {
-		/* TODO: We need to update all entries in format cache. --jonas */
+		/** @todo TODO: We need to update all entries in
+		 * format cache. --jonas */
 		import_default_css();
 	}
 
diff --git a/src/document/css/css.h b/src/document/css/css.h
index 5bd1e1931..458300eff 100644
--- a/src/document/css/css.h
+++ b/src/document/css/css.h
@@ -6,20 +6,21 @@ struct css_stylesheet;
 struct module;
 struct uri;
 
-/* TODO: Basicly we need two default stylesheets. One that ELinks controls
- * (which is defined by the defaults of every property, they could however also
- * be loadable at startup time, e.g. when/if we will have a very generalised
- * renderer it would be possible to bypass the HTML renderer but would simply
- * use a HTML stylesheet like the one in CSS2 Appendix A. "A sample style sheet
- * for HTML 4.0") and one that the user controls. They should be remerged when
- * ever the user reloads the user stylesheet but else they should be pretty
- * static. Together they defines the basic layouting should be done when
- * rendering the document. */
+/** @todo TODO: Basicly we need two default stylesheets. One that
+ * ELinks controls (which is defined by the defaults of every
+ * property, they could however also be loadable at startup time,
+ * e.g. when/if we will have a very generalised renderer it would be
+ * possible to bypass the HTML renderer but would simply use a HTML
+ * stylesheet like the one in CSS2 Appendix A. "A sample style sheet
+ * for HTML 4.0") and one that the user controls. They should be
+ * remerged when ever the user reloads the user stylesheet but else
+ * they should be pretty static. Together they defines the basic
+ * layouting should be done when rendering the document. */
 extern struct css_stylesheet default_stylesheet;
 
 extern struct module css_module;
 
-/* This function will try to import the given @url from the cache. */
+/** This function will try to import the given @a url from the cache. */
 void import_css(struct css_stylesheet *css, struct uri *uri);
 
 #endif
diff --git a/src/document/css/parser.c b/src/document/css/parser.c
index 78838371f..cef2e8b64 100644
--- a/src/document/css/parser.c
+++ b/src/document/css/parser.c
@@ -1,4 +1,5 @@
-/* CSS main parser */
+/** CSS main parser
+ * @file */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -109,8 +110,11 @@ skip_css_block(struct scanner *scanner)
 	}
 }
 
-/* Atrules grammer:
+/** Parse an atrule from @a scanner and update @a css accordingly.
  *
+ * Atrules grammar:
+ *
+ * @verbatim
  * media_types:
  *	  
  *	| 
@@ -123,6 +127,7 @@ skip_css_block(struct scanner *scanner)
  *	| '@media' media_types '{' ruleset* '}'
  *	| '@page' ? [':' ]? '{' properties '}'
  *	| '@font-face' '{' properties '}'
+ * @endverbatim
  */
 static void
 css_parse_atrule(struct css_stylesheet *css, struct scanner *scanner,
@@ -223,12 +228,18 @@ reparent_selector(LIST_OF(struct css_selector) *sels,
 	return twin ? twin : selector;
 }
 
-/* Our selector grammar:
+/** Parse a comma-separated list of CSS selectors from @a scanner.
+ * Register the selectors in @a css so that get_css_selector_for_element()
+ * will find them, and add them to @a selectors so that the caller can
+ * attach properties to them.
  *
+ * Our selector grammar:
+ *
+ * @verbatim
  * selector:
  *	  element_name? ('#' id)? ('.' class)? (':' pseudo_class)? \
  *		  ((' ' | '>') selector)?
- *
+ * @endverbatim
  */
 static void
 css_parse_selector(struct css_stylesheet *css, struct scanner *scanner,
@@ -464,10 +475,14 @@ css_parse_selector(struct css_stylesheet *css, struct scanner *scanner,
 }
 
 
-/* Ruleset grammar:
+/** Parse a ruleset from @a scanner to @a css.
  *
+ * Ruleset grammar:
+ *
+ * @verbatim
  * ruleset:
  *	  selector [ ',' selector ]* '{' properties '}'
+ * @endverbatim
  */
 static void
 css_parse_ruleset(struct css_stylesheet *css, struct scanner *scanner)
diff --git a/src/document/css/parser.h b/src/document/css/parser.h
index be39afbab..645d0525e 100644
--- a/src/document/css/parser.h
+++ b/src/document/css/parser.h
@@ -1,3 +1,6 @@
+/*! @file
+ * This is interface for the value parser. It is intended to be used
+ * only internally inside of the CSS engine. */
 
 #ifndef EL__DOCUMENT_CSS_PARSER_H
 #define EL__DOCUMENT_CSS_PARSER_H
@@ -7,20 +10,17 @@ struct scanner;
 struct css_stylesheet;
 struct uri;
 
-/* This is interface for the value parser. It is intended to be used only
- * internally inside of the CSS engine. */
-
-/* This function takes a semicolon separated list of declarations from the
- * given string, parses them to atoms, and chains the newly created {struct
- * css_property}es to the specified list. The function returns positive value
- * in case it recognized a property in the given string, or zero in case of an
- * error. */
+/** This function takes a semicolon separated list of declarations
+ * from the given string, parses them to atoms, and chains the newly
+ * created struct css_property objects to the specified list.
+ * @returns positive value in case it recognized a property in the
+ * given string, or zero in case of an error. */
 void css_parse_properties(LIST_OF(struct css_property) *props,
 			  struct scanner *scanner);
 
 
-/* Parses the @string and adds any recognized selectors + properties to the
- * given stylesheet @css. If the selector is already in the stylesheet it
+/** Parses the @a string and adds any recognized selectors + properties to the
+ * given stylesheet @a css. If the selector is already in the stylesheet it
  * properties are added to the that selector. */
 void css_parse_stylesheet(struct css_stylesheet *css, struct uri *base_uri,
 			  unsigned char *string, unsigned char *end);
diff --git a/src/document/css/property.c b/src/document/css/property.c
index e379f3287..553bbcfd5 100644
--- a/src/document/css/property.c
+++ b/src/document/css/property.c
@@ -1,4 +1,5 @@
-/* CSS property info */
+/** CSS property info
+ * @file */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -12,8 +13,8 @@
 #include "document/css/value.h"
 
 
-/* TODO: Use fastfind when we get a lot of properties. */
-/* XXX: But only _WHEN_ we get _A LOT_ of properties, zas! ;-) --pasky */
+/** @todo TODO: Use fastfind when we get a lot of properties.
+ * XXX: But only _WHEN_ we get _A LOT_ of properties, zas! ;-) --pasky */
 struct css_property_info css_property_info[CSS_PT_LAST] = {
 	{ "background",		CSS_PT_BACKGROUND,	 CSS_VT_COLOR,		css_parse_background_value },
 	{ "background-color",	CSS_PT_BACKGROUND_COLOR, CSS_VT_COLOR,		css_parse_color_value },
diff --git a/src/document/css/property.h b/src/document/css/property.h
index 0801026e2..c362801b3 100644
--- a/src/document/css/property.h
+++ b/src/document/css/property.h
@@ -6,16 +6,14 @@
 #include "util/color.h"
 #include "util/lists.h"
 
-/* The {struct css_property} describes one CSS declaration in a rule, therefore
- * being basically a parsed instance of {struct css_property_info}. One list of
+/** The struct css_property describes one CSS declaration in a rule, therefore
+ * being basically a parsed instance of struct css_property_info. One list of
  * these contains all the declarations contained in one rule. */
-
 struct css_property {
 	LIST_HEAD(struct css_property);
 
-	/* Declared property. The enum item name is derived from the property
-	 * name, just uppercase it and tr/-/_/. */
-
+	/** Declared property. The enum item name is derived from the
+	 * property name, just uppercase it and tr/-/_/. */
 	enum css_property_type {
 		CSS_PT_NONE,
 		CSS_PT_BACKGROUND,
@@ -30,9 +28,7 @@ struct css_property {
 		CSS_PT_LAST,
 	} type;
 
-	/* Property value. If it is a pointer, it points always to a memory
-	 * to be free()d together with this structure. */
-
+	/** Type of the property value.  Discriminates the #value union.  */
 	enum css_property_value_type {
 		CSS_VT_NONE,
 		CSS_VT_COLOR,
@@ -41,6 +37,9 @@ struct css_property {
 		CSS_VT_TEXT_ALIGN,
 		CSS_VT_LAST,
 	} value_type;
+
+	/** Property value. If it is a pointer, it points always to a
+	 * memory to be free()d together with this structure. */
 	union css_property_value {
 		void *none;
 		color_T color;
@@ -61,40 +60,40 @@ struct css_property {
 	} value;
 };
 
-/* The {struct css_property_info} describes what values the properties can
- * have and what internal type they have. */
-
 struct css_property_info;
 struct scanner;
 typedef int (*css_property_value_parser_T)(struct css_property_info *propinfo,
 					 union css_property_value *value,
 					 struct scanner *scanner);
 
+/** The struct css_property_info describes what values the properties can
+ * have and what internal type they have. */
 struct css_property_info {
 	unsigned char *name;
 	enum css_property_type type;
 
-	/* This is the storage type, basically describing what to save to
+	/** This is the storage type, basically describing what to save to
 	 * css_property.value. Many properties can share the same valtype.
 	 * The value is basically output of the value parser. */
 	enum css_property_value_type value_type;
 
-	/* This is the property value parser, processing the written form of a
-	 * property value. Its job is to take the value string (or scanner's
-	 * token list in the future) and transform it to a @value form
-	 * according to the property's @value_type. Although some properties
-	 * can share a parser, it is expected that most properties will either
-	 * use a custom one or use a generic parser with property-specific
-	 * backend specified in @parser_data. */
+	/** This is the property value parser, processing the written
+	 * form of a property value. Its job is to take the value
+	 * string (or scanner's token list in the future) and
+	 * transform it to a union css_property_value according to the
+	 * property's #value_type. Although some properties can share
+	 * a parser, it is expected that most properties will either
+	 * use a custom one or use a generic parser with
+	 * property-specific backend specified in #parser_data. */
 	css_property_value_parser_T parser;
 
-	/* In case you use a generic @parser, it can be useful to still give
-	 * it some specific data. You can do so through @parser_data. The
-	 * content is @parser-specific. */
+	/** In case you use a generic #parser, it can be useful to still give
+	 * it some specific data. You can do so through @c parser_data. The
+	 * content is #parser-specific. */
 	void *parser_data;
 };
 
-/* This table contains info about all the known CSS properties. */
+/** This table contains info about all the known CSS properties. */
 extern struct css_property_info css_property_info[];
 
 #endif
diff --git a/src/document/css/scanner.c b/src/document/css/scanner.c
index 0781968c3..cb927a2f1 100644
--- a/src/document/css/scanner.c
+++ b/src/document/css/scanner.c
@@ -1,4 +1,5 @@
-/* CSS token scanner utilities */
+/** CSS token scanner utilities
+ * @file */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -15,8 +16,7 @@
 #include "util/string.h"
 
 
-/* Bitmap entries for the CSS character groups used in the scanner table */
-
+/** Bitmap entries for the CSS character groups used in the scanner table */
 enum css_char_group {
 	CSS_CHAR_ALPHA		= (1 << 0),
 	CSS_CHAR_DIGIT		= (1 << 1),
diff --git a/src/document/css/scanner.h b/src/document/css/scanner.h
index 4820a0a63..5db7d853f 100644
--- a/src/document/css/scanner.h
+++ b/src/document/css/scanner.h
@@ -4,88 +4,94 @@
 
 #include "util/scanner.h"
 
-/* The various token types and what they contain. Patterns taken from
- * the flex scanner declarations in the CSS 2 Specification. */
+/** The various token types and what they contain. Patterns taken from
+ * the flex scanner declarations in the CSS 2 Specification.
+ *
+ * Char tokens range from 1 to 255 and have their char value as type
+ * meaning non char tokens have values from 256 and up.
+ *
+ * @verbatim
+ * {...} means char group, <...> means token
+ * {identstart}	[a-z_]|{nonascii}
+ * {ident}	[a-z0-9_-]|{nonascii}
+ * 	{identstart}{ident}*
+ * 	{ident}+
+ * 	[0-9]+|[0-9]*"."[0-9]+
+ * @endverbatim */
 enum css_token_type {
-	/* Char tokens: */
-
-	/* Char tokens range from 1 to 255 and have their char value as type */
-	/* meaning non char tokens have values from 256 and up. */
+	/* Doxygen 1.5.2 does not support member groups inside enum.  */
 
 	/* Low level string tokens: */
 
-	/* {...} means char group, <...> means token */
-	/* {identstart}	[a-z_]|{nonascii} */
-	/* {ident}	[a-z0-9_-]|{nonascii} */
-	/* 	{identstart}{ident}* */
-	/* 	{ident}+ */
-	/* 	[0-9]+|[0-9]*"."[0-9]+ */
-
-	/* Percentage is put because although it looks like being composed of
-	 *  and '%' floating point numbers are really not allowed but
-	 * strtol() will round it down for us ;) */
-	CSS_TOKEN_IDENT = 256,	/*  */
-	CSS_TOKEN_NUMBER,	/*  */
-	CSS_TOKEN_PERCENTAGE,	/* % */
-	CSS_TOKEN_STRING,	/* Char sequence delimted by matching ' or " */
+	CSS_TOKEN_IDENT = 256,	/**< @ */
+	CSS_TOKEN_NUMBER,	/**< @ */
+	/*! Percentage is put because although it looks like being composed
+	 * of @ and '@%' floating point numbers are really not
+	 * allowed but strtol() will round it down for us ;) */
+	CSS_TOKEN_PERCENTAGE,	/**< @% */
+	CSS_TOKEN_STRING,	/**< Char sequence delimited by matching ' or " */
 
 	/* High level string tokens: */
 
 	/* The various number values; dimension being the most generic */
-	CSS_TOKEN_ANGLE,	/* rad, grad or deg */
-	CSS_TOKEN_DIMENSION,	/*  */
-	CSS_TOKEN_EM,		/* em */
-	CSS_TOKEN_EX,		/* ex */
-	CSS_TOKEN_FREQUENCY,	/* Hz or kHz */
-	CSS_TOKEN_LENGTH,	/* {px,cm,mm,in,pt,pc} */
-	CSS_TOKEN_TIME,		/* ms or s */
+	CSS_TOKEN_ANGLE,	/**< @rad, @grad or @deg */
+	CSS_TOKEN_DIMENSION,	/**< @@ */
+	CSS_TOKEN_EM,		/**< @em */
+	CSS_TOKEN_EX,		/**< @ex */
+	CSS_TOKEN_FREQUENCY,	/**< @Hz or @kHz */
+	CSS_TOKEN_LENGTH,	/**< @{px,cm,mm,in,pt,pc} */
+	CSS_TOKEN_TIME,		/**< @ms or @s */
 
-	/* XXX: CSS_TOKEN_HASH conflicts with CSS_TOKEN_HEX_COLOR. Generating
-	 * hex color tokens has precedence and the hash token user have to
-	 * treat CSS_TOKEN_HASH and CSS_TOKEN_HEX_COLOR alike. */
-	CSS_TOKEN_HASH,		/* # */
-	CSS_TOKEN_HEX_COLOR,	/* #[0-9a-f]\{3,6} */
+	/*! XXX: @c CSS_TOKEN_HASH conflicts with #CSS_TOKEN_HEX_COLOR.
+	 * Generating hex color tokens has precedence and the hash token
+	 * user have to treat @c CSS_TOKEN_HASH and #CSS_TOKEN_HEX_COLOR
+	 * alike. */
+	CSS_TOKEN_HASH,		/**< #@ */
+	CSS_TOKEN_HEX_COLOR,	/**< #[0-9a-f]@\{3,6} */
 
-	/* For all unknown functions we generate on token contain both function name
-	 * and args so scanning/parsing is easier. Besides we already check for
-	 * ending ')'. */
-	/* For known functions where we need several args [like rgb()] we want
-	 * to generate tokens for every arg and arg delimiter ( ',' or ')' ).
-	 * Because url() is a bit triggy: it can contain both  and some
-	 * chars that would other wise make the scanner probably choke we also
-	 * include the arg in that token. Besides it will make things like
-	 * 'background' property parsing easier. */
-	CSS_TOKEN_FUNCTION,	/* () */
-	CSS_TOKEN_RGB,		/* rgb( */
-	CSS_TOKEN_URL,		/* url() */
+	/*! For all unknown functions we generate on token contain both
+	 * function name and args so scanning/parsing is easier. Besides
+	 * we already check for ending ')'.  */
+	CSS_TOKEN_FUNCTION,	/**< @(@) */
+	/*! For known functions where we need several args [like rgb()]
+	 * we want to generate tokens for every arg and arg delimiter
+	 * ( ',' or ')' ). */
+	CSS_TOKEN_RGB,		/**< rgb( */
+	/*! Because url() is a bit triggy: it can contain both @
+	 * and some chars that would other wise make the scanner probably
+	 * choke we also include the arg in that token. Besides it will
+	 * make things like 'background' property parsing easier. */
+	CSS_TOKEN_URL,		/**< url(@) */
 
 	/* @-rule symbols */
-	CSS_TOKEN_AT_KEYWORD,	/* @ */
-	CSS_TOKEN_AT_CHARSET,	/* @charset */
-	CSS_TOKEN_AT_FONT_FACE,	/* @font-face */
-	CSS_TOKEN_AT_IMPORT,	/* @import */
-	CSS_TOKEN_AT_MEDIA,	/* @media */
-	CSS_TOKEN_AT_PAGE,	/* @page */
 
-	CSS_TOKEN_IMPORTANT,	/* !important */
+	CSS_TOKEN_AT_KEYWORD,	/**< @@@ */
+	CSS_TOKEN_AT_CHARSET,	/**< @@charset */
+	CSS_TOKEN_AT_FONT_FACE,	/**< @@font-face */
+	CSS_TOKEN_AT_IMPORT,	/**< @@import */
+	CSS_TOKEN_AT_MEDIA,	/**< @@media */
+	CSS_TOKEN_AT_PAGE,	/**< @@page */
+
+	CSS_TOKEN_IMPORTANT,	/**< !@important */
 
 	/* TODO: Selector stuff: */
-	CSS_TOKEN_SELECT_SPACE_LIST,	/* ~= */
-	CSS_TOKEN_SELECT_HYPHEN_LIST,	/* |= */
-	CSS_TOKEN_SELECT_BEGIN,		/* ^= */
-	CSS_TOKEN_SELECT_END,		/* $= */
-	CSS_TOKEN_SELECT_CONTAINS,	/* *= */
+
+	CSS_TOKEN_SELECT_SPACE_LIST,	/**< ~= */
+	CSS_TOKEN_SELECT_HYPHEN_LIST,	/**< |= */
+	CSS_TOKEN_SELECT_BEGIN,		/**< ^= */
+	CSS_TOKEN_SELECT_END,		/**< $= */
+	CSS_TOKEN_SELECT_CONTAINS,	/**< *= */
 
 	/* Special tokens: */
 
-	/* A special token for unrecognized strings */
+	/** A special token for unrecognized strings */
 	CSS_TOKEN_GARBAGE,
 
-	/* Token type used internally when scanning to signal that the token
+	/** Token type used internally when scanning to signal that the token
 	 * should not be recorded in the scanners token table. */
 	CSS_TOKEN_SKIP,
 
-	/* Another internal token type used both to mark unused tokens in the
+	/** Another internal token type used both to mark unused tokens in the
 	 * scanner table as invalid or when scanning to signal that the
 	 * scanning should end. */
 	CSS_TOKEN_NONE = 0,
@@ -102,7 +108,7 @@ extern struct scanner_info css_scanner_info;
 	 (token_type) == ';' ? (1 <<  8) : \
 	 (token_type) == ')' ? (1 <<  7) : 0)
 
-/* Check whether it is safe to skip the @token when looking for @skipto. */
+/** Check whether it is safe to skip the @a type when looking for @a skipto. */
 static inline int
 check_css_precedence(int type, int skipto)
 {
diff --git a/src/document/css/stylesheet.c b/src/document/css/stylesheet.c
index 63303ba1f..dd2498fe7 100644
--- a/src/document/css/stylesheet.c
+++ b/src/document/css/stylesheet.c
@@ -1,4 +1,5 @@
-/* CSS stylesheet handling */
+/** CSS stylesheet handling
+ * @file */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
diff --git a/src/document/css/stylesheet.h b/src/document/css/stylesheet.h
index 046339350..7928a921e 100644
--- a/src/document/css/stylesheet.h
+++ b/src/document/css/stylesheet.h
@@ -6,10 +6,12 @@
 
 /* #define DEBUG_CSS */
 
-/* TODO: We need a memory efficient and fast way to define how properties
- * cascade. What we are interested in is making it fast and easy to find
- * all properties we need.
+/** @file
+ * @todo TODO: We need a memory efficient and fast way to define how
+ * properties cascade. What we are interested in is making it fast and
+ * easy to find all properties we need.
  *
+ * @code
  *	struct css_cascade {
  *		struct css_cascade *parent;
  *		struct list_head properties;
@@ -17,6 +19,7 @@
  *			- Can later be turned into a table to not waste memory:
  *			  struct css_property properties[1];
  *	};
+ * @endcode
  *
  * And the selector should then only map a document element into this
  * data structure.
@@ -26,28 +29,32 @@
  * Question is in what direction to apply. It should be possible for the user
  * to overwrite any document provided stylesheet using "!important" so we need
  * to keep track in some table what properties was already applied so we only
- * overwrite when we have to. --jonas */
-/* XXX: This is one of the TODOs where I have no clue what is it talking about
+ * overwrite when we have to. --jonas
+ *
+ * XXX: This is one of the TODOs where I have no clue what is it talking about
  * in particular. Is it obsolete now when we grok 'td.foo p#x>a:hover' without
  * hesitation? --pasky */
 
 
-/* The {struct css_selector} is used for mapping elements (or nodes) in the
+/** The struct css_selector is used for mapping elements (or nodes) in the
  * document structure to properties. See README for some hints about how the
- * trees of these span. */
-/* TODO: Hash the selectors at least at the top levels? Binary trees could
- * still give an excellent gain while not giving a constant memory usage hit.
- * --pasky */
+ * trees of these span.
+ *
+ * Selectors are currently kept in lists that find_css_selector() then
+ * has to search linearly.  Hashing was also tested but did not help
+ * in practice: each find_css_selector() call runs approximately one
+ * strcasecmp(), and a hash function is unlikely to be faster than that.
+ * See ELinks bug 789 for details.  */
 struct css_selector {
 	LIST_HEAD(struct css_selector);
 
-	/* This defines relation between this selector fragment and its
+	/** This defines relation between this selector fragment and its
 	 * parent in the selector tree. */
 	enum css_selector_relation {
-		CSR_ROOT, /* First class stylesheet member. */
-		CSR_SPECIFITY, /* Narrowing-down, i.e. the "x" in "foo#x". */
-		CSR_ANCESTOR, /* Ancestor, i.e. the "p" in "p a". */
-		CSR_PARENT, /* Direct parent, i.e. the "div" in "div>img". */
+		CSR_ROOT, /**< First class stylesheet member. */
+		CSR_SPECIFITY, /**< Narrowing-down, i.e. the "x" in "foo#x". */
+		CSR_ANCESTOR, /**< Ancestor, i.e. the "p" in "p a". */
+		CSR_PARENT, /**< Direct parent, i.e. the "div" in "div>img". */
 	} relation;
 	LIST_OF(struct css_selector) leaves;
 
@@ -56,7 +63,7 @@ struct css_selector {
 		CST_ID,
 		CST_CLASS,
 		CST_PSEUDO,
-		CST_INVALID, /* Auxiliary for the parser */
+		CST_INVALID, /**< Auxiliary for the parser */
 	} type;
 	unsigned char *name;
 
@@ -68,43 +75,43 @@ struct css_stylesheet;
 typedef void (*css_stylesheet_importer_T)(struct css_stylesheet *, struct uri *,
 					unsigned char *url, int urllen);
 
-/* The {struct css_stylesheet} describes all the useful data that was extracted
+/** The struct css_stylesheet describes all the useful data that was extracted
  * from the CSS source. Currently we don't cache anything but the default user
- * stylesheet so it can contain stuff from both