From 2f5753d607a93c8ae18aab3dd675b111af7d879d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 4 Jul 2009 12:59:37 +0000 Subject: Query client for initial values of color, font-family, quotes, and voice-family properties. svn path=/trunk/libcss/; revision=8306 --- test/data/select/tests1.dat | 16 ++++++++-------- test/dump_computed.h | 6 ------ test/select-auto.c | 30 +++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 15 deletions(-) (limited to 'test') diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat index 3f593ff..09f9ef0 100644 --- a/test/data/select/tests1.dat +++ b/test/data/select/tests1.dat @@ -60,7 +60,7 @@ padding-right: 0px padding-bottom: 0px padding-left: 0px position: static -quotes: default +quotes: none right: auto table-layout: auto text-decoration: none @@ -135,7 +135,7 @@ padding-right: 0px padding-bottom: 0px padding-left: 0px position: static -quotes: default +quotes: none right: auto table-layout: auto text-decoration: none @@ -210,7 +210,7 @@ padding-right: 0px padding-bottom: 0px padding-left: 0px position: static -quotes: default +quotes: none right: auto table-layout: auto text-decoration: none @@ -262,7 +262,7 @@ direction: ltr display: block empty-cells: show float: none -font-family: default +font-family: sans-serif font-size: medium font-style: normal font-variant: normal @@ -291,7 +291,7 @@ padding-right: 0px padding-bottom: 0px padding-left: 0px position: static -quotes: default +quotes: none right: auto table-layout: auto text-align: default @@ -347,7 +347,7 @@ direction: ltr display: inline empty-cells: show float: none -font-family: default +font-family: sans-serif font-size: medium font-style: normal font-variant: normal @@ -376,7 +376,7 @@ padding-right: 0px padding-bottom: 0px padding-left: 0px position: static -quotes: default +quotes: none right: auto table-layout: auto text-align: default @@ -447,7 +447,7 @@ padding-right: 0px padding-bottom: 0px padding-left: 0px position: static -quotes: default +quotes: none right: auto table-layout: auto text-decoration: none diff --git a/test/dump_computed.h b/test/dump_computed.h index 56a818c..a9e2d88 100644 --- a/test/dump_computed.h +++ b/test/dump_computed.h @@ -1149,9 +1149,6 @@ static void dump_computed_style(const css_computed_style *style, char *buf, case CSS_FONT_FAMILY_MONOSPACE: wrote = snprintf(ptr, *len, " monospace\n"); break; - case CSS_FONT_FAMILY_DEFAULT: - wrote = snprintf(ptr, *len, " default\n"); - break; } ptr += wrote; *len -= wrote; @@ -1902,9 +1899,6 @@ static void dump_computed_style(const css_computed_style *style, char *buf, case CSS_QUOTES_NONE: wrote = snprintf(ptr, *len, "quotes: none\n"); break; - case CSS_QUOTES_DEFAULT: - wrote = snprintf(ptr, *len, "quotes: default\n"); - break; } } ptr += wrote; diff --git a/test/select-auto.c b/test/select-auto.c index e884a18..fed6204 100644 --- a/test/select-auto.c +++ b/test/select-auto.c @@ -114,6 +114,8 @@ static css_error node_is_lang(void *pw, void *node, lwc_string *lang, bool *match); static css_error node_presentational_hint(void *pw, void *node, uint32_t property, css_hint *hint); +static css_error ua_default_for_property(void *pw, uint32_t property, + css_hint *hint); static css_select_handler select_handler = { node_name, @@ -135,7 +137,8 @@ static css_select_handler select_handler = { node_is_active, node_is_focus, node_is_lang, - node_presentational_hint + node_presentational_hint, + ua_default_for_property }; static void *myrealloc(void *data, size_t len, void *pw) @@ -1082,3 +1085,28 @@ css_error node_presentational_hint(void *pw, void *node, return CSS_PROPERTY_NOT_SET; } +css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint) +{ + UNUSED(pw); + + if (property == CSS_PROP_COLOR) { + hint->data.color = 0x00000000; + hint->status = CSS_COLOR_COLOR; + } else if (property == CSS_PROP_FONT_FAMILY) { + hint->data.strings = NULL; + hint->status = CSS_FONT_FAMILY_SANS_SERIF; + } else if (property == CSS_PROP_QUOTES) { + /* Not exactly useful :) */ + hint->data.strings = NULL; + hint->status = CSS_QUOTES_NONE; + } else if (property == CSS_PROP_VOICE_FAMILY) { + /** \todo Fix this when we have voice-family done */ + hint->data.strings = NULL; + hint->status = 0; + } else { + return CSS_INVALID; + } + + return CSS_OK; +} + -- cgit v1.2.3