diff options
Diffstat (limited to 'src/stylesheet.h')
-rw-r--r-- | src/stylesheet.h | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/src/stylesheet.h b/src/stylesheet.h index a71fca6..673bc95 100644 --- a/src/stylesheet.h +++ b/src/stylesheet.h @@ -188,6 +188,8 @@ struct css_stylesheet { bool quirks_allowed; /**< Quirks permitted */ bool quirks_used; /**< Quirks actually used */ + bool uses_revert; /**< Uses 'revert' property value */ + bool inline_style; /**< Is an inline style */ size_t size; /**< Size, in bytes */ @@ -226,11 +228,14 @@ css_error css__stylesheet_merge_style(css_style *target, css_style *style); static inline css_error css__stylesheet_style_appendOPV(css_style *style, opcode_t opcode, uint8_t flags, uint16_t value) { + if ((flags & (0x7 << 1)) == FLAG_REVERT) { + style->sheet->uses_revert = true; + } return css__stylesheet_style_append(style, buildOPV(opcode, flags, value)); } -/** Helper function to set inherit flag */ +/** Helper function to set inherit generic value */ static inline css_error css_stylesheet_style_inherit(css_style *style, opcode_t opcode) { @@ -238,6 +243,43 @@ static inline css_error css_stylesheet_style_inherit(css_style *style, buildOPV(opcode, FLAG_INHERIT, 0)); } +/** Helper function to set initial generic value */ +static inline css_error css_stylesheet_style_initial(css_style *style, + opcode_t opcode) +{ + return css__stylesheet_style_append(style, + buildOPV(opcode, FLAG_INITIAL, 0)); +} + +/** Helper function to set inherit generic value */ +static inline css_error css_stylesheet_style_revert(css_style *style, + opcode_t opcode) +{ + style->sheet->uses_revert = true; + return css__stylesheet_style_append(style, + buildOPV(opcode, FLAG_REVERT, 0)); +} + +/** Helper function to set initial generic value */ +static inline css_error css_stylesheet_style_unset(css_style *style, + opcode_t opcode) +{ + return css__stylesheet_style_append(style, + buildOPV(opcode, FLAG_UNSET, 0)); +} + +/** Helper function to set initial generic value */ +static inline css_error css_stylesheet_style_flag_value(css_style *style, + enum flag_value flag_value, opcode_t opcode) +{ + enum flag flag = flag_value << 1; + if (flag == FLAG_REVERT) { + style->sheet->uses_revert = true; + } + return css__stylesheet_style_append(style, + buildOPV(opcode, flag, 0)); +} + css_error css__stylesheet_selector_create(css_stylesheet *sheet, css_qname *qname, css_selector **selector); css_error css__stylesheet_selector_destroy(css_stylesheet *sheet, |