summaryrefslogtreecommitdiff
path: root/src/parse/properties.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse/properties.c')
-rw-r--r--src/parse/properties.c111
1 files changed, 79 insertions, 32 deletions
diff --git a/src/parse/properties.c b/src/parse/properties.c
index b6f3d6d..f6f18a0 100644
--- a/src/parse/properties.c
+++ b/src/parse/properties.c
@@ -2592,27 +2592,58 @@ css_error parse_font_family(css_language *c,
if (token->type == CSS_TOKEN_IDENT) {
if (first == false) {
required_size += sizeof(opv);
- } else {
- value = FONT_FAMILY_IDENT_LIST;
}
- required_size +=
- sizeof(parserutils_hash_entry *);
+ if (token->ilower == c->strings[SERIF]) {
+ if (first) {
+ value = FONT_FAMILY_SERIF;
+ }
+ } else if (token->ilower ==
+ c->strings[SANS_SERIF]) {
+ if (first) {
+ value = FONT_FAMILY_SANS_SERIF;
+ }
+ } else if (token->ilower ==
+ c->strings[CURSIVE]) {
+ if (first) {
+ value = FONT_FAMILY_CURSIVE;
+ }
+ } else if (token->ilower ==
+ c->strings[FANTASY]) {
+ if (first) {
+ value = FONT_FAMILY_FANTASY;
+ }
+ } else if (token->ilower ==
+ c->strings[MONOSPACE]) {
+ if (first) {
+ value = FONT_FAMILY_MONOSPACE;
+ }
+ } else {
+ if (first) {
+ value = FONT_FAMILY_IDENT_LIST;
+ }
+
+ required_size +=
+ sizeof(parserutils_hash_entry *);
- /* Skip past [ IDENT* S* ]* */
- while (token != NULL) {
- token = parserutils_vector_peek(
- vector, temp_ctx);
- if (token != NULL &&
+ /* Skip past [ IDENT* S* ]* */
+ while (token != NULL) {
+ token = parserutils_vector_peek(
+ vector,
+ temp_ctx);
+ if (token != NULL &&
token->type !=
CSS_TOKEN_IDENT &&
- token->type !=
- CSS_TOKEN_S) {
- break;
- }
-
- token = parserutils_vector_iterate(
+ token->type !=
+ CSS_TOKEN_S) {
+ break;
+ }
+
+ /** \todo idents must not
+ * match generic families */
+ token = parserutils_vector_iterate(
vector, &temp_ctx);
+ }
}
} else if (token->type == CSS_TOKEN_STRING) {
if (first == false) {
@@ -2686,28 +2717,44 @@ css_error parse_font_family(css_language *c,
/** \todo need to build string from idents */
const parserutils_hash_entry *name =
token->idata;
+
+ if (token->ilower == c->strings[SERIF]) {
+ opv = FONT_FAMILY_SERIF;
+ } else if (token->ilower ==
+ c->strings[SANS_SERIF]) {
+ opv = FONT_FAMILY_SANS_SERIF;
+ } else if (token->ilower ==
+ c->strings[CURSIVE]) {
+ opv = FONT_FAMILY_CURSIVE;
+ } else if (token->ilower ==
+ c->strings[FANTASY]) {
+ opv = FONT_FAMILY_FANTASY;
+ } else if (token->ilower ==
+ c->strings[MONOSPACE]) {
+ opv = FONT_FAMILY_MONOSPACE;
+ } else {
+ opv = FONT_FAMILY_IDENT_LIST;
- opv = FONT_FAMILY_IDENT_LIST;
-
- if (first == false) {
- memcpy(ptr, &opv, sizeof(opv));
- ptr += sizeof(opv);
- }
-
- /* Skip past [ IDENT* S* ]* */
- while (token != NULL) {
- token = parserutils_vector_peek(
- vector, temp_ctx);
- if (token != NULL &&
+ /* Skip past [ IDENT* S* ]* */
+ while (token != NULL) {
+ token = parserutils_vector_peek(
+ vector, temp_ctx);
+ if (token != NULL &&
token->type !=
CSS_TOKEN_IDENT &&
- token->type !=
- CSS_TOKEN_S) {
- break;
+ token->type !=
+ CSS_TOKEN_S) {
+ break;
+ }
+
+ token = parserutils_vector_iterate(
+ vector, ctx);
}
+ }
- token = parserutils_vector_iterate(
- vector, ctx);
+ if (first == false) {
+ memcpy(ptr, &opv, sizeof(opv));
+ ptr += sizeof(opv);
}
memcpy(ptr, &name, sizeof(name));