summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2015-07-08 22:05:34 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2016-02-02 10:55:16 +0000
commit761a9a99b72cfd2aa9e4d159c1bbd859cf70bd3f (patch)
treee34db76f0bbb2e4f975c91eb2ed114ff856acc84 /test
parent842120bede2ef48f04f8bb3a1c8967d0d7457cac (diff)
downloadlibcss-761a9a99b72cfd2aa9e4d159c1bbd859cf70bd3f.tar.gz
libcss-761a9a99b72cfd2aa9e4d159c1bbd859cf70bd3f.tar.bz2
Change how presentational hints are handled.
Previously, we performed normal selection from CSS sources, and then iterated over all the properties in the populated computed style. If the properties were unset or their values were not from either a UA stylesheet or user stylesheet with !important set, then we asked the client program (e.g. NetSurf) if there were any presentational hints for that node, for each such property. In the worst case this triggered N_PROPERTIES * N_NODES calls back to the client program, even for properties that can't be set via HTML attributes. The new API asks the client to supply a list of all the presentational hints that apply to the given node. For most nodes on modern documents, this is 0. Any presentational hints are applied before selection from CSS sources.
Diffstat (limited to 'test')
-rw-r--r--test/select-common.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/select-common.c b/test/select-common.c
index f1762a6..432bd54 100644
--- a/test/select-common.c
+++ b/test/select-common.c
@@ -156,9 +156,9 @@ static css_error node_is_target(void *pw, void *node, bool *match);
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);
+ uint32_t *nhints, css_hint **hints);
static css_error ua_default_for_property(void *pw, uint32_t property,
- css_hint *hint);
+ css_hint *hints);
static css_error compute_font_size(void *pw, const css_hint *parent,
css_hint *size);
static css_error set_libcss_node_data(void *pw, void *n,
@@ -1566,14 +1566,15 @@ css_error node_is_lang(void *pw, void *n,
}
css_error node_presentational_hint(void *pw, void *node,
- uint32_t property, css_hint *hint)
+ uint32_t *nhints, css_hint **hints)
{
UNUSED(pw);
UNUSED(node);
- UNUSED(property);
- UNUSED(hint);
- return CSS_PROPERTY_NOT_SET;
+ *nhints = 0;
+ *hints = NULL;
+
+ return CSS_OK;
}
css_error ua_default_for_property(void *pw, uint32_t property, css_hint *hint)