From 761a9a99b72cfd2aa9e4d159c1bbd859cf70bd3f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 8 Jul 2015 22:05:34 +0100 Subject: 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. --- test/select-common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'test/select-common.c') 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) -- cgit v1.2.3