diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/select/select.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/select/select.c b/src/select/select.c index b9dd5ef..c0dfd1f 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -269,6 +269,7 @@ css_error css_select_style(css_select_ctx *ctx, void *node, css_error error; css_hint hint; css_select_state state; + void *parent = NULL; if (ctx == NULL || node == NULL || result == NULL || handler == NULL) return CSS_BADPARM; @@ -282,6 +283,10 @@ css_error css_select_style(css_select_ctx *ctx, void *node, state.handler = handler; state.pw = pw; + error = handler->parent_node(pw, node, &parent); + if (error) + return error; + /* Iterate through the top-level stylesheets, selecting styles * from those which apply to our current media requirements and * are not disabled */ @@ -349,7 +354,6 @@ css_error css_select_style(css_select_ctx *ctx, void *node, * Those properties which are inherited need to be set as inherit. * Those which are not inherited need to be set to their default value. */ - /** \todo If node is tree root, everything should be defaulted. */ for (i = 0; i < CSS_N_PROPERTIES; i++) { /* Do nothing if this property is set */ if (state.props[i].set) @@ -357,8 +361,11 @@ css_error css_select_style(css_select_ctx *ctx, void *node, /* Do nothing if this property is inherited (the default state * of a clean computed style is for everything to be set to - * inherit) */ - if (prop_dispatch[i].inherited) + * inherit) + * + * If the node is tree root, everything should be defaulted. + */ + if (prop_dispatch[i].inherited && parent != NULL) continue; /* Remaining properties are neither inherited nor already set. |