static void add_shorthand_border(fz_css_match *match, fz_css_value *value, int spec, int T, int R, int B, int L) { while (value) { if (value->type == CSS_HASH) { if (T) add_property(match, "border-top-color", value, spec); if (R) add_property(match, "border-right-color", value, spec); if (B) add_property(match, "border-bottom-color", value, spec); if (L) add_property(match, "border-left-color", value, spec); } else if (value->type == CSS_KEYWORD) { if (keyword_in_list(value->data, border_width_kw, nelem(border_width_kw))) { if (T) add_property(match, "border-top-width", value, spec); if (R) add_property(match, "border-right-width", value, spec); if (B) add_property(match, "border-bottom-width", value, spec); if (L) add_property(match, "border-left-width", value, spec); } else if (keyword_in_list(value->data, border_style_kw, nelem(border_style_kw))) { if (T) add_property(match, "border-top-style", value, spec); if (R) add_property(match, "border-right-style", value, spec); if (B) add_property(match, "border-bottom-style", value, spec); if (L) add_property(match, "border-left-style", value, spec); } else if (keyword_in_list(value->data, color_kw, nelem(color_kw))) { if (T) add_property(match, "border-top-color", value, spec); if (R) add_property(match, "border-right-color", value, spec); if (B) add_property(match, "border-bottom-color", value, spec); if (L) add_property(match, "border-left-color", value, spec); } } else { if (T) add_property(match, "border-top-width", value, spec); if (R) add_property(match, "border-right-width", value, spec); if (B) add_property(match, "border-bottom-width", value, spec); if (L) add_property(match, "border-left-width", value, spec); } value = value->next; } }
static void add_shorthand_list_style(fz_css_match *match, fz_css_value *value, int spec) { while (value) { if (value->type == CSS_KEYWORD) { if (keyword_in_list(value->data, list_style_type_kw, nelem(list_style_type_kw))) { add_property(match, "list-style-type", value, spec); } else if (keyword_in_list(value->data, list_style_position_kw, nelem(list_style_position_kw))) { add_property(match, "list-style-position", value, spec); } } value = value->next; } }
static void add_shorthand_border(fz_css_match *match, fz_css_value *value, int spec) { while (value) { if (value->type == CSS_COLOR) { add_property(match, "border-color", value, spec); } else if (value->type == CSS_KEYWORD) { if (keyword_in_list(value->data, border_width_kw, nelem(border_width_kw))) { add_property(match, "border-width-top", value, spec); add_property(match, "border-width-right", value, spec); add_property(match, "border-width-bottom", value, spec); add_property(match, "border-width-left", value, spec); } else if (keyword_in_list(value->data, border_style_kw, nelem(border_style_kw))) { add_property(match, "border-style", value, spec); } else if (keyword_in_list(value->data, color_kw, nelem(color_kw))) { add_property(match, "border-color", value, spec); } } else { add_property(match, "border-width-top", value, spec); add_property(match, "border-width-right", value, spec); add_property(match, "border-width-bottom", value, spec); add_property(match, "border-width-left", value, spec); } value = value->next; } }
static fz_css_value * value_from_property(fz_css_match *match, const char *name) { fz_css_value *value; value = value_from_raw_property(match, name); if (match->up) { if (value && !strcmp(value->data, "inherit")) return value_from_property(match->up, name); if (!value && keyword_in_list(name, inherit_list, nelem(inherit_list))) return value_from_property(match->up, name); } return value; }
static fz_css_value * value_from_property(fz_css_match *match, const char *name) { fz_css_value *value; value = value_from_raw_property(match, name); if (match->up) { if (value && !strcmp(value->data, "inherit")) if (strcmp(name, "font-size") != 0) /* never inherit 'font-size' textually */ return value_from_property(match->up, name); if (!value && keyword_in_list(name, inherit_list, nelem(inherit_list))) return value_from_property(match->up, name); } return value; }