Implement list-style-type circle, square, none, and decimal.

svn path=/trunk/netsurf/; revision=3034
This commit is contained in:
James Bursa 2006-11-05 19:50:34 +00:00
parent fc197a4835
commit f546f6b5e7
2 changed files with 40 additions and 4 deletions

View File

@ -53,8 +53,10 @@ pre { display: block; font-family: monospace; white-space: pre; margin-bottom: 1
ins { color: green; text-decoration: underline; }
del { color: red; text-decoration: line-through; }
ul { display: block; padding-left: 0.5em; margin-bottom: 1em; }
ol { display: block; padding-left: 0.5em; margin-bottom: 1em; }
ul { display: block; padding-left: 1.5em; margin-bottom: 1em;
list-style-type: disc; }
ol { display: block; padding-left: 1.5em; margin-bottom: 1em;
list-style-type: decimal; }
li { display: list-item; padding-left: 0.5em; margin-bottom: 0.3em; }
dl { display: block; padding-left: 0.5em; margin-bottom: 1em; }

View File

@ -416,8 +416,42 @@ bool box_construct_element(xmlNode *n, struct content *content,
return false;
marker->type = BOX_BLOCK;
/** \todo marker content (list-style-type) */
marker->text = "\342\200\242";
marker->length = 3;
switch (style->list_style_type) {
case CSS_LIST_STYLE_TYPE_DISC:
default:
/* 2022 BULLET */
marker->text = "\342\200\242";
marker->length = 3;
break;
case CSS_LIST_STYLE_TYPE_CIRCLE:
/* 2742 CIRCLED OPEN CENTRE EIGHT POINTED STAR*/
marker->text = "\342\235\202";
marker->length = 3;
break;
case CSS_LIST_STYLE_TYPE_SQUARE:
/* 25A0 BLACK SQUARE */
marker->text = "\342\226\240";
marker->length = 3;
break;
case CSS_LIST_STYLE_TYPE_DECIMAL:
case CSS_LIST_STYLE_TYPE_LOWER_ALPHA:
case CSS_LIST_STYLE_TYPE_LOWER_ROMAN:
case CSS_LIST_STYLE_TYPE_UPPER_ALPHA:
case CSS_LIST_STYLE_TYPE_UPPER_ROMAN:
if (parent->last && parent->last->list_marker)
marker->rows = parent->last->
list_marker->rows + 1;
marker->text = talloc_array(content, char, 20);
if (!marker->text)
return false;
snprintf(marker->text, 20, "%u.", marker->rows);
marker->length = strlen(marker->text);
break;
case CSS_LIST_STYLE_TYPE_NONE:
marker->text = 0;
marker->length = 0;
break;
}
if (style->list_style_image.type ==
CSS_LIST_STYLE_IMAGE_URI) {
if (!html_fetch_object(content,