Gitweb links:

...log 
http://git.netsurf-browser.org/libcss.git/shortlog/05a9ed4f74162f8e53a4bc6620d7f8ca06b10434
...commit 
http://git.netsurf-browser.org/libcss.git/commit/05a9ed4f74162f8e53a4bc6620d7f8ca06b10434
...tree 
http://git.netsurf-browser.org/libcss.git/tree/05a9ed4f74162f8e53a4bc6620d7f8ca06b10434

The branch, tlsa/calc has been updated
  discards  67364acc7eeb51ee26b6fdab466ccd930a32f904 (commit)
  discards  9434b1d08875f0789eb13bef25125db2d8558279 (commit)
  discards  6ae36f9e473d3a0ed3b10a9205230fa8cdc40af5 (commit)
  discards  901026e7aad4b68d9dfcb17416df179cfc923ff3 (commit)
  discards  825ef83e41ea3389a1e1d0ad16b688f3fe9dfc3f (commit)
  discards  ce71fe3d4f6a348ef1b2024389905c844fe8e5fe (commit)
       via  05a9ed4f74162f8e53a4bc6620d7f8ca06b10434 (commit)
       via  c4eabbb07c93c6f9704121214adbe1207cfd3756 (commit)
       via  8a1f5b2a29ceecf6202ad0635f15b36662d2275b (commit)
       via  11b4249c8ed58468632e25b31ae7d4690f90d102 (commit)
       via  6afa3f74544d124d5c76688701373beb1b554216 (commit)
       via  d6a1adfd3390d063da2e405a208151dcb491fc9d (commit)
       via  f5842253bdb62fef9543e58ae38c232f5b4f982a (commit)
       via  b441838df4b58902c64eef094c635c23c8321895 (commit)
       via  df45c6cfb4c385e8a7d6d85d78b5dca7844c37f5 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (67364acc7eeb51ee26b6fdab466ccd930a32f904)
            \
             N -- N -- N (05a9ed4f74162f8e53a4bc6620d7f8ca06b10434)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=05a9ed4f74162f8e53a4bc6620d7f8ca06b10434
commit 05a9ed4f74162f8e53a4bc6620d7f8ca06b10434
Author: Daniel Silverstone <[email protected]>
Commit: Michael Drake <[email protected]>

    (calc): Update bytecode for calc() to be in an lwc_string
    
    In order to permit us to share calc expressions between styles
    and computed styles, without copying, we embed the calc expression
    bytecode into an lwc string.  This is effectively using lwc_string
    as an interned byte buffer, there may be a nicer way to do this in
    the future.
    
    Signed-off-by: Daniel Silverstone <[email protected]>

diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index fe5ee6b..fa8ffbe 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1362,16 +1362,17 @@ cleanup:
 static css_error
 css__parse_calc_sum(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result);
+               parserutils_buffer *result);
 
 static css_error
 css__parse_calc_number(
                const parserutils_vector *vector, int *ctx,
-               css_style *result)
+               parserutils_buffer *result)
 {
        const css_token *token;
        css_fixed num;
        size_t consumed;
+       css_code_t push = CALC_PUSH_NUMBER;
 
        /* Consume the number token */
        token = parserutils_vector_iterate(vector, ctx);
@@ -1386,13 +1387,18 @@ css__parse_calc_number(
                return CSS_INVALID;
        }
 
-       return css__stylesheet_style_vappend(result, 2, (css_code_t) 
CALC_PUSH_NUMBER, (css_code_t)num);
+       return css_error_from_parserutils_error(
+               parserutils_buffer_appendv(result, 2,
+                       &push, sizeof(push),
+                       &num, sizeof(num)
+               )
+       );
 }
 
 static css_error
 css__parse_calc_value(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result)
+               parserutils_buffer *result)
 {
        css_error error;
        int orig_ctx = *ctx;
@@ -1426,6 +1432,7 @@ css__parse_calc_value(css_language *c,
        {
                css_fixed length = 0;
                uint32_t unit = 0;
+               css_code_t push = CALC_PUSH_VALUE;
                *ctx = orig_ctx;
 
                error = css__parse_unit_specifier(c, vector, ctx, 
UNIT_CALC_NUMBER, &length, &unit);
@@ -1434,7 +1441,14 @@ css__parse_calc_value(css_language *c,
                        return error;
                }
 
-               error = css__stylesheet_style_vappend(result, 3, (css_code_t) 
CALC_PUSH_VALUE, length, unit);
+               error = css_error_from_parserutils_error(
+                       parserutils_buffer_appendv(result, 3,
+                               &push, sizeof(push),
+                               &length, sizeof(length),
+                               &unit, sizeof(unit)
+                       )
+               );
+
        }
                break;
 
@@ -1455,12 +1469,11 @@ css__parse_calc_value(css_language *c,
 static css_error
 css__parse_calc_product(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result)
+               parserutils_buffer *result)
 {
        css_error error = CSS_OK;
        const css_token *token;
-       bool multiplication;
-
+       css_code_t operator;
 
        /* First parse a value */
        error = css__parse_calc_value(c, vector, ctx, result);
@@ -1480,9 +1493,9 @@ css__parse_calc_product(css_language *c,
                                tokenIsChar(token, '-'))
                        break;
                else if (tokenIsChar(token, '*'))
-                       multiplication = true;
+                       operator = CALC_MULTIPLY;
                else if (tokenIsChar(token, '/'))
-                       multiplication = false;
+                       operator = CALC_DIVIDE;
                else {
                        error = CSS_INVALID;
                        break;
@@ -1492,7 +1505,7 @@ css__parse_calc_product(css_language *c,
 
                consumeWhitespace(vector, ctx);
 
-               if (multiplication) {
+               if (operator == CALC_MULTIPLY) {
                        /* parse another value */
                        error = css__parse_calc_value(c, vector, ctx, result);
                } else {
@@ -1502,8 +1515,9 @@ css__parse_calc_product(css_language *c,
                        break;
 
                /* emit the multiplication/division operator */
-               error = css__stylesheet_style_append(result,
-                                       (css_code_t) (multiplication ? 
CALC_MULTIPLY : CALC_DIVIDE));
+               error = css_error_from_parserutils_error(
+                       parserutils_buffer_append(result, (const uint8_t 
*)&operator, sizeof(operator))
+               );
        } while (1);
        /* We've fallen off, either we had an error or we're left with ')' */
        return error;
@@ -1513,12 +1527,11 @@ css__parse_calc_product(css_language *c,
 css_error
 css__parse_calc_sum(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result)
+               parserutils_buffer *result)
 {
        css_error error = CSS_OK;
        const css_token *token;
-       bool addition;
-
+       css_code_t operator;
 
        /* First parse a product */
        error = css__parse_calc_product(c, vector, ctx, result);
@@ -1535,9 +1548,9 @@ css__parse_calc_sum(css_language *c,
                } else if (tokenIsChar(token, ')'))
                        break;
                else if (tokenIsChar(token, '+'))
-                       addition = true;
+                       operator = CALC_ADD;
                else if (tokenIsChar(token, '-'))
-                       addition = false;
+                       operator = CALC_SUBTRACT;
                else {
                        error = CSS_INVALID;
                        break;
@@ -1552,7 +1565,9 @@ css__parse_calc_sum(css_language *c,
                        break;
 
                /* emit the addition/subtraction operator */
-               error = css__stylesheet_style_append(result, (css_code_t) 
(addition ? CALC_ADD : CALC_SUBTRACT));
+               error = css_error_from_parserutils_error(
+                       parserutils_buffer_append(result, (const uint8_t 
*)&operator, sizeof(operator))
+               );
        } while (1);
        /* We've fallen off, either we had an error or we're left with ')' */
        return error;
@@ -1569,6 +1584,10 @@ css_error css__parse_calc(css_language *c,
        const css_token *token;
        css_error error = CSS_OK;
        css_style *calc_style = NULL;
+       parserutils_buffer *calc_buffer = NULL;
+       lwc_string *calc_expr = NULL;
+       uint32_t expr_index = 0;
+       css_code_t finish = CALC_FINISH;
 
        consumeWhitespace(vector, ctx);
 
@@ -1578,6 +1597,12 @@ css_error css__parse_calc(css_language *c,
                return CSS_INVALID;
        }
 
+       if (parserutils_buffer_create(&calc_buffer) != PARSERUTILS_OK) {
+               /* Since &calc_buffer is valid, the only error case is NONMEM */
+               *ctx = orig_ctx;
+               return CSS_NOMEM;
+       }
+
        error = css__stylesheet_style_create(c->sheet, &calc_style);
        if (error != CSS_OK)
                goto cleanup;
@@ -1585,12 +1610,12 @@ css_error css__parse_calc(css_language *c,
        error = css__stylesheet_style_append(calc_style, property);
        if (error != CSS_OK)
                goto cleanup;
-       
+
        error = css__stylesheet_style_append(calc_style, (css_code_t) unit);
        if (error != CSS_OK)
                goto cleanup;
 
-       error = css__parse_calc_sum(c, vector, ctx, calc_style);
+       error = css__parse_calc_sum(c, vector, ctx, calc_buffer);
        if (error != CSS_OK)
                goto cleanup;
 
@@ -1602,17 +1627,35 @@ css_error css__parse_calc(css_language *c,
                goto cleanup;
        }
 
+       /* Append the indicator that the calc is finished */
+       error = css_error_from_parserutils_error(
+               parserutils_buffer_append(calc_buffer, (const uint8_t 
*)&finish, sizeof(finish))
+       );
+       if (error != CSS_OK)
+               goto cleanup;
+
        /* Swallow that close paren */
        parserutils_vector_iterate(vector, ctx);
 
-       /* Append the indicator that the calc is finished */
-       error = css__stylesheet_style_append(calc_style, (css_code_t) 
CALC_FINISH);
+       /* Create the lwc string representing the calculation and store it in */
+       error = css_error_from_lwc_error(
+               lwc_intern_string((const char *)calc_buffer->data, 
calc_buffer->length, &calc_expr)
+       );
        if (error != CSS_OK)
                goto cleanup;
 
+       /* This always takes ownership of calc_expr, so we should not use after 
this */
+       error = css__stylesheet_string_add(calc_style->sheet, calc_expr, 
&expr_index);
+       if (error != CSS_OK)
+               goto cleanup;
+
+       css__stylesheet_style_append(calc_style, (css_code_t) expr_index);
+
        error = css__stylesheet_merge_style(result, calc_style);
 cleanup:
        css__stylesheet_style_destroy(calc_style);
+       parserutils_buffer_destroy(calc_buffer);
+       /* We do not need to clean up calc_expr, it will never leak */
        if (error != CSS_OK) {
                *ctx = orig_ctx;
        }
diff --git a/test/dump.h b/test/dump.h
index a1fdd1f..eac0a9f 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -803,15 +803,23 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t 
depth)
                } else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
                        *ptr += sprintf(*ptr, "unset");
                } else if (isCalc(opv)) {
+                       lwc_string *calc_expr = NULL;
+                       const uint8_t *codeptr = NULL;
+                       css_code_t calc_opcode;
+                       uint32_t unit, snum;
                        /* First entry is a unit */
-                       uint32_t unit = *((uint32_t *)bytecode);
+                       unit = *((uint32_t *)bytecode);
                        ADVANCE(sizeof(unit));
+                       /* Second entry is an lwc_string of the expression */
+                       snum = *((uint32_t *)bytecode);
+                       ADVANCE(sizeof(snum));
+                       css__stylesheet_string_get(style->sheet, snum, 
&calc_expr);
+                       codeptr = (const uint8_t *)lwc_string_data(calc_expr);
                        *ptr += sprintf(*ptr, "/* -> ");
                        dump_unit(0, unit, ptr);
                        *ptr += sprintf(*ptr, " */ calc(");
-                       css_code_t calc_opcode;
-                       while ((calc_opcode = *((css_code_t *)bytecode)) != 
CALC_FINISH) {
-                               ADVANCE(sizeof(calc_opcode));
+                       while ((calc_opcode = *((css_code_t *)codeptr)) != 
CALC_FINISH) {
+                               codeptr += sizeof(calc_opcode);
                                switch (calc_opcode) {
                                case CALC_ADD:
                                        *ptr += sprintf(*ptr, "+ ");
@@ -826,17 +834,17 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t 
depth)
                                        *ptr += sprintf(*ptr, "/ ");
                                        break;
                                case CALC_PUSH_VALUE: {
-                                       css_fixed num = *((css_fixed 
*)bytecode);
-                                       ADVANCE(sizeof(num));
-                                       uint32_t unit = *((uint32_t *)bytecode);
-                                       ADVANCE(sizeof(unit));
+                                       css_fixed num = *((css_fixed *)codeptr);
+                                       codeptr += sizeof(num);
+                                       uint32_t unit = *((uint32_t *)codeptr);
+                                       codeptr += sizeof(unit);
                                        dump_unit(num, unit, ptr);
                                        *ptr += sprintf(*ptr, " ");
                                        break;
                                }
                                case CALC_PUSH_NUMBER: {
-                                       css_fixed num = *((css_fixed 
*)bytecode);
-                                       ADVANCE(sizeof(num));
+                                       css_fixed num = *((css_fixed *)codeptr);
+                                       codeptr += sizeof(num);
                                        dump_number(num, ptr);
                                        *ptr += sprintf(*ptr, " ");
                                        break;
@@ -846,7 +854,6 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t 
depth)
                                        break;
                                }
                        }
-                       ADVANCE(sizeof(calc_opcode));
                        *ptr += sprintf(*ptr, "=)");
                } else {
                        value = getValue(opv);


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=c4eabbb07c93c6f9704121214adbe1207cfd3756
commit c4eabbb07c93c6f9704121214adbe1207cfd3756
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    bytecode: Use define for calc value identifier

diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index e845170..d799194 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -14,6 +14,8 @@
 #include <libcss/types.h>
 #include <libcss/properties.h>
 
+#include "bytecode/opcodes.h"
+
 typedef uint32_t css_code_t;
 
 typedef enum css_properties_e opcode_t;
@@ -139,8 +141,7 @@ static inline bool isInherit(css_code_t OPV)
 
 static inline bool isCalc(css_code_t OPV)
 {
-       /* Note, this relies on all _CALC values being the same ultimately */
-       return getValue(OPV) == 0x7f;
+       return getValue(OPV) == VALUE_IS_CALC;
 }
 
 #endif
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index 0ff67bb..da420e1 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -10,6 +10,8 @@
 
 #include <inttypes.h>
 
+#define VALUE_IS_CALC 0x007f
+
 enum op_align_content {
        ALIGN_CONTENT_STRETCH           = 0x0000,
        ALIGN_CONTENT_FLEX_START        = 0x0001,
@@ -119,7 +121,7 @@ enum op_border_style {
 };
 
 enum op_border_width {
-       BORDER_WIDTH_CALC               = 0x007f,
+       BORDER_WIDTH_CALC               = VALUE_IS_CALC,
        BORDER_WIDTH_SET                = 0x0080,
        BORDER_WIDTH_THIN               = 0x0000,
        BORDER_WIDTH_MEDIUM             = 0x0001,
@@ -127,7 +129,7 @@ enum op_border_width {
 };
 
 enum op_bottom {
-       BOTTOM_CALC                     = 0x007f,
+       BOTTOM_CALC                     = VALUE_IS_CALC,
        BOTTOM_SET                      = 0x0080,
        BOTTOM_AUTO                     = 0x0000
 };
@@ -200,7 +202,7 @@ enum op_color {
 
 enum op_column_count {
        COLUMN_COUNT_AUTO               = 0x0000,
-       COLUMN_COUNT_CALC               = 0x007f,
+       COLUMN_COUNT_CALC               = VALUE_IS_CALC,
        COLUMN_COUNT_SET                = 0x0080
 };
 
@@ -211,7 +213,7 @@ enum op_column_fill {
 
 enum op_column_gap {
        COLUMN_GAP_NORMAL               = 0x0000,
-       COLUMN_GAP_CALC                 = 0x007f,
+       COLUMN_GAP_CALC                 = VALUE_IS_CALC,
        COLUMN_GAP_SET                  = 0x0080
 };
 
@@ -249,7 +251,7 @@ enum op_column_span {
 
 enum op_column_width {
        COLUMN_WIDTH_AUTO               = 0x0000,
-       COLUMN_WIDTH_CALC               = 0x007f,
+       COLUMN_WIDTH_CALC               = VALUE_IS_CALC,
        COLUMN_WIDTH_SET                = 0x0080
 };
 
@@ -360,7 +362,7 @@ enum op_empty_cells {
 enum op_flex_basis {
        FLEX_BASIS_AUTO                 = 0x0000,
        FLEX_BASIS_CONTENT              = 0x0001,
-       FLEX_BASIS_CALC                 = 0x007f,
+       FLEX_BASIS_CALC                 = VALUE_IS_CALC,
        FLEX_BASIS_SET                  = 0x0080
 };
 
@@ -372,12 +374,12 @@ enum op_flex_direction {
 };
 
 enum op_flex_grow {
-       FLEX_GROW_CALC                  = 0x007f,
+       FLEX_GROW_CALC                  = VALUE_IS_CALC,
        FLEX_GROW_SET                   = 0x0080
 };
 
 enum op_flex_shrink {
-       FLEX_SHRINK_CALC                = 0x007f,
+       FLEX_SHRINK_CALC                = VALUE_IS_CALC,
        FLEX_SHRINK_SET                 = 0x0080
 };
 
@@ -407,7 +409,7 @@ enum op_font_family {
 };
 
 enum op_font_size {
-       FONT_SIZE_CALC                  = 0x007f,
+       FONT_SIZE_CALC                  = VALUE_IS_CALC,
        FONT_SIZE_DIMENSION             = 0x0080,
 
        FONT_SIZE_XX_SMALL              = 0x0000,
@@ -449,7 +451,7 @@ enum op_font_weight {
 };
 
 enum op_height {
-       HEIGHT_CALC                     = 0x007f,
+       HEIGHT_CALC                     = VALUE_IS_CALC,
        HEIGHT_SET                      = 0x0080,
        HEIGHT_AUTO                     = 0x0000
 };
@@ -470,13 +472,13 @@ enum op_left {
 };
 
 enum op_letter_spacing {
-       LETTER_SPACING_CALC             = 0x007f,
+       LETTER_SPACING_CALC             = VALUE_IS_CALC,
        LETTER_SPACING_SET              = 0x0080,
        LETTER_SPACING_NORMAL           = 0x0000
 };
 
 enum op_line_height {
-       LINE_HEIGHT_CALC                = 0x007f,
+       LINE_HEIGHT_CALC                = VALUE_IS_CALC,
        LINE_HEIGHT_NUMBER              = 0x0080,
        LINE_HEIGHT_DIMENSION           = 0x0081,
        LINE_HEIGHT_NORMAL              = 0x0000
@@ -548,31 +550,31 @@ enum op_list_style_type {
 };
 
 enum op_margin {
-       MARGIN_CALC                     = 0x007f,
+       MARGIN_CALC                     = VALUE_IS_CALC,
        MARGIN_SET                      = 0x0080,
        MARGIN_AUTO                     = 0x0000
 };
 
 enum op_max_height {
-       MAX_HEIGHT_CALC                 = 0x007f,
+       MAX_HEIGHT_CALC                 = VALUE_IS_CALC,
        MAX_HEIGHT_SET                  = 0x0080,
        MAX_HEIGHT_NONE                 = 0x0000
 };
 
 enum op_max_width {
-       MAX_WIDTH_CALC                  = 0x007f,
+       MAX_WIDTH_CALC                  = VALUE_IS_CALC,
        MAX_WIDTH_SET                   = 0x0080,
        MAX_WIDTH_NONE                  = 0x0000
 };
 
 enum op_min_height {
-       MIN_HEIGHT_CALC                 = 0x007f,
+       MIN_HEIGHT_CALC                 = VALUE_IS_CALC,
        MIN_HEIGHT_SET                  = 0x0080,
        MIN_HEIGHT_AUTO                 = 0x0000
 };
 
 enum op_min_width {
-       MIN_WIDTH_CALC                  = 0x007f,
+       MIN_WIDTH_CALC                  = VALUE_IS_CALC,
        MIN_WIDTH_SET                   = 0x0080,
        MIN_WIDTH_AUTO                  = 0x0000
 };
@@ -582,12 +584,12 @@ enum op_opacity {
 };
 
 enum op_order {
-       ORDER_CALC                      = 0x007f,
+       ORDER_CALC                      = VALUE_IS_CALC,
        ORDER_SET                       = 0x0080
 };
 
 enum op_orphans {
-       ORPHANS_CALC                    = 0x007f,
+       ORPHANS_CALC                    = VALUE_IS_CALC,
        ORPHANS_SET                     = 0x0080
 };
 
@@ -626,7 +628,7 @@ enum op_overflow {
 };
 
 enum op_padding {
-       PADDING_CALC                    = 0x007f,
+       PADDING_CALC                    = VALUE_IS_CALC,
        PADDING_SET                     = 0x0080
 };
 
@@ -652,22 +654,22 @@ enum op_page_break_inside {
 };
 
 enum op_pause_after {
-       PAUSE_AFTER_CALC                = 0x007f,
+       PAUSE_AFTER_CALC                = VALUE_IS_CALC,
        PAUSE_AFTER_SET                 = 0x0080
 };
 
 enum op_pause_before {
-       PAUSE_BEFORE_CALC               = 0x007f,
+       PAUSE_BEFORE_CALC               = VALUE_IS_CALC,
        PAUSE_BEFORE_SET                = 0x0080
 };
 
 enum op_pitch_range {
-       PITCH_RANGE_CALC                = 0x007f,
+       PITCH_RANGE_CALC                = VALUE_IS_CALC,
        PITCH_RANGE_SET                 = 0x0080
 };
 
 enum op_pitch {
-       PITCH_CALC                      = 0x007f,
+       PITCH_CALC                      = VALUE_IS_CALC,
        PITCH_FREQUENCY                 = 0x0080,
 
        PITCH_X_LOW                     = 0x0000,
@@ -702,7 +704,7 @@ enum op_quotes {
 };
 
 enum op_richness {
-       RICHNESS_CALC                   = 0x007f,
+       RICHNESS_CALC                   = VALUE_IS_CALC,
        RICHNESS_SET                    = 0x0080
 };
 
@@ -733,7 +735,7 @@ enum op_speak {
 };
 
 enum op_speech_rate {
-       SPEECH_RATE_CALC                = 0x007f,
+       SPEECH_RATE_CALC                = VALUE_IS_CALC,
        SPEECH_RATE_SET                 = 0x0080,
 
        SPEECH_RATE_X_SLOW              = 0x0000,
@@ -746,7 +748,7 @@ enum op_speech_rate {
 };
 
 enum op_stress {
-       STRESS_CALC                     = 0x007f,
+       STRESS_CALC                     = VALUE_IS_CALC,
        STRESS_SET                      = 0x0080
 };
 
@@ -775,7 +777,7 @@ enum op_text_decoration {
 };
 
 enum op_text_indent {
-       TEXT_INDENT_CALC                = 0x007f,
+       TEXT_INDENT_CALC                = VALUE_IS_CALC,
        TEXT_INDENT_SET                 = 0x0080
 };
 
@@ -799,7 +801,7 @@ enum op_unicode_bidi {
 };
 
 enum op_vertical_align {
-       VERTICAL_ALIGN_CALC             = 0x007f,
+       VERTICAL_ALIGN_CALC             = VALUE_IS_CALC,
        VERTICAL_ALIGN_SET              = 0x0080,
 
        VERTICAL_ALIGN_BASELINE         = 0x0000,
@@ -830,7 +832,7 @@ enum op_voice_family {
 };
 
 enum op_volume {
-       VOLUME_CALC                     = 0x007f,
+       VOLUME_CALC                     = VALUE_IS_CALC,
        VOLUME_NUMBER                   = 0x0080,
        VOLUME_DIMENSION                = 0x0081,
 
@@ -851,19 +853,19 @@ enum op_white_space {
 };
 
 enum op_widows {
-       WIDOWS_CALC                     = 0x007f,
+       WIDOWS_CALC                     = VALUE_IS_CALC,
        WIDOWS_SET                      = 0x0080
 };
 
 enum op_width {
-       WIDTH_CALC                      = 0x007f,
+       WIDTH_CALC                      = VALUE_IS_CALC,
        WIDTH_SET                       = 0x0080,
 
        WIDTH_AUTO                      = 0x0000
 };
 
 enum op_word_spacing {
-       WORD_SPACING_CALC               = 0x007f,
+       WORD_SPACING_CALC               = VALUE_IS_CALC,
        WORD_SPACING_SET                = 0x0080,
 
        WORD_SPACING_NORMAL             = 0x0000
@@ -876,7 +878,7 @@ enum op_writing_mode {
 };
 
 enum op_z_index {
-       Z_INDEX_CALC                    = 0x007f,
+       Z_INDEX_CALC                    = VALUE_IS_CALC,
        Z_INDEX_SET                     = 0x0080,
 
        Z_INDEX_AUTO                    = 0x0000


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=8a1f5b2a29ceecf6202ad0635f15b36662d2275b
commit 8a1f5b2a29ceecf6202ad0635f15b36662d2275b
Author: Daniel Silverstone <[email protected]>
Commit: Michael Drake <[email protected]>

    parse: Tests and fixes for calc() parser.
    
    Co-authored-by: Michael Drake <[email protected]>

diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 7c21d50..e845170 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -35,12 +35,13 @@ enum flag {
 };
 
 enum calc_opcodes {
-       CALC_PUSH_VALUE = 'V',
-       CALC_ADD        = '+',
-       CALC_SUBTRACT   = '-',
-       CALC_MULTIPLY   = '*',
-       CALC_DIVIDE     = '/',
-       CALC_FINISH     = '=',
+       CALC_PUSH_NUMBER = 'N',
+       CALC_PUSH_VALUE  = 'V',
+       CALC_ADD         = '+',
+       CALC_SUBTRACT    = '-',
+       CALC_MULTIPLY    = '*',
+       CALC_DIVIDE      = '/',
+       CALC_FINISH      = '=',
 };
 
 typedef enum unit {
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 7f9d9d2..fe5ee6b 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1365,6 +1365,31 @@ css__parse_calc_sum(css_language *c,
                css_style *result);
 
 static css_error
+css__parse_calc_number(
+               const parserutils_vector *vector, int *ctx,
+               css_style *result)
+{
+       const css_token *token;
+       css_fixed num;
+       size_t consumed;
+
+       /* Consume the number token */
+       token = parserutils_vector_iterate(vector, ctx);
+       if (token == NULL || token->type != CSS_TOKEN_NUMBER) {
+               return CSS_INVALID;
+       }
+
+       num = css__number_from_string((const uint8_t 
*)lwc_string_data(token->idata),
+                               lwc_string_length(token->idata), false, 
&consumed);
+
+       if (consumed != lwc_string_length(token->idata)) {
+               return CSS_INVALID;
+       }
+
+       return css__stylesheet_style_vappend(result, 2, (css_code_t) 
CALC_PUSH_NUMBER, (css_code_t)num);
+}
+
+static css_error
 css__parse_calc_value(css_language *c,
                const parserutils_vector *vector, int *ctx,
                css_style *result)
@@ -1377,6 +1402,7 @@ css__parse_calc_value(css_language *c,
        token = parserutils_vector_peek(vector, *ctx);
        if (tokenIsChar(token, '(')) {
                parserutils_vector_iterate(vector, ctx);
+               consumeWhitespace(vector, ctx);
                error = css__parse_calc_sum(c, vector, ctx, result);
                if (error != CSS_OK) {
                        return error;
@@ -1389,7 +1415,12 @@ css__parse_calc_value(css_language *c,
                /* Consume the close-paren to complete this value */
                parserutils_vector_iterate(vector, ctx);
        } else switch (token->type) {
-       case CSS_TOKEN_NUMBER:    /* Fall through */
+       case CSS_TOKEN_NUMBER:
+               error = css__parse_calc_number(vector, ctx, result);
+               if (error != CSS_OK) {
+                       return error;
+               }
+               break;
        case CSS_TOKEN_DIMENSION: /* Fall through */
        case CSS_TOKEN_PERCENTAGE:
        {
@@ -1412,11 +1443,7 @@ css__parse_calc_value(css_language *c,
                break;
        }
 
-       token = parserutils_vector_peek(vector, *ctx);
-       while (token->type == CSS_TOKEN_S) {
-               parserutils_vector_iterate(vector, ctx);
-               token = parserutils_vector_peek(vector, *ctx);
-       }
+       consumeWhitespace(vector, ctx);
        return error;
 }
 
@@ -1462,14 +1489,15 @@ css__parse_calc_product(css_language *c,
                }
                /* Consume that * or / now */
                parserutils_vector_iterate(vector, ctx);
-               token = parserutils_vector_peek(vector, *ctx);
 
-               while (token->type == CSS_TOKEN_S) {
-                       parserutils_vector_iterate(vector, ctx);
-                       token = parserutils_vector_peek(vector, *ctx);
+               consumeWhitespace(vector, ctx);
+
+               if (multiplication) {
+                       /* parse another value */
+                       error = css__parse_calc_value(c, vector, ctx, result);
+               } else {
+                       error = css__parse_calc_number(vector, ctx, result);
                }
-               /* parse another value */
-               error = css__parse_calc_value(c, vector, ctx, result);
                if (error != CSS_OK)
                        break;
 
@@ -1516,12 +1544,7 @@ css__parse_calc_sum(css_language *c,
                }
                /* Consume that + or - now */
                parserutils_vector_iterate(vector, ctx);
-               token = parserutils_vector_peek(vector, *ctx);
-
-               while (token->type == CSS_TOKEN_S) {
-                       parserutils_vector_iterate(vector, ctx);
-                       token = parserutils_vector_peek(vector, *ctx);
-               }
+               consumeWhitespace(vector, ctx);
 
                /* parse another product */
                error = css__parse_calc_product(c, vector, ctx, result);
@@ -1547,17 +1570,14 @@ css_error css__parse_calc(css_language *c,
        css_error error = CSS_OK;
        css_style *calc_style = NULL;
 
+       consumeWhitespace(vector, ctx);
+
        token = parserutils_vector_peek(vector, *ctx);
        if (token == NULL) {
                *ctx = orig_ctx;
                return CSS_INVALID;
        }
 
-       while (token->type == CSS_TOKEN_S) {
-               parserutils_vector_iterate(vector, ctx);
-               token = parserutils_vector_peek(vector, *ctx);
-       }
-
        error = css__stylesheet_style_create(c->sheet, &calc_style);
        if (error != CSS_OK)
                goto cleanup;
@@ -1574,11 +1594,8 @@ css_error css__parse_calc(css_language *c,
        if (error != CSS_OK)
                goto cleanup;
 
+       consumeWhitespace(vector, ctx);
        token = parserutils_vector_peek(vector, *ctx);
-       while (token->type == CSS_TOKEN_S) {
-               parserutils_vector_iterate(vector, ctx);
-               token = parserutils_vector_peek(vector, *ctx);
-       }
        if (!tokenIsChar(token, ')')) {
                /* If we don't get a close-paren, give up now */
                error = CSS_INVALID;
diff --git a/test/data/parse2/calc.dat b/test/data/parse2/calc.dat
index 95abf6c..e9d176d 100644
--- a/test/data/parse2/calc.dat
+++ b/test/data/parse2/calc.dat
@@ -4,4 +4,154 @@
 #expected
 | *
 |  height: /* -> 0px */ calc(50vh 10px + =)
-#reset
\ No newline at end of file
+#reset
+
+#data
+* { line-height: calc(50vh + 10px)}
+#errors
+#expected
+| *
+|  line-height: /* -> 0any */ calc(50vh 10px + =)
+#reset
+
+#data
+* { line-height: calc( / 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { line-height: calc( + 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { line-height: calc(2 / 2px)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(50vh + 10px)}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(50vh 10px + =)
+#reset
+
+#data
+* { z-index: calc(2 * 3)}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(2 3 * =)
+#reset
+
+#data
+* { z-index: calc(50vh + 10px / 9)}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(50vh 10px 9 / + =)
+#reset
+
+#data
+* { z-index: calc(1 + 2 + 3 + 4)}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(1 2 + 3 + 4 + =)
+#reset
+
+#data
+* { z-index: calc(1 + 2 * 3 + 4)}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(1 2 3 * + 4 + =)
+#reset
+
+#data
+* { z-index: calc((1 + 2) * (3 + 4))}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(1 2 + 3 4 + * =)
+#reset
+
+#data
+* { z-index: calc(1 + 2}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc (1 + 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(1)}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(1 =)
+#reset
+
+#data
+* { z-index: calc()}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc((1 + 2)}
+#errors
+#expected
+| *
+#reset
+
+#data
+* { z-index: calc(((1 + 2)))}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(1 2 + =)
+#reset
+
+#data
+* { z-index: calc( ( ( 1 + 2 ) ) )}
+#errors
+#expected
+| *
+|  z-index: /* -> 0number */ calc(1 2 + =)
+#reset
+
+#data
+* { z-index: calc( ( 3 / ( 1 + 2 ) ) )}
+#errors
+#expected
+| *
+#reset
diff --git a/test/dump.h b/test/dump.h
index 054194a..a1fdd1f 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -834,6 +834,13 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t 
depth)
                                        *ptr += sprintf(*ptr, " ");
                                        break;
                                }
+                               case CALC_PUSH_NUMBER: {
+                                       css_fixed num = *((css_fixed 
*)bytecode);
+                                       ADVANCE(sizeof(num));
+                                       dump_number(num, ptr);
+                                       *ptr += sprintf(*ptr, " ");
+                                       break;
+                               }
                                default:
                                        *ptr += sprintf(*ptr, "??%d ", 
calc_opcode);
                                        break;


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=11b4249c8ed58468632e25b31ae7d4690f90d102
commit 11b4249c8ed58468632e25b31ae7d4690f90d102
Author: Daniel Silverstone <[email protected]>
Commit: Michael Drake <[email protected]>

    parse: calc() test and fixup.

diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index 92040b4..7c21d50 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -34,6 +34,14 @@ enum flag {
        FLAG_UNSET     = (FLAG_VALUE_UNSET   << 1),
 };
 
+enum calc_opcodes {
+       CALC_PUSH_VALUE = 'V',
+       CALC_ADD        = '+',
+       CALC_SUBTRACT   = '-',
+       CALC_MULTIPLY   = '*',
+       CALC_DIVIDE     = '/',
+       CALC_FINISH     = '=',
+};
 
 typedef enum unit {
        UNIT_LENGTH = (1u << 8),
@@ -128,6 +136,12 @@ static inline bool isInherit(css_code_t OPV)
        return getFlagValue(OPV) == FLAG_VALUE_INHERIT;
 }
 
+static inline bool isCalc(css_code_t OPV)
+{
+       /* Note, this relies on all _CALC values being the same ultimately */
+       return getValue(OPV) == 0x7f;
+}
+
 #endif
 
 
diff --git a/src/parse/properties/css_property_parser_gen.c 
b/src/parse/properties/css_property_parser_gen.c
index 1260f28..622ce16 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -330,7 +330,7 @@ void output_calc(FILE *outputf, struct keyval *parseid, 
struct keyval_list *kvli
                kind = ckv->key;
 
        fprintf(outputf,
-               "if ((token->type == CSS_TOKEN_IDENT) && "
+               "if ((token->type == CSS_TOKEN_FUNCTION) && "
                "(lwc_string_caseless_isequal(token->idata, c->strings[CALC], 
&match) == lwc_error_ok && match))"
                " {\n"
                "\t\terror = css__parse_calc(c, vector, ctx, result, 
buildOPV(%s, 0, %s), %s);\n"
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index cce9717..7f9d9d2 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1373,8 +1373,10 @@ css__parse_calc_value(css_language *c,
        int orig_ctx = *ctx;
        const css_token *token;
 
-       token = parserutils_vector_iterate(vector, ctx);
+       /* On entry, we are already pointing at the value to parse, so peek it 
*/
+       token = parserutils_vector_peek(vector, *ctx);
        if (tokenIsChar(token, '(')) {
+               parserutils_vector_iterate(vector, ctx);
                error = css__parse_calc_sum(c, vector, ctx, result);
                if (error != CSS_OK) {
                        return error;
@@ -1384,7 +1386,8 @@ css__parse_calc_value(css_language *c,
                if (!tokenIsChar(token, ')')) {
                        return CSS_INVALID;
                }
-
+               /* Consume the close-paren to complete this value */
+               parserutils_vector_iterate(vector, ctx);
        } else switch (token->type) {
        case CSS_TOKEN_NUMBER:    /* Fall through */
        case CSS_TOKEN_DIMENSION: /* Fall through */
@@ -1400,7 +1403,7 @@ css__parse_calc_value(css_language *c,
                        return error;
                }
 
-               error = css__stylesheet_style_vappend(result, 3, (css_code_t) 
'V', length, unit);
+               error = css__stylesheet_style_vappend(result, 3, (css_code_t) 
CALC_PUSH_VALUE, length, unit);
        }
                break;
 
@@ -1409,6 +1412,11 @@ css__parse_calc_value(css_language *c,
                break;
        }
 
+       token = parserutils_vector_peek(vector, *ctx);
+       while (token->type == CSS_TOKEN_S) {
+               parserutils_vector_iterate(vector, ctx);
+               token = parserutils_vector_peek(vector, *ctx);
+       }
        return error;
 }
 
@@ -1439,7 +1447,10 @@ css__parse_calc_product(css_language *c,
                if (token == NULL) {
                        error = CSS_INVALID;
                        break;
-               } else if (tokenIsChar(token, ')'))
+               } else if (
+                               tokenIsChar(token, ')') ||
+                               tokenIsChar(token, '+') ||
+                               tokenIsChar(token, '-'))
                        break;
                else if (tokenIsChar(token, '*'))
                        multiplication = true;
@@ -1450,15 +1461,21 @@ css__parse_calc_product(css_language *c,
                        break;
                }
                /* Consume that * or / now */
-               token = parserutils_vector_iterate(vector, ctx);
+               parserutils_vector_iterate(vector, ctx);
+               token = parserutils_vector_peek(vector, *ctx);
 
+               while (token->type == CSS_TOKEN_S) {
+                       parserutils_vector_iterate(vector, ctx);
+                       token = parserutils_vector_peek(vector, *ctx);
+               }
                /* parse another value */
                error = css__parse_calc_value(c, vector, ctx, result);
                if (error != CSS_OK)
                        break;
 
                /* emit the multiplication/division operator */
-               error = css__stylesheet_style_append(result, (css_code_t) 
(multiplication ? '*' : '/'));
+               error = css__stylesheet_style_append(result,
+                                       (css_code_t) (multiplication ? 
CALC_MULTIPLY : CALC_DIVIDE));
        } while (1);
        /* We've fallen off, either we had an error or we're left with ')' */
        return error;
@@ -1498,7 +1515,13 @@ css__parse_calc_sum(css_language *c,
                        break;
                }
                /* Consume that + or - now */
-               token = parserutils_vector_iterate(vector, ctx);
+               parserutils_vector_iterate(vector, ctx);
+               token = parserutils_vector_peek(vector, *ctx);
+
+               while (token->type == CSS_TOKEN_S) {
+                       parserutils_vector_iterate(vector, ctx);
+                       token = parserutils_vector_peek(vector, *ctx);
+               }
 
                /* parse another product */
                error = css__parse_calc_product(c, vector, ctx, result);
@@ -1506,7 +1529,7 @@ css__parse_calc_sum(css_language *c,
                        break;
 
                /* emit the addition/subtraction operator */
-               error = css__stylesheet_style_append(result, (css_code_t) 
(addition ? '+' : '-'));
+               error = css__stylesheet_style_append(result, (css_code_t) 
(addition ? CALC_ADD : CALC_SUBTRACT));
        } while (1);
        /* We've fallen off, either we had an error or we're left with ')' */
        return error;
@@ -1524,16 +1547,15 @@ css_error css__parse_calc(css_language *c,
        css_error error = CSS_OK;
        css_style *calc_style = NULL;
 
-       token = parserutils_vector_iterate(vector, ctx);
+       token = parserutils_vector_peek(vector, *ctx);
        if (token == NULL) {
                *ctx = orig_ctx;
                return CSS_INVALID;
        }
 
-       if (!tokenIsChar(token, '(')) {
-               /* If we don't get an open-paren, give up now */
-               *ctx = orig_ctx;
-               return CSS_INVALID;
+       while (token->type == CSS_TOKEN_S) {
+               parserutils_vector_iterate(vector, ctx);
+               token = parserutils_vector_peek(vector, *ctx);
        }
 
        error = css__stylesheet_style_create(c->sheet, &calc_style);
@@ -1545,27 +1567,33 @@ css_error css__parse_calc(css_language *c,
                goto cleanup;
        
        error = css__stylesheet_style_append(calc_style, (css_code_t) unit);
+       if (error != CSS_OK)
+               goto cleanup;
 
        error = css__parse_calc_sum(c, vector, ctx, calc_style);
        if (error != CSS_OK)
                goto cleanup;
 
-       token = parserutils_vector_iterate(vector, ctx);
+       token = parserutils_vector_peek(vector, *ctx);
+       while (token->type == CSS_TOKEN_S) {
+               parserutils_vector_iterate(vector, ctx);
+               token = parserutils_vector_peek(vector, *ctx);
+       }
        if (!tokenIsChar(token, ')')) {
                /* If we don't get a close-paren, give up now */
                error = CSS_INVALID;
                goto cleanup;
        }
 
+       /* Swallow that close paren */
+       parserutils_vector_iterate(vector, ctx);
+
        /* Append the indicator that the calc is finished */
-       error = css__stylesheet_style_append(calc_style, (css_code_t) '=');
+       error = css__stylesheet_style_append(calc_style, (css_code_t) 
CALC_FINISH);
        if (error != CSS_OK)
                goto cleanup;
 
-       /* TODO: Once we're OK to do so, merge the style */
-       (void)result;
-       /* error = css__stylesheet_style_merge_style(result, calc_style); */
-
+       error = css__stylesheet_merge_style(result, calc_style);
 cleanup:
        css__stylesheet_style_destroy(calc_style);
        if (error != CSS_OK) {
diff --git a/test/data/parse2/INDEX b/test/data/parse2/INDEX
index e4a369c..7bc4295 100644
--- a/test/data/parse2/INDEX
+++ b/test/data/parse2/INDEX
@@ -24,3 +24,4 @@ multicol.dat                  Multi-column layout property 
tests
 flexbox.dat                    Flexbox properties and shorthands tests
 units.dat                      Length unit tests
 dodgy-media-block.dat          Media block with incomplete ruleset
+calc.dat                       calc() tests
diff --git a/test/data/parse2/calc.dat b/test/data/parse2/calc.dat
new file mode 100644
index 0000000..95abf6c
--- /dev/null
+++ b/test/data/parse2/calc.dat
@@ -0,0 +1,7 @@
+#data
+* { height: calc(50vh + 10px)}
+#errors
+#expected
+| *
+|  height: /* -> 0px */ calc(50vh 10px + =)
+#reset
\ No newline at end of file
diff --git a/test/dump.h b/test/dump.h
index f585788..054194a 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -640,6 +640,12 @@ static void dump_unit(css_fixed val, uint32_t unit, char 
**ptr)
        case UNIT_KHZ:
                *ptr += sprintf(*ptr, "kHz");
                break;
+       case UNIT_CALC_ANY:
+               *ptr += sprintf(*ptr, "any");
+               break;
+       case UNIT_CALC_NUMBER:
+               *ptr += sprintf(*ptr, "number");
+               break;
        }
 }
 
@@ -796,6 +802,45 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t 
depth)
                        *ptr += sprintf(*ptr, "revert");
                } else if (getFlagValue(opv) == FLAG_VALUE_UNSET) {
                        *ptr += sprintf(*ptr, "unset");
+               } else if (isCalc(opv)) {
+                       /* First entry is a unit */
+                       uint32_t unit = *((uint32_t *)bytecode);
+                       ADVANCE(sizeof(unit));
+                       *ptr += sprintf(*ptr, "/* -> ");
+                       dump_unit(0, unit, ptr);
+                       *ptr += sprintf(*ptr, " */ calc(");
+                       css_code_t calc_opcode;
+                       while ((calc_opcode = *((css_code_t *)bytecode)) != 
CALC_FINISH) {
+                               ADVANCE(sizeof(calc_opcode));
+                               switch (calc_opcode) {
+                               case CALC_ADD:
+                                       *ptr += sprintf(*ptr, "+ ");
+                                       break;
+                               case CALC_SUBTRACT:
+                                       *ptr += sprintf(*ptr, "- ");
+                                       break;
+                               case CALC_MULTIPLY:
+                                       *ptr += sprintf(*ptr, "* ");
+                                       break;
+                               case CALC_DIVIDE:
+                                       *ptr += sprintf(*ptr, "/ ");
+                                       break;
+                               case CALC_PUSH_VALUE: {
+                                       css_fixed num = *((css_fixed 
*)bytecode);
+                                       ADVANCE(sizeof(num));
+                                       uint32_t unit = *((uint32_t *)bytecode);
+                                       ADVANCE(sizeof(unit));
+                                       dump_unit(num, unit, ptr);
+                                       *ptr += sprintf(*ptr, " ");
+                                       break;
+                               }
+                               default:
+                                       *ptr += sprintf(*ptr, "??%d ", 
calc_opcode);
+                                       break;
+                               }
+                       }
+                       ADVANCE(sizeof(calc_opcode));
+                       *ptr += sprintf(*ptr, "=)");
                } else {
                        value = getValue(opv);
 


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=6afa3f74544d124d5c76688701373beb1b554216
commit 6afa3f74544d124d5c76688701373beb1b554216
Author: Michael Drake <Michael Drake [email protected]>
Commit: Michael Drake <[email protected]>

    parse: Update parser generator to support calc() details.
    
    Co-authored-by: Daniel Silverstone <[email protected]>

diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h
index ccfdcac..92040b4 100644
--- a/src/bytecode/bytecode.h
+++ b/src/bytecode/bytecode.h
@@ -76,6 +76,10 @@ typedef enum unit {
        UNIT_DPI  = (1 << 13) + 0,
        UNIT_DPCM = (1 << 13) + 1,
        UNIT_DPPX = (1 << 13) + 2,
+
+       /* These are special only to the CALC bytecodes */
+       UNIT_CALC_ANY = (1 << 20),
+       UNIT_CALC_NUMBER = (1 << 20) + 1,
 } unit;
 
 typedef uint32_t colour;
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index 8bc05b4..0ff67bb 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -119,6 +119,7 @@ enum op_border_style {
 };
 
 enum op_border_width {
+       BORDER_WIDTH_CALC               = 0x007f,
        BORDER_WIDTH_SET                = 0x0080,
        BORDER_WIDTH_THIN               = 0x0000,
        BORDER_WIDTH_MEDIUM             = 0x0001,
@@ -126,6 +127,7 @@ enum op_border_width {
 };
 
 enum op_bottom {
+       BOTTOM_CALC                     = 0x007f,
        BOTTOM_SET                      = 0x0080,
        BOTTOM_AUTO                     = 0x0000
 };
@@ -198,6 +200,7 @@ enum op_color {
 
 enum op_column_count {
        COLUMN_COUNT_AUTO               = 0x0000,
+       COLUMN_COUNT_CALC               = 0x007f,
        COLUMN_COUNT_SET                = 0x0080
 };
 
@@ -208,6 +211,7 @@ enum op_column_fill {
 
 enum op_column_gap {
        COLUMN_GAP_NORMAL               = 0x0000,
+       COLUMN_GAP_CALC                 = 0x007f,
        COLUMN_GAP_SET                  = 0x0080
 };
 
@@ -231,6 +235,7 @@ enum op_column_rule_style {
 };
 
 enum op_column_rule_width {
+       COLUMN_RULE_WIDTH_CALC          = BORDER_WIDTH_CALC,
        COLUMN_RULE_WIDTH_SET           = BORDER_WIDTH_SET,
        COLUMN_RULE_WIDTH_THIN          = BORDER_WIDTH_THIN,
        COLUMN_RULE_WIDTH_MEDIUM        = BORDER_WIDTH_MEDIUM,
@@ -244,6 +249,7 @@ enum op_column_span {
 
 enum op_column_width {
        COLUMN_WIDTH_AUTO               = 0x0000,
+       COLUMN_WIDTH_CALC               = 0x007f,
        COLUMN_WIDTH_SET                = 0x0080
 };
 
@@ -354,6 +360,7 @@ enum op_empty_cells {
 enum op_flex_basis {
        FLEX_BASIS_AUTO                 = 0x0000,
        FLEX_BASIS_CONTENT              = 0x0001,
+       FLEX_BASIS_CALC                 = 0x007f,
        FLEX_BASIS_SET                  = 0x0080
 };
 
@@ -365,10 +372,12 @@ enum op_flex_direction {
 };
 
 enum op_flex_grow {
+       FLEX_GROW_CALC                  = 0x007f,
        FLEX_GROW_SET                   = 0x0080
 };
 
 enum op_flex_shrink {
+       FLEX_SHRINK_CALC                = 0x007f,
        FLEX_SHRINK_SET                 = 0x0080
 };
 
@@ -398,6 +407,7 @@ enum op_font_family {
 };
 
 enum op_font_size {
+       FONT_SIZE_CALC                  = 0x007f,
        FONT_SIZE_DIMENSION             = 0x0080,
 
        FONT_SIZE_XX_SMALL              = 0x0000,
@@ -439,6 +449,7 @@ enum op_font_weight {
 };
 
 enum op_height {
+       HEIGHT_CALC                     = 0x007f,
        HEIGHT_SET                      = 0x0080,
        HEIGHT_AUTO                     = 0x0000
 };
@@ -453,16 +464,19 @@ enum op_justify_content {
 };
 
 enum op_left {
+       LEFT_CALC                       = BOTTOM_CALC,
        LEFT_SET                        = BOTTOM_SET,
        LEFT_AUTO                       = BOTTOM_AUTO
 };
 
 enum op_letter_spacing {
+       LETTER_SPACING_CALC             = 0x007f,
        LETTER_SPACING_SET              = 0x0080,
        LETTER_SPACING_NORMAL           = 0x0000
 };
 
 enum op_line_height {
+       LINE_HEIGHT_CALC                = 0x007f,
        LINE_HEIGHT_NUMBER              = 0x0080,
        LINE_HEIGHT_DIMENSION           = 0x0081,
        LINE_HEIGHT_NORMAL              = 0x0000
@@ -534,26 +548,31 @@ enum op_list_style_type {
 };
 
 enum op_margin {
+       MARGIN_CALC                     = 0x007f,
        MARGIN_SET                      = 0x0080,
        MARGIN_AUTO                     = 0x0000
 };
 
 enum op_max_height {
+       MAX_HEIGHT_CALC                 = 0x007f,
        MAX_HEIGHT_SET                  = 0x0080,
        MAX_HEIGHT_NONE                 = 0x0000
 };
 
 enum op_max_width {
+       MAX_WIDTH_CALC                  = 0x007f,
        MAX_WIDTH_SET                   = 0x0080,
        MAX_WIDTH_NONE                  = 0x0000
 };
 
 enum op_min_height {
+       MIN_HEIGHT_CALC                 = 0x007f,
        MIN_HEIGHT_SET                  = 0x0080,
        MIN_HEIGHT_AUTO                 = 0x0000
 };
 
 enum op_min_width {
+       MIN_WIDTH_CALC                  = 0x007f,
        MIN_WIDTH_SET                   = 0x0080,
        MIN_WIDTH_AUTO                  = 0x0000
 };
@@ -563,10 +582,12 @@ enum op_opacity {
 };
 
 enum op_order {
+       ORDER_CALC                      = 0x007f,
        ORDER_SET                       = 0x0080
 };
 
 enum op_orphans {
+       ORPHANS_CALC                    = 0x007f,
        ORPHANS_SET                     = 0x0080
 };
 
@@ -605,6 +626,7 @@ enum op_overflow {
 };
 
 enum op_padding {
+       PADDING_CALC                    = 0x007f,
        PADDING_SET                     = 0x0080
 };
 
@@ -630,18 +652,22 @@ enum op_page_break_inside {
 };
 
 enum op_pause_after {
+       PAUSE_AFTER_CALC                = 0x007f,
        PAUSE_AFTER_SET                 = 0x0080
 };
 
 enum op_pause_before {
+       PAUSE_BEFORE_CALC               = 0x007f,
        PAUSE_BEFORE_SET                = 0x0080
 };
 
 enum op_pitch_range {
+       PITCH_RANGE_CALC                = 0x007f,
        PITCH_RANGE_SET                 = 0x0080
 };
 
 enum op_pitch {
+       PITCH_CALC                      = 0x007f,
        PITCH_FREQUENCY                 = 0x0080,
 
        PITCH_X_LOW                     = 0x0000,
@@ -676,6 +702,7 @@ enum op_quotes {
 };
 
 enum op_richness {
+       RICHNESS_CALC                   = 0x007f,
        RICHNESS_SET                    = 0x0080
 };
 
@@ -706,6 +733,7 @@ enum op_speak {
 };
 
 enum op_speech_rate {
+       SPEECH_RATE_CALC                = 0x007f,
        SPEECH_RATE_SET                 = 0x0080,
 
        SPEECH_RATE_X_SLOW              = 0x0000,
@@ -718,6 +746,7 @@ enum op_speech_rate {
 };
 
 enum op_stress {
+       STRESS_CALC                     = 0x007f,
        STRESS_SET                      = 0x0080
 };
 
@@ -746,6 +775,7 @@ enum op_text_decoration {
 };
 
 enum op_text_indent {
+       TEXT_INDENT_CALC                = 0x007f,
        TEXT_INDENT_SET                 = 0x0080
 };
 
@@ -757,6 +787,7 @@ enum op_text_transform {
 };
 
 enum op_top {
+       TOP_CALC                        = BOTTOM_CALC,
        TOP_SET                         = BOTTOM_SET,
        TOP_AUTO                        = BOTTOM_AUTO
 };
@@ -768,6 +799,7 @@ enum op_unicode_bidi {
 };
 
 enum op_vertical_align {
+       VERTICAL_ALIGN_CALC             = 0x007f,
        VERTICAL_ALIGN_SET              = 0x0080,
 
        VERTICAL_ALIGN_BASELINE         = 0x0000,
@@ -798,6 +830,7 @@ enum op_voice_family {
 };
 
 enum op_volume {
+       VOLUME_CALC                     = 0x007f,
        VOLUME_NUMBER                   = 0x0080,
        VOLUME_DIMENSION                = 0x0081,
 
@@ -818,16 +851,19 @@ enum op_white_space {
 };
 
 enum op_widows {
+       WIDOWS_CALC                     = 0x007f,
        WIDOWS_SET                      = 0x0080
 };
 
 enum op_width {
+       WIDTH_CALC                      = 0x007f,
        WIDTH_SET                       = 0x0080,
 
        WIDTH_AUTO                      = 0x0000
 };
 
 enum op_word_spacing {
+       WORD_SPACING_CALC               = 0x007f,
        WORD_SPACING_SET                = 0x0080,
 
        WORD_SPACING_NORMAL             = 0x0000
@@ -840,6 +876,7 @@ enum op_writing_mode {
 };
 
 enum op_z_index {
+       Z_INDEX_CALC                    = 0x007f,
        Z_INDEX_SET                     = 0x0080,
 
        Z_INDEX_AUTO                    = 0x0000
diff --git a/src/parse/properties/css_property_parser_gen.c 
b/src/parse/properties/css_property_parser_gen.c
index 100fba1..1260f28 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -19,6 +19,12 @@
  * list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: 
INSIDE:0,LIST_STYLE_POSITION_INSIDE OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE 
IDENT:)
 */
 
+typedef enum {
+       CALC_ANY,
+       CALC_NUMBER,
+       CALC_UNIT,
+} calc_kind;
+
 struct keyval {
        char *key;
        char *val;
@@ -311,21 +317,34 @@ void output_color(FILE *outputf, struct keyval *parseid, 
struct keyval_list *kvl
                parseid->val);
 }
 
-void output_length_unit(FILE *outputf, struct keyval *parseid, struct 
keyval_list *kvlist)
+void output_calc(FILE *outputf, struct keyval *parseid, struct keyval_list 
*kvlist)
 {
        struct keyval *ckv = kvlist->item[0];
-       int ident_count;
+       const char *kind;
+
+       if (strcmp(ckv->key, "NUMBER") == 0)
+               kind = "UNIT_CALC_NUMBER";
+       else if (strcmp(ckv->key, "ANY") == 0)
+               kind = "UNIT_CALC_ANY";
+       else
+               kind = ckv->key;
 
        fprintf(outputf,
                "if ((token->type == CSS_TOKEN_IDENT) && "
                "(lwc_string_caseless_isequal(token->idata, c->strings[CALC], 
&match) == lwc_error_ok && match))"
                " {\n"
-               "\t\terror = css__parse_calc(c, vector, ctx, result, 
buildOPV(%s, 0, %s /* _CALC */), %s);\n"
+               "\t\terror = css__parse_calc(c, vector, ctx, result, 
buildOPV(%s, 0, %s), %s);\n"
                "\t} else ",
                parseid->val,
                ckv->val,
-               ckv->key
+               kind
        );
+}
+
+void output_length_unit(FILE *outputf, struct keyval *parseid, struct 
keyval_list *kvlist)
+{
+       struct keyval *ckv = kvlist->item[0];
+       int ident_count;
 
        fprintf(outputf,
                "{\n"
@@ -533,6 +552,7 @@ int main(int argc, char **argv)
        struct keyval_list WRAP;
        struct keyval_list NUMBER;
        struct keyval_list COLOR;
+       struct keyval_list CALC;
 
 
        if (argc < 2) {
@@ -565,6 +585,7 @@ int main(int argc, char **argv)
        COLOR.count = 0;
        LENGTH_UNIT.count = 0;
        IDENT_LIST.count = 0;
+       CALC.count = 0;
 
        curlist = &base;
 
@@ -580,7 +601,7 @@ int main(int argc, char **argv)
                if (strcmp(rkv->key, "WRAP") == 0) {
                        WRAP.item[WRAP.count++] = rkv;
                        only_ident = false;
-               } else if (strcmp(rkv->key, "NUMBER") == 0) {
+               } else if (curlist == &base && strcmp(rkv->key, "NUMBER") == 0) 
{
                        if (rkv->val[0] == '(') {
                                curlist = &NUMBER;
                        } else if (rkv->val[0] == ')') {
@@ -617,6 +638,14 @@ int main(int argc, char **argv)
                        }
                        only_ident = false;
                        do_token_check = false;
+               } else if (strcmp(rkv->key, "CALC") == 0) {
+                       if (rkv->val[0] == '(') {
+                               curlist = &CALC;
+                       } else if (rkv->val[0] == ')') {
+                               curlist = &base;
+                       }
+                       only_ident = false;
+                       do_token_check = false;
                } else if (strcmp(rkv->key, "COLOR") == 0) {
                        COLOR.item[COLOR.count++] = rkv;
                        do_token_check = false;
@@ -640,7 +669,7 @@ int main(int argc, char **argv)
 
 
        /* header */
-output_header(outputf, descriptor, base.item[0], is_generic);
+       output_header(outputf, descriptor, base.item[0], is_generic);
 
        if (WRAP.count > 0) {
                output_wrap(outputf, base.item[0], &WRAP);
@@ -654,6 +683,10 @@ output_header(outputf, descriptor, base.item[0], 
is_generic);
                if (URI.count > 0)
                        output_uri(outputf, base.item[0], &URI);
 
+               if (CALC.count > 0) {
+                       output_calc(outputf, base.item[0], &CALC);
+               }
+
                if (NUMBER.count > 0)
                        output_number(outputf, base.item[0], &NUMBER);
 
diff --git a/src/parse/properties/properties.gen 
b/src/parse/properties/properties.gen
index b0e797c..3452f81 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -6,6 +6,13 @@
 #property:CSS_PROP_ENUM IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY ALLOW: DISALLOW: RANGE:<0 LENGTH_UNIT:)
 #property:CSS_PROP_ENUM WRAP:
 
+# When a property takes a NUMBER and/or LENGTH_UNIT you may add calc() support:
+# In the below, PROPERTY_FOO_CALC is the opcode enum for the 
set-but-calculated value bytecode.
+# e.g. HEIGHT_SET (for a LENGTH_UNIT) would be HEIGHT_CALC here.
+# CALC:( UNIT_??:PROPERTY_FOO_CALC CALC:)  <-- When a default unit must be 
considered
+# CALC:( NUMBER:PROPERTY_FOO_CALC CALC:)   <-- When a number must be produced 
(not a dimension)
+# CALC:( ANY:PROPERTY_FOO_CALC CALC:)      <-- When a number or dimension is 
valid (e.g. line-height)
+
 background_repeat:CSS_PROP_BACKGROUND_REPEAT IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: NO_REPEAT:0,BACKGROUND_REPEAT_NO_REPEAT 
REPEAT_X:0,BACKGROUND_REPEAT_REPEAT_X REPEAT_Y:0,BACKGROUND_REPEAT_REPEAT_Y 
REPEAT:0,BACKGROUND_REPEAT_REPEAT IDENT:)
 
 border_collapse:CSS_PROP_BORDER_COLLAPSE IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: COLLAPSE:0,BORDER_COLLAPSE_COLLAPSE SEPARATE:0,BORDER_COLLAPSE_SEPARATE 
IDENT:)
@@ -22,35 +29,35 @@ empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: INITIAL: 
REVERT: UNSET: SHOW:0
 
 float:CSS_PROP_FLOAT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
LEFT:0,FLOAT_LEFT RIGHT:0,FLOAT_RIGHT NONE:0,FLOAT_NONE IDENT:)
 
-font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL 
SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE 
X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE 
LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( 
UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:)
+font_size:CSS_PROP_FONT_SIZE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
XX_SMALL:0,FONT_SIZE_XX_SMALL X_SMALL:0,FONT_SIZE_X_SMALL 
SMALL:0,FONT_SIZE_SMALL MEDIUM:0,FONT_SIZE_MEDIUM LARGE:0,FONT_SIZE_LARGE 
X_LARGE:0,FONT_SIZE_X_LARGE XX_LARGE:0,FONT_SIZE_XX_LARGE 
LARGER:0,FONT_SIZE_LARGER SMALLER:0,FONT_SIZE_SMALLER IDENT:) LENGTH_UNIT:( 
UNIT_PX:FONT_SIZE_DIMENSION MASK:UNIT_MASK_FONT_SIZE RANGE:<0 LENGTH_UNIT:) 
CALC:( UNIT_PX:FONT_SIZE_CALC CALC:)
 
 font_style:CSS_PROP_FONT_STYLE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,FONT_STYLE_NORMAL ITALIC:0,FONT_STYLE_ITALIC 
OBLIQUE:0,FONT_STYLE_OBLIQUE IDENT:)
 
 font_variant:CSS_PROP_FONT_VARIANT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,FONT_VARIANT_NORMAL SMALL_CAPS:0,FONT_VARIANT_SMALL_CAPS IDENT:)
 
-height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET 
MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:)
+height:CSS_PROP_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:HEIGHT_SET 
MASK:UNIT_MASK_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:HEIGHT_CALC CALC:)
 
-letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( 
UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:)
+letter_spacing:CSS_PROP_LETTER_SPACING IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: NORMAL:0,LETTER_SPACING_NORMAL IDENT:) LENGTH_UNIT:( 
UNIT_PX:LETTER_SPACING_SET MASK:UNIT_MASK_LETTER_SPACING LENGTH_UNIT:) CALC:( 
UNIT_PX:LETTER_SPACING_CALC CALC:)
 
-line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER 
RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION 
MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:)
+line_height:CSS_PROP_LINE_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,LINE_HEIGHT_NORMAL IDENT:) NUMBER:( false:LINE_HEIGHT_NUMBER 
RANGE:num<0 NUMBER:) LENGTH_UNIT:( UNIT_PX:LINE_HEIGHT_DIMENSION 
MASK:UNIT_MASK_LINE_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( ANY:LINE_HEIGHT_CALC 
CALC:)
 
 border_top:BORDER_SIDE_TOP WRAP:css__parse_border_side
 border_bottom:BORDER_SIDE_BOTTOM WRAP:css__parse_border_side
 border_left:BORDER_SIDE_LEFT WRAP:css__parse_border_side
 border_right:BORDER_SIDE_RIGHT WRAP:css__parse_border_side
 
-max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET 
MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:)
+max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NONE:0,MAX_HEIGHT_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_HEIGHT_SET 
MASK:UNIT_MASK_MAX_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MAX_HEIGHT_CALC 
CALC:)
 
-max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET 
MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:)
+max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET 
MASK:UNIT_MASK_MAX_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MAX_WIDTH_CALC 
CALC:)
 
-min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET 
MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET 
MASK:UNIT_MASK_MIN_HEIGHT RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MIN_HEIGHT_CALC 
CALC:)
 
-min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET 
MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET 
MASK:UNIT_MASK_MIN_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:MIN_WIDTH_CALC 
CALC:)
 
 color:CSS_PROP_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
COLOR:COLOR_SET
 
 #generic for padding_{top, bottom, left, right}.c
-padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 
LENGTH_UNIT:)
+padding_side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
LENGTH_UNIT:( UNIT_PX:PADDING_SET MASK:UNIT_MASK_PADDING_SIDE RANGE:<0 
LENGTH_UNIT:) CALC:( UNIT_PX:PADDING_CALC CALC:)
 
 padding_bottom:CSS_PROP_PADDING_BOTTOM WRAP:css__parse_padding_side
 padding_left:CSS_PROP_PADDING_LEFT WRAP:css__parse_padding_side
@@ -59,7 +66,7 @@ padding_right:CSS_PROP_PADDING_RIGHT 
WRAP:css__parse_padding_side
 
 
 #generic for margin_{top, bottom, left, right}.c
-margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET 
MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:)
+margin_side:op GENERIC IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,MARGIN_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MARGIN_SET 
MASK:UNIT_MASK_MARGIN_SIDE LENGTH_UNIT:) CALC:( UNIT_PX:MARGIN_CALC CALC:)
 
 margin_top:CSS_PROP_MARGIN_TOP WRAP:css__parse_margin_side
 margin_bottom:CSS_PROP_MARGIN_BOTTOM WRAP:css__parse_margin_side
@@ -67,7 +74,7 @@ margin_left:CSS_PROP_MARGIN_LEFT WRAP:css__parse_margin_side
 margin_right:CSS_PROP_MARGIN_RIGHT WRAP:css__parse_margin_side
 
 #generic for {top, bottom, left, right}.c
-side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO 
IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) 
LENGTH_UNIT:)
+side:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: AUTO:0,BOTTOM_AUTO 
IDENT:) LENGTH_UNIT:( UNIT_PX:BOTTOM_SET ALLOW:unit&(UNIT_LENGTH|UNIT_PCT) 
LENGTH_UNIT:) CALC:( UNIT_PX:BOTTOM_CALC CALC:)
 
 top:CSS_PROP_TOP WRAP:css__parse_side
 bottom:CSS_PROP_BOTTOM WRAP:css__parse_side
@@ -76,7 +83,7 @@ right:CSS_PROP_RIGHT WRAP:css__parse_side
 
 
 #generic for border_{top, bottom, left, right}_width.c
-border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM 
THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET 
MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:)
+border_side_width:op GENERIC: IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
THIN:0,BORDER_WIDTH_THIN MEDIUM:0,BORDER_WIDTH_MEDIUM 
THICK:0,BORDER_WIDTH_THICK IDENT:) LENGTH_UNIT:( UNIT_PX:BORDER_WIDTH_SET 
MASK:UNIT_MASK_BORDER_SIDE_WIDTH RANGE:<0 LENGTH_UNIT:) CALC:( 
UNIT_PX:BORDER_WIDTH_CALC CALC:)
 
 border_top_width:CSS_PROP_BORDER_TOP_WIDTH WRAP:css__parse_border_side_width
 border_bottom_width:CSS_PROP_BORDER_BOTTOM_WIDTH 
WRAP:css__parse_border_side_width
@@ -120,7 +127,7 @@ list_style_image:CSS_PROP_LIST_STYLE_IMAGE IDENT:( INHERIT: 
INITIAL: REVERT: UNS
 
 list_style_position:CSS_PROP_LIST_STYLE_POSITION IDENT:( INHERIT: INITIAL: 
REVERT: UNSET: INSIDE:0,LIST_STYLE_POSITION_INSIDE 
OUTSIDE:0,LIST_STYLE_POSITION_OUTSIDE IDENT:)
 
-orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:)
+orphans:CSS_PROP_ORPHANS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( true:ORPHANS_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:ORPHANS_CALC CALC:)
 
 outline_color:CSS_PROP_OUTLINE_COLOR IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
INVERT:0,OUTLINE_COLOR_INVERT IDENT:) COLOR:OUTLINE_COLOR_SET
 
@@ -133,24 +140,23 @@ overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: INITIAL: 
REVERT: UNSET: VISIBLE:
 
 overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL 
AUTO:0,OVERFLOW_AUTO  IDENT:)
 
-
 page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS 
AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT 
RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:)
 
 page_break_before:CSS_PROP_PAGE_BREAK_BEFORE IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: AUTO:0,PAGE_BREAK_BEFORE_AUTO ALWAYS:0,PAGE_BREAK_BEFORE_ALWAYS 
AVOID:0,PAGE_BREAK_BEFORE_AVOID LEFT:0,PAGE_BREAK_BEFORE_LEFT 
RIGHT:0,PAGE_BREAK_BEFORE_RIGHT IDENT:)
 
 page_break_inside:CSS_PROP_PAGE_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: AUTO:0,PAGE_BREAK_INSIDE_AUTO AVOID:0,PAGE_BREAK_INSIDE_AVOID IDENT:)
 
-pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER 
RANGE:<0 LENGTH_UNIT:)
+pause_after:CSS_PROP_PAUSE_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_AFTER_SET MASK:UNIT_MASK_PAUSE_AFTER 
RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_S:PAUSE_AFTER_CALC CALC:)
 
-pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE 
RANGE:<0 LENGTH_UNIT:)
+pause_before:CSS_PROP_PAUSE_BEFORE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) LENGTH_UNIT:( UNIT_S:PAUSE_BEFORE_SET MASK:UNIT_MASK_PAUSE_BEFORE 
RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_S:PAUSE_BEFORE_CALC CALC:)
 
-pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH 
X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY 
MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:)
+pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
X_LOW:0,PITCH_X_LOW LOW:0,PITCH_LOW MEDIUM:0,PITCH_MEDIUM HIGH:0,PITCH_HIGH 
X_HIGH:0,PITCH_X_HIGH IDENT:) LENGTH_UNIT:( UNIT_HZ:PITCH_FREQUENCY 
MASK:UNIT_MASK_PITCH RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_HZ:PITCH_CALC CALC:)
 
-pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:)
+pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:) CALC:( 
NUMBER:PITCH_RANGE_CALC CALC:)
 
 position:CSS_PROP_POSITION IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
LIBCSS_STATIC:0,POSITION_STATIC RELATIVE:0,POSITION_RELATIVE 
ABSOLUTE:0,POSITION_ABSOLUTE FIXED:0,POSITION_FIXED STICKY:0,POSITION_STICKY 
IDENT:)
 
-richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:)
+richness:CSS_PROP_RICHNESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( false:RICHNESS_SET RANGE:num<0||num>F_100 NUMBER:) CALC:( 
NUMBER:RICHNESS_CALC CALC:)
 
 speak:CSS_PROP_SPEAK IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,SPEAK_NORMAL NONE:0,SPEAK_NONE SPELL_OUT:0,SPEAK_SPELL_OUT IDENT:)
 
@@ -160,37 +166,35 @@ speak_numeral:CSS_PROP_SPEAK_NUMERAL IDENT:( INHERIT: 
INITIAL: REVERT: UNSET: DI
 
 speak_punctuation:CSS_PROP_SPEAK_PUNCTUATION IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: CODE:0,SPEAK_PUNCTUATION_CODE NONE:0,SPEAK_PUNCTUATION_NONE IDENT:)
 
-speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM 
FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER 
SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 
NUMBER:)
+speech_rate:CSS_PROP_SPEECH_RATE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
X_SLOW:0,SPEECH_RATE_X_SLOW SLOW:0,SPEECH_RATE_SLOW MEDIUM:0,SPEECH_RATE_MEDIUM 
FAST:0,SPEECH_RATE_FAST X_FAST:0,SPEECH_RATE_X_FAST FASTER:0,SPEECH_RATE_FASTER 
SLOWER:0,SPEECH_RATE_SLOWER IDENT:) NUMBER:( false:SPEECH_RATE_SET RANGE:num<0 
NUMBER:) CALC:( NUMBER:SPEECH_RATE_CALC CALC:)
 
-stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:)
+stress:CSS_PROP_STRESS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( false:STRESS_SET RANGE:num<0||num>INTTOFIX(100) NUMBER:) CALC:( 
NUMBER:STRESS_CALC CALC:)
 
 table_layout:CSS_PROP_TABLE_LAYOUT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,TABLE_LAYOUT_AUTO FIXED:0,TABLE_LAYOUT_FIXED IDENT:)
 
 text_align:CSS_PROP_TEXT_ALIGN IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
LEFT:0,TEXT_ALIGN_LEFT RIGHT:0,TEXT_ALIGN_RIGHT CENTER:0,TEXT_ALIGN_CENTER 
JUSTIFY:0,TEXT_ALIGN_JUSTIFY LIBCSS_LEFT:0,TEXT_ALIGN_LIBCSS_LEFT 
LIBCSS_CENTER:0,TEXT_ALIGN_LIBCSS_CENTER LIBCSS_RIGHT:0,TEXT_ALIGN_LIBCSS_RIGHT 
IDENT:)
 
-text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT 
LENGTH_UNIT:)
+text_indent:CSS_PROP_TEXT_INDENT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) LENGTH_UNIT:( UNIT_PX:TEXT_INDENT_SET MASK:UNIT_MASK_TEXT_INDENT 
LENGTH_UNIT:) CALC:( UNIT_PX:TEXT_INDENT_CALC CALC:)
 
 text_transform:CSS_PROP_TEXT_TRANSFORM IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: CAPITALIZE:0,TEXT_TRANSFORM_CAPITALIZE 
UPPERCASE:0,TEXT_TRANSFORM_UPPERCASE LOWERCASE:0,TEXT_TRANSFORM_LOWERCASE 
NONE:0,TEXT_TRANSFORM_NONE IDENT:)
 
 unicode_bidi:CSS_PROP_UNICODE_BIDI IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,UNICODE_BIDI_NORMAL EMBED:0,UNICODE_BIDI_EMBED 
BIDI_OVERRIDE:0,UNICODE_BIDI_BIDI_OVERRIDE IDENT:)
 
-vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB 
SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP 
TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE 
BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) 
LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN 
LENGTH_UNIT:)
+vertical_align:CSS_PROP_VERTICAL_ALIGN IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: BASELINE:0,VERTICAL_ALIGN_BASELINE SUB:0,VERTICAL_ALIGN_SUB 
SUPER:0,VERTICAL_ALIGN_SUPER TOP:0,VERTICAL_ALIGN_TOP 
TEXT_TOP:0,VERTICAL_ALIGN_TEXT_TOP MIDDLE:0,VERTICAL_ALIGN_MIDDLE 
BOTTOM:0,VERTICAL_ALIGN_BOTTOM TEXT_BOTTOM:0,VERTICAL_ALIGN_TEXT_BOTTOM IDENT:) 
LENGTH_UNIT:( UNIT_PX:VERTICAL_ALIGN_SET MASK:UNIT_MASK_VERTICAL_ALIGN 
LENGTH_UNIT:) CALC:( UNIT_PX:VERTICAL_ALIGN_CALC CALC:)
 
 visibility:CSS_PROP_VISIBILITY IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
VISIBLE:0,VISIBILITY_VISIBLE HIDDEN:0,VISIBILITY_HIDDEN 
COLLAPSE:0,VISIBILITY_COLLAPSE IDENT:)
 
-volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT 
MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) 
NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( 
UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:)
+volume:CSS_PROP_VOLUME IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
SILENT:0,VOLUME_SILENT X_SOFT:0,VOLUME_X_SOFT SOFT:0,VOLUME_SOFT 
MEDIUM:0,VOLUME_MEDIUM LOUD:0,VOLUME_LOUD X_LOUD:0,VOLUME_X_LOUD IDENT:) 
NUMBER:( false:VOLUME_NUMBER RANGE:num<0||num>F_100 NUMBER:) LENGTH_UNIT:( 
UNIT_PX:VOLUME_DIMENSION MASK:UNIT_MASK_VOLUME RANGE:<0 LENGTH_UNIT:) CALC:( 
ANY:VOLUME_CALC CALC:)
 
 white_space:CSS_PROP_WHITE_SPACE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,WHITE_SPACE_NORMAL PRE:0,WHITE_SPACE_PRE NOWRAP:0,WHITE_SPACE_NOWRAP 
PRE_WRAP:0,WHITE_SPACE_PRE_WRAP PRE_LINE:0,WHITE_SPACE_PRE_LINE  IDENT:)
 
-widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:)
-
-
-width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH 
RANGE:<0 LENGTH_UNIT:)
+widows:CSS_PROP_WIDOWS IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( true:WIDOWS_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:WIDOWS_CALC CALC:)
 
-word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET 
MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:)
+width:CSS_PROP_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:WIDTH_SET MASK:UNIT_MASK_WIDTH 
RANGE:<0 LENGTH_UNIT:) CALC:( UNIT_PX:WIDTH_CALC CALC:)
 
-z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:)
+word_spacing:CSS_PROP_WORD_SPACING IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,WORD_SPACING_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:WORD_SPACING_SET 
MASK:UNIT_MASK_WORD_SPACING LENGTH_UNIT:) CALC:( UNIT_PX:WORD_SPACING_CALC 
CALC:)
 
+z_index:CSS_PROP_Z_INDEX IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,Z_INDEX_AUTO IDENT:) NUMBER:( true:Z_INDEX_SET NUMBER:) CALC:( 
NUMBER:Z_INDEX_CALC CALC:)
 
 break_after:CSS_PROP_BREAK_AFTER IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,BREAK_AFTER_AUTO ALWAYS:0,BREAK_AFTER_ALWAYS AVOID:0,BREAK_AFTER_AVOID 
LEFT:0,BREAK_AFTER_LEFT RIGHT:0,BREAK_AFTER_RIGHT PAGE:0,BREAK_AFTER_PAGE 
COLUMN:0,BREAK_AFTER_COLUMN AVOID_PAGE:0,BREAK_AFTER_AVOID_PAGE 
AVOID_COLUMN:0,BREAK_AFTER_AVOID_COLUMN IDENT:)
 
@@ -198,11 +202,11 @@ break_before:CSS_PROP_BREAK_BEFORE IDENT:( INHERIT: 
INITIAL: REVERT: UNSET: AUTO
 
 break_inside:CSS_PROP_BREAK_INSIDE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,BREAK_INSIDE_AUTO AVOID:0,BREAK_INSIDE_AVOID 
AVOID_PAGE:0,BREAK_INSIDE_AVOID_PAGE AVOID_COLUMN:0,BREAK_INSIDE_AVOID_COLUMN 
IDENT:)
 
-column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 
NUMBER:)
+column_count:CSS_PROP_COLUMN_COUNT IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,COLUMN_COUNT_AUTO IDENT:) NUMBER:( true:COLUMN_COUNT_SET RANGE:num<0 
NUMBER:) CALC:( NUMBER:COLUMN_COUNT_CALC CALC:)
 
 column_fill:CSS_PROP_COLUMN_FILL IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
BALANCE:0,COLUMN_FILL_BALANCE AUTO:0,COLUMN_FILL_AUTO IDENT:)
 
-column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET 
RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:)
+column_gap:CSS_PROP_COLUMN_GAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NORMAL:0,COLUMN_GAP_NORMAL IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_GAP_SET 
RANGE:<0 MASK:UNIT_MASK_COLUMN_GAP LENGTH_UNIT:) CALC:( UNIT_PX:COLUMN_GAP_CALC 
CALC:)
 
 column_rule_color:CSS_PROP_COLUMN_RULE_COLOR IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: IDENT:) COLOR:COLUMN_RULE_COLOR_SET
 
@@ -212,7 +216,7 @@ column_rule_width:CSS_PROP_COLUMN_RULE_WIDTH 
WRAP:css__parse_border_side_width
 
 column_span:CSS_PROP_COLUMN_SPAN IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NONE:0,COLUMN_SPAN_NONE ALL:0,COLUMN_SPAN_ALL IDENT:)
 
-column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET 
MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:)
+column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,COLUMN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:COLUMN_WIDTH_SET 
MASK:UNIT_MASK_COLUMN_WIDTH LENGTH_UNIT:) CALC:( UNIT_PX:COLUMN_WIDTH_CALC 
CALC:)
 
 writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB 
VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR 
IDENT:)
 
@@ -224,16 +228,16 @@ align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: 
INITIAL: REVERT: UNSET: STRETC
 
 align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
STRETCH:0,ALIGN_SELF_STRETCH FLEX_START:0,ALIGN_SELF_FLEX_START 
FLEX_END:0,ALIGN_SELF_FLEX_END CENTER:0,ALIGN_SELF_CENTER 
BASELINE:0,ALIGN_SELF_BASELINE AUTO:0,ALIGN_SELF_AUTO IDENT:)
 
-flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( 
UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:)
+flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( 
UNIT_PX:FLEX_BASIS_SET MASK:UNIT_MASK_FLEX_BASIS RANGE:<0 LENGTH_UNIT:) CALC:( 
UNIT_PX:FLEX_BASIS_CALC CALC:)
 
 flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: ROW:0,FLEX_DIRECTION_ROW ROW_REVERSE:0,FLEX_DIRECTION_ROW_REVERSE 
COLUMN:0,FLEX_DIRECTION_COLUMN COLUMN_REVERSE:0,FLEX_DIRECTION_COLUMN_REVERSE 
IDENT:)
 
-flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+flex_grow:CSS_PROP_FLEX_GROW IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) 
NUMBER:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:) CALC:( NUMBER:FLEX_GROW_CALC 
CALC:)
 
-flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
IDENT:) NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:) CALC:( 
NUMBER:FLEX_SHRINK_CALC CALC:)
 
 flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: INITIAL: REVERT: UNSET: 
NOWRAP:0,FLEX_WRAP_NOWRAP WRAP_STRING:0,FLEX_WRAP_WRAP 
WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
 
 justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: INITIAL: REVERT: 
UNSET: FLEX_START:0,JUSTIFY_CONTENT_FLEX_START 
FLEX_END:0,JUSTIFY_CONTENT_FLEX_END CENTER:0,JUSTIFY_CONTENT_CENTER 
SPACE_BETWEEN:0,JUSTIFY_CONTENT_SPACE_BETWEEN 
SPACE_AROUND:0,JUSTIFY_CONTENT_SPACE_AROUND 
SPACE_EVENLY:0,JUSTIFY_CONTENT_SPACE_EVENLY IDENT:)
 
-order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( 
true:ORDER_SET NUMBER:)
+order:CSS_PROP_ORDER IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( 
true:ORDER_SET NUMBER:) CALC:( NUMBER:ORDER_CALC CALC:)
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 4739486..cce9717 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1351,9 +1351,9 @@ cleanup:
  *
  *
  * calc(10px + (4rem / 2)) =>
- *   U 10 px
- *   U 4 rem
- *   N 2
+ *   V 10 px
+ *   V 4 rem
+ *   V 2 NUMBER
  *   /
  *   +
  *   =
@@ -1362,14 +1362,12 @@ cleanup:
 static css_error
 css__parse_calc_sum(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result,
-               uint32_t unit);
+               css_style *result);
 
 static css_error
 css__parse_calc_value(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result,
-               uint32_t default_unit)
+               css_style *result)
 {
        css_error error;
        int orig_ctx = *ctx;
@@ -1377,7 +1375,7 @@ css__parse_calc_value(css_language *c,
 
        token = parserutils_vector_iterate(vector, ctx);
        if (tokenIsChar(token, '(')) {
-               error = css__parse_calc_sum(c, vector, ctx, result, 
default_unit);
+               error = css__parse_calc_sum(c, vector, ctx, result);
                if (error != CSS_OK) {
                        return error;
                }
@@ -1396,13 +1394,13 @@ css__parse_calc_value(css_language *c,
                uint32_t unit = 0;
                *ctx = orig_ctx;
 
-               error = css__parse_unit_specifier(c, vector, ctx, default_unit, 
&length, &unit);
+               error = css__parse_unit_specifier(c, vector, ctx, 
UNIT_CALC_NUMBER, &length, &unit);
                if (error != CSS_OK) {
                        *ctx = orig_ctx;
                        return error;
                }
 
-               error = css__stylesheet_style_vappend(result, 3, (css_code_t) 
'U', length, unit);
+               error = css__stylesheet_style_vappend(result, 3, (css_code_t) 
'V', length, unit);
        }
                break;
 
@@ -1422,8 +1420,7 @@ css__parse_calc_value(css_language *c,
 static css_error
 css__parse_calc_product(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result,
-               uint32_t unit)
+               css_style *result)
 {
        css_error error = CSS_OK;
        const css_token *token;
@@ -1431,7 +1428,7 @@ css__parse_calc_product(css_language *c,
 
 
        /* First parse a value */
-       error = css__parse_calc_value(c, vector, ctx, result, unit);
+       error = css__parse_calc_value(c, vector, ctx, result);
        if (error != CSS_OK) {
                return error;
        }
@@ -1455,33 +1452,10 @@ css__parse_calc_product(css_language *c,
                /* Consume that * or / now */
                token = parserutils_vector_iterate(vector, ctx);
 
-               if (multiplication) {
-                       /* parse another value */
-                       error = css__parse_calc_value(c, vector, ctx, result, 
unit);
-                       if (error != CSS_OK)
-                               break;
-               } else {
-                       css_fixed num;
-                       size_t consumed;
-
-                       token = parserutils_vector_iterate(vector, ctx);
-                       if (token->type != CSS_TOKEN_NUMBER) {
-                               error = CSS_INVALID;
-                               break;
-                       }
-                       num = css__number_from_lwc_string(token->idata, false, 
&consumed);
-                       if (consumed != lwc_string_length(token->idata)) {
-                               error = CSS_INVALID;
-                               break;
-                       }
-
-                       error = css__stylesheet_style_append(result, 
(css_code_t) 'N');
-                       if (error != CSS_OK)
-                               break;
-                       error = css__stylesheet_style_append(result, 
(css_code_t) num);
-                       if (error != CSS_OK)
-                               break;
-               }
+               /* parse another value */
+               error = css__parse_calc_value(c, vector, ctx, result);
+               if (error != CSS_OK)
+                       break;
 
                /* emit the multiplication/division operator */
                error = css__stylesheet_style_append(result, (css_code_t) 
(multiplication ? '*' : '/'));
@@ -1494,8 +1468,7 @@ css__parse_calc_product(css_language *c,
 css_error
 css__parse_calc_sum(css_language *c,
                const parserutils_vector *vector, int *ctx,
-               css_style *result,
-               uint32_t unit)
+               css_style *result)
 {
        css_error error = CSS_OK;
        const css_token *token;
@@ -1503,7 +1476,7 @@ css__parse_calc_sum(css_language *c,
 
 
        /* First parse a product */
-       error = css__parse_calc_product(c, vector, ctx, result, unit);
+       error = css__parse_calc_product(c, vector, ctx, result);
        if (error != CSS_OK) {
                return error;
        }
@@ -1528,7 +1501,7 @@ css__parse_calc_sum(css_language *c,
                token = parserutils_vector_iterate(vector, ctx);
 
                /* parse another product */
-               error = css__parse_calc_product(c, vector, ctx, result, unit);
+               error = css__parse_calc_product(c, vector, ctx, result);
                if (error != CSS_OK)
                        break;
 
@@ -1570,8 +1543,10 @@ css_error css__parse_calc(css_language *c,
        error = css__stylesheet_style_append(calc_style, property);
        if (error != CSS_OK)
                goto cleanup;
+       
+       error = css__stylesheet_style_append(calc_style, (css_code_t) unit);
 
-       error = css__parse_calc_sum(c, vector, ctx, calc_style, unit);
+       error = css__parse_calc_sum(c, vector, ctx, calc_style);
        if (error != CSS_OK)
                goto cleanup;
 


commitdiff 
http://git.netsurf-browser.org/libcss.git/commit/?id=d6a1adfd3390d063da2e405a208151dcb491fc9d
commit d6a1adfd3390d063da2e405a208151dcb491fc9d
Author: Daniel Silverstone <[email protected]>
Commit: Michael Drake <[email protected]>

    parse: Add calc() parser.
    
    Co-authored-by: Michael Drake <[email protected]>

diff --git a/src/parse/properties/css_property_parser_gen.c 
b/src/parse/properties/css_property_parser_gen.c
index 1e8b007..100fba1 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -316,6 +316,16 @@ void output_length_unit(FILE *outputf, struct keyval 
*parseid, struct keyval_lis
        struct keyval *ckv = kvlist->item[0];
        int ident_count;
 
+       fprintf(outputf,
+               "if ((token->type == CSS_TOKEN_IDENT) && "
+               "(lwc_string_caseless_isequal(token->idata, c->strings[CALC], 
&match) == lwc_error_ok && match))"
+               " {\n"
+               "\t\terror = css__parse_calc(c, vector, ctx, result, 
buildOPV(%s, 0, %s /* _CALC */), %s);\n"
+               "\t} else ",
+               parseid->val,
+               ckv->val,
+               ckv->key
+       );
 
        fprintf(outputf,
                "{\n"
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c
index 1e184f8..4739486 100644
--- a/src/parse/properties/utils.c
+++ b/src/parse/properties/utils.c
@@ -1333,3 +1333,269 @@ cleanup:
 
        return error;
 }
+
+/******************************************************************************/
+
+/* CALC
+ *
+ * calc( <calc-sum> )
+ *
+ * where
+ * <calc-sum> = <calc-product> [ [ '+' | '-' ] <calc-product> ]*
+ *
+ * where
+ * <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*
+ *
+ * where
+ * <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> )
+ *
+ *
+ * calc(10px + (4rem / 2)) =>
+ *   U 10 px
+ *   U 4 rem
+ *   N 2
+ *   /
+ *   +
+ *   =
+ */
+
+static css_error
+css__parse_calc_sum(css_language *c,
+               const parserutils_vector *vector, int *ctx,
+               css_style *result,
+               uint32_t unit);
+
+static css_error
+css__parse_calc_value(css_language *c,
+               const parserutils_vector *vector, int *ctx,
+               css_style *result,
+               uint32_t default_unit)
+{
+       css_error error;
+       int orig_ctx = *ctx;
+       const css_token *token;
+
+       token = parserutils_vector_iterate(vector, ctx);
+       if (tokenIsChar(token, '(')) {
+               error = css__parse_calc_sum(c, vector, ctx, result, 
default_unit);
+               if (error != CSS_OK) {
+                       return error;
+               }
+
+               token = parserutils_vector_peek(vector, *ctx);
+               if (!tokenIsChar(token, ')')) {
+                       return CSS_INVALID;
+               }
+
+       } else switch (token->type) {
+       case CSS_TOKEN_NUMBER:    /* Fall through */
+       case CSS_TOKEN_DIMENSION: /* Fall through */
+       case CSS_TOKEN_PERCENTAGE:
+       {
+               css_fixed length = 0;
+               uint32_t unit = 0;
+               *ctx = orig_ctx;
+
+               error = css__parse_unit_specifier(c, vector, ctx, default_unit, 
&length, &unit);
+               if (error != CSS_OK) {
+                       *ctx = orig_ctx;
+                       return error;
+               }
+
+               error = css__stylesheet_style_vappend(result, 3, (css_code_t) 
'U', length, unit);
+       }
+               break;
+
+       default:
+               error = CSS_INVALID;
+               break;
+       }
+
+       return error;
+}
+
+/* Both this, and css_parse_calc_sum must stop when it encounters a 
close-paren.
+ * If it hasn't had any useful tokens before that, it's an error.  It does not
+ * need to restore ctx before returning an error but it does need to ensure 
that
+ * the close paren has not been consumed
+ */
+static css_error
+css__parse_calc_product(css_language *c,
+               const parserutils_vector *vector, int *ctx,
+               css_style *result,
+               uint32_t unit)
+{
+       css_error error = CSS_OK;
+       const css_token *token;
+       bool multiplication;
+
+
+       /* First parse a value */
+       error = css__parse_calc_value(c, vector, ctx, result, unit);
+       if (error != CSS_OK) {
+               return error;
+       }
+
+       do {
+               /* What is our next token? */
+               token = parserutils_vector_peek(vector, *ctx);
+               if (token == NULL) {
+                       error = CSS_INVALID;
+                       break;
+               } else if (tokenIsChar(token, ')'))
+                       break;
+               else if (tokenIsChar(token, '*'))
+                       multiplication = true;
+               else if (tokenIsChar(token, '/'))
+                       multiplication = false;
+               else {
+                       error = CSS_INVALID;
+                       break;
+               }
+               /* Consume that * or / now */
+               token = parserutils_vector_iterate(vector, ctx);
+
+               if (multiplication) {
+                       /* parse another value */
+                       error = css__parse_calc_value(c, vector, ctx, result, 
unit);
+                       if (error != CSS_OK)
+                               break;
+               } else {
+                       css_fixed num;
+                       size_t consumed;
+
+                       token = parserutils_vector_iterate(vector, ctx);
+                       if (token->type != CSS_TOKEN_NUMBER) {
+                               error = CSS_INVALID;
+                               break;
+                       }
+                       num = css__number_from_lwc_string(token->idata, false, 
&consumed);
+                       if (consumed != lwc_string_length(token->idata)) {
+                               error = CSS_INVALID;
+                               break;
+                       }
+
+                       error = css__stylesheet_style_append(result, 
(css_code_t) 'N');
+                       if (error != CSS_OK)
+                               break;
+                       error = css__stylesheet_style_append(result, 
(css_code_t) num);
+                       if (error != CSS_OK)
+                               break;
+               }
+
+               /* emit the multiplication/division operator */
+               error = css__stylesheet_style_append(result, (css_code_t) 
(multiplication ? '*' : '/'));
+       } while (1);
+       /* We've fallen off, either we had an error or we're left with ')' */
+       return error;
+}
+
+
+css_error
+css__parse_calc_sum(css_language *c,
+               const parserutils_vector *vector, int *ctx,
+               css_style *result,
+               uint32_t unit)
+{
+       css_error error = CSS_OK;
+       const css_token *token;
+       bool addition;
+
+
+       /* First parse a product */
+       error = css__parse_calc_product(c, vector, ctx, result, unit);
+       if (error != CSS_OK) {
+               return error;
+       }
+
+       do {
+               /* What is our next token? */
+               token = parserutils_vector_peek(vector, *ctx);
+               if (token == NULL) {
+                       error = CSS_INVALID;
+                       break;
+               } else if (tokenIsChar(token, ')'))
+                       break;
+               else if (tokenIsChar(token, '+'))
+                       addition = true;
+               else if (tokenIsChar(token, '-'))
+                       addition = false;
+               else {
+                       error = CSS_INVALID;
+                       break;
+               }
+               /* Consume that + or - now */
+               token = parserutils_vector_iterate(vector, ctx);
+
+               /* parse another product */
+               error = css__parse_calc_product(c, vector, ctx, result, unit);
+               if (error != CSS_OK)
+                       break;
+
+               /* emit the addition/subtraction operator */
+               error = css__stylesheet_style_append(result, (css_code_t) 
(addition ? '+' : '-'));
+       } while (1);
+       /* We've fallen off, either we had an error or we're left with ')' */
+       return error;
+}
+
+/* Documented in utils.h */
+css_error css__parse_calc(css_language *c,
+               const parserutils_vector *vector, int *ctx,
+               css_style *result,
+               css_code_t property,
+               uint32_t unit)
+{
+       int orig_ctx = *ctx;
+       const css_token *token;
+       css_error error = CSS_OK;
+       css_style *calc_style = NULL;
+
+       token = parserutils_vector_iterate(vector, ctx);
+       if (token == NULL) {
+               *ctx = orig_ctx;
+               return CSS_INVALID;
+       }
+
+       if (!tokenIsChar(token, '(')) {
+               /* If we don't get an open-paren, give up now */
+               *ctx = orig_ctx;
+               return CSS_INVALID;
+       }
+
+       error = css__stylesheet_style_create(c->sheet, &calc_style);
+       if (error != CSS_OK)
+               goto cleanup;
+
+       error = css__stylesheet_style_append(calc_style, property);
+       if (error != CSS_OK)
+               goto cleanup;
+
+       error = css__parse_calc_sum(c, vector, ctx, calc_style, unit);
+       if (error != CSS_OK)
+               goto cleanup;
+
+       token = parserutils_vector_iterate(vector, ctx);
+       if (!tokenIsChar(token, ')')) {
+               /* If we don't get a close-paren, give up now */
+               error = CSS_INVALID;
+               goto cleanup;
+       }
+
+       /* Append the indicator that the calc is finished */
+       error = css__stylesheet_style_append(calc_style, (css_code_t) '=');
+       if (error != CSS_OK)
+               goto cleanup;
+
+       /* TODO: Once we're OK to do so, merge the style */
+       (void)result;
+       /* error = css__stylesheet_style_merge_style(result, calc_style); */
+
+cleanup:
+       css__stylesheet_style_destroy(calc_style);
+       if (error != CSS_OK) {
+               *ctx = orig_ctx;
+       }
+
+       return error;
+}
diff --git a/src/parse/properties/utils.h b/src/parse/properties/utils.h
index 54a3fd1..02cb220 100644
--- a/src/parse/properties/utils.h
+++ b/src/parse/properties/utils.h
@@ -228,4 +228,28 @@ css_error css__comma_list_to_style(css_language *c,
                                bool first),
                css_style *result);
 
+/**
+ * Parse a CSS calc() invocation
+ *
+ * Calc can generate a number of kinds of units, so we have to tell the
+ * parser the kind of unit we're aiming for (e.g. UNIT_PX, UNIT_ANGLE, etc.)
+ *
+ * \param[in] c        Parsing context
+ * \param[in] vector   Vector of tokens to process
+ * \param[in] ctx      Pointer to vector iteration context
+ * \param[in] result   Pointer to location to receive resulting style
+ * \param[in] property The CSS property we are calculating for
+ * \param[in] unit     The kind of unit which we want to come out of this 
calc()
+ * \return CSS_OK on success,
+ *         CSS_NOMEM on memory exhaustion,
+           CSS_INVALID if the input is not valid
+ *
+ * Post condition: \a *ctx is updated with the next token to process
+ *                 If the input is invalid, then \a *ctx remains unchanged.
+ */
+css_error css__parse_calc(css_language *c,
+               const parserutils_vector *vector, int *ctx,
+               css_style *result,
+               css_code_t property,
+               uint32_t unit);
 #endif
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index 786a3b7..aa44333 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -489,6 +489,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
        SMAP("grid"),
        SMAP("inline-grid"),
        SMAP("sticky"),
+       SMAP("calc"),
 
        SMAP("aliceblue"),
        SMAP("antiquewhite"),
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index 6d6dd49..80f75c8 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -109,7 +109,7 @@ enum {
        VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, INLINE_FLEX, FLEX_START,
        FLEX_END, SPACE_BETWEEN, SPACE_AROUND, SPACE_EVENLY, ROW, ROW_REVERSE,
        COLUMN_REVERSE, WRAP_STRING, WRAP_REVERSE, AND, OR, ONLY, INFINITE,
-       GRID, INLINE_GRID, STICKY,
+       GRID, INLINE_GRID, STICKY, CALC,
 
        /* Named colours */
        FIRST_COLOUR,


-----------------------------------------------------------------------

Summary of changes:
 src/select/autogenerated_computed.h |    1 -
 src/select/autogenerated_propset.h  |  416 +++++++++--------------------------
 src/select/select_generator.py      |  198 ++++-------------
 3 files changed, 144 insertions(+), 471 deletions(-)

diff --git a/src/select/autogenerated_computed.h 
b/src/select/autogenerated_computed.h
index b26560d..c65cf98 100644
--- a/src/select/autogenerated_computed.h
+++ b/src/select/autogenerated_computed.h
@@ -263,7 +263,6 @@ struct css_computed_style_i {
        css_fixed width;
        css_fixed word_spacing;
        int32_t z_index;
-       
 };
 
 struct css_computed_style {
diff --git a/src/select/autogenerated_propset.h 
b/src/select/autogenerated_propset.h
index 036c2ba..71d1596 100644
--- a/src/select/autogenerated_propset.h
+++ b/src/select/autogenerated_propset.h
@@ -15,9 +15,7 @@
 static inline css_error set_align_content(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[ALIGN_CONTENT_INDEX];
+       uint32_t *bits = &style->i.bits[ALIGN_CONTENT_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~ALIGN_CONTENT_MASK) | (((uint32_t)type & 0x7) <<
@@ -35,9 +33,7 @@ static inline css_error set_align_content(css_computed_style 
*style, uint8_t
 
 static inline css_error set_align_items(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[ALIGN_ITEMS_INDEX];
+       uint32_t *bits = &style->i.bits[ALIGN_ITEMS_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~ALIGN_ITEMS_MASK) | (((uint32_t)type & 0x7) <<
@@ -55,9 +51,7 @@ static inline css_error set_align_items(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_align_self(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[ALIGN_SELF_INDEX];
+       uint32_t *bits = &style->i.bits[ALIGN_SELF_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~ALIGN_SELF_MASK) | (((uint32_t)type & 0x7) <<
@@ -76,9 +70,7 @@ static inline css_error set_align_self(css_computed_style 
*style, uint8_t type)
 static inline css_error set_background_attachment(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
+       uint32_t *bits = &style->i.bits[BACKGROUND_ATTACHMENT_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BACKGROUND_ATTACHMENT_MASK) | (((uint32_t)type & 0x3)
@@ -97,9 +89,7 @@ static inline css_error 
set_background_attachment(css_computed_style *style,
 static inline css_error set_background_color(css_computed_style *style, uint8_t
                type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[BACKGROUND_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BACKGROUND_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -120,9 +110,7 @@ static inline css_error 
set_background_color(css_computed_style *style, uint8_t
 static inline css_error set_background_image(css_computed_style *style, uint8_t
                type, lwc_string *string)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
+       uint32_t *bits = &style->i.bits[BACKGROUND_IMAGE_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~BACKGROUND_IMAGE_MASK) | (((uint32_t)type & 0x1) <<
@@ -153,9 +141,7 @@ static inline css_error 
set_background_position(css_computed_style *style,
                uint8_t type, css_fixed length_a, css_unit unit_a, css_fixed
                length_b, css_unit unit_b)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
+       uint32_t *bits = &style->i.bits[BACKGROUND_POSITION_INDEX];
        
        /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
        *bits = (*bits & ~BACKGROUND_POSITION_MASK) | ((((uint32_t)type & 0x1)
@@ -179,9 +165,7 @@ static inline css_error 
set_background_position(css_computed_style *style,
 static inline css_error set_background_repeat(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
+       uint32_t *bits = &style->i.bits[BACKGROUND_REPEAT_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~BACKGROUND_REPEAT_MASK) | (((uint32_t)type & 0x7) <<
@@ -200,9 +184,7 @@ static inline css_error 
set_background_repeat(css_computed_style *style,
 static inline css_error set_border_bottom_color(css_computed_style *style,
                uint8_t type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_BOTTOM_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BORDER_BOTTOM_COLOR_MASK) | (((uint32_t)type & 0x3)
@@ -223,9 +205,7 @@ static inline css_error 
set_border_bottom_color(css_computed_style *style,
 static inline css_error set_border_bottom_style(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_BOTTOM_STYLE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BORDER_BOTTOM_STYLE_MASK) | (((uint32_t)type & 0xf)
@@ -244,9 +224,7 @@ static inline css_error 
set_border_bottom_style(css_computed_style *style,
 static inline css_error set_border_bottom_width(css_computed_style *style,
                uint8_t type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_BOTTOM_WIDTH_INDEX];
        
        /* 8bits: uuuuuttt : unit | type */
        *bits = (*bits & ~BORDER_BOTTOM_WIDTH_MASK) | ((((uint32_t)type & 0x7)
@@ -267,9 +245,7 @@ static inline css_error 
set_border_bottom_width(css_computed_style *style,
 static inline css_error set_border_collapse(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_COLLAPSE_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BORDER_COLLAPSE_MASK) | (((uint32_t)type & 0x3) <<
@@ -288,9 +264,7 @@ static inline css_error 
set_border_collapse(css_computed_style *style, uint8_t
 static inline css_error set_border_left_color(css_computed_style *style,
                uint8_t type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_LEFT_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BORDER_LEFT_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -311,9 +285,7 @@ static inline css_error 
set_border_left_color(css_computed_style *style,
 static inline css_error set_border_left_style(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_LEFT_STYLE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BORDER_LEFT_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -332,9 +304,7 @@ static inline css_error 
set_border_left_style(css_computed_style *style,
 static inline css_error set_border_left_width(css_computed_style *style,
                uint8_t type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_LEFT_WIDTH_INDEX];
        
        /* 8bits: uuuuuttt : unit | type */
        *bits = (*bits & ~BORDER_LEFT_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -355,9 +325,7 @@ static inline css_error 
set_border_left_width(css_computed_style *style,
 static inline css_error set_border_right_color(css_computed_style *style,
                uint8_t type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_RIGHT_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BORDER_RIGHT_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -378,9 +346,7 @@ static inline css_error 
set_border_right_color(css_computed_style *style,
 static inline css_error set_border_right_style(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_RIGHT_STYLE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BORDER_RIGHT_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -399,9 +365,7 @@ static inline css_error 
set_border_right_style(css_computed_style *style,
 static inline css_error set_border_right_width(css_computed_style *style,
                uint8_t type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_RIGHT_WIDTH_INDEX];
        
        /* 8bits: uuuuuttt : unit | type */
        *bits = (*bits & ~BORDER_RIGHT_WIDTH_MASK) | ((((uint32_t)type & 0x7) |
@@ -423,9 +387,7 @@ static inline css_error 
set_border_spacing(css_computed_style *style, uint8_t
                type, css_fixed length_a, css_unit unit_a, css_fixed length_b,
                css_unit unit_b)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_SPACING_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_SPACING_INDEX];
        
        /* 11bits: aaaaabbbbbt : unit_a | unit_b | type */
        *bits = (*bits & ~BORDER_SPACING_MASK) | ((((uint32_t)type & 0x1) | (
@@ -448,9 +410,7 @@ static inline css_error 
set_border_spacing(css_computed_style *style, uint8_t
 static inline css_error set_border_top_color(css_computed_style *style, uint8_t
                type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_TOP_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BORDER_TOP_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -471,9 +431,7 @@ static inline css_error 
set_border_top_color(css_computed_style *style, uint8_t
 static inline css_error set_border_top_style(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_TOP_STYLE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BORDER_TOP_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -492,9 +450,7 @@ static inline css_error 
set_border_top_style(css_computed_style *style, uint8_t
 static inline css_error set_border_top_width(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[BORDER_TOP_WIDTH_INDEX];
        
        /* 8bits: uuuuuttt : unit | type */
        *bits = (*bits & ~BORDER_TOP_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -515,9 +471,7 @@ static inline css_error 
set_border_top_width(css_computed_style *style, uint8_t
 static inline css_error set_bottom(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BOTTOM_INDEX];
+       uint32_t *bits = &style->i.bits[BOTTOM_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -537,9 +491,7 @@ static inline css_error set_bottom(css_computed_style 
*style, uint8_t type,
 
 static inline css_error set_box_sizing(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BOX_SIZING_INDEX];
+       uint32_t *bits = &style->i.bits[BOX_SIZING_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~BOX_SIZING_MASK) | (((uint32_t)type & 0x3) <<
@@ -557,9 +509,7 @@ static inline css_error set_box_sizing(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_break_after(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BREAK_AFTER_INDEX];
+       uint32_t *bits = &style->i.bits[BREAK_AFTER_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BREAK_AFTER_MASK) | (((uint32_t)type & 0xf) <<
@@ -578,9 +528,7 @@ static inline css_error set_break_after(css_computed_style 
*style, uint8_t type)
 static inline css_error set_break_before(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BREAK_BEFORE_INDEX];
+       uint32_t *bits = &style->i.bits[BREAK_BEFORE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BREAK_BEFORE_MASK) | (((uint32_t)type & 0xf) <<
@@ -599,9 +547,7 @@ static inline css_error set_break_before(css_computed_style 
*style, uint8_t
 static inline css_error set_break_inside(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[BREAK_INSIDE_INDEX];
+       uint32_t *bits = &style->i.bits[BREAK_INSIDE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~BREAK_INSIDE_MASK) | (((uint32_t)type & 0xf) <<
@@ -620,9 +566,7 @@ static inline css_error set_break_inside(css_computed_style 
*style, uint8_t
 static inline css_error set_caption_side(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[CAPTION_SIDE_INDEX];
+       uint32_t *bits = &style->i.bits[CAPTION_SIDE_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~CAPTION_SIDE_MASK) | (((uint32_t)type & 0x3) <<
@@ -640,9 +584,7 @@ static inline css_error set_caption_side(css_computed_style 
*style, uint8_t
 
 static inline css_error set_clear(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[CLEAR_INDEX];
+       uint32_t *bits = &style->i.bits[CLEAR_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~CLEAR_MASK) | (((uint32_t)type & 0x7) << CLEAR_SHIFT);
@@ -703,9 +645,7 @@ static inline css_error set_clip(
 static inline css_error set_color(css_computed_style *style, uint8_t type,
                css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[COLOR_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~COLOR_MASK) | (((uint32_t)type & 0x1) << COLOR_SHIFT);
@@ -725,9 +665,7 @@ static inline css_error set_color(css_computed_style 
*style, uint8_t type,
 static inline css_error set_column_count(css_computed_style *style, uint8_t
                type, int32_t integer)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_COUNT_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_COUNT_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~COLUMN_COUNT_MASK) | (((uint32_t)type & 0x3) <<
@@ -747,9 +685,7 @@ static inline css_error set_column_count(css_computed_style 
*style, uint8_t
 
 static inline css_error set_column_fill(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_FILL_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_FILL_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~COLUMN_FILL_MASK) | (((uint32_t)type & 0x3) <<
@@ -768,9 +704,7 @@ static inline css_error set_column_fill(css_computed_style 
*style, uint8_t type)
 static inline css_error set_column_gap(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_GAP_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_GAP_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~COLUMN_GAP_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -791,9 +725,7 @@ static inline css_error set_column_gap(css_computed_style 
*style, uint8_t type,
 static inline css_error set_column_rule_color(css_computed_style *style,
                uint8_t type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_RULE_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_RULE_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~COLUMN_RULE_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -814,9 +746,7 @@ static inline css_error 
set_column_rule_color(css_computed_style *style,
 static inline css_error set_column_rule_style(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_RULE_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_RULE_STYLE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~COLUMN_RULE_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -835,9 +765,7 @@ static inline css_error 
set_column_rule_style(css_computed_style *style,
 static inline css_error set_column_rule_width(css_computed_style *style,
                uint8_t type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_RULE_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_RULE_WIDTH_INDEX];
        
        /* 8bits: uuuuuttt : unit | type */
        *bits = (*bits & ~COLUMN_RULE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -857,9 +785,7 @@ static inline css_error 
set_column_rule_width(css_computed_style *style,
 
 static inline css_error set_column_span(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_SPAN_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_SPAN_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~COLUMN_SPAN_MASK) | (((uint32_t)type & 0x3) <<
@@ -878,9 +804,7 @@ static inline css_error set_column_span(css_computed_style 
*style, uint8_t type)
 static inline css_error set_column_width(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COLUMN_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[COLUMN_WIDTH_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~COLUMN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -984,9 +908,7 @@ static inline css_error set_content(
 static inline css_error set_counter_increment(css_computed_style *style,
                uint8_t type, css_computed_counter *counter_arr)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COUNTER_INCREMENT_INDEX];
+       uint32_t *bits = &style->i.bits[COUNTER_INCREMENT_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~COUNTER_INCREMENT_MASK) | (((uint32_t)type & 0x1) <<
@@ -1022,9 +944,7 @@ static inline css_error 
set_counter_increment(css_computed_style *style,
 static inline css_error set_counter_reset(css_computed_style *style, uint8_t
                type, css_computed_counter *counter_arr)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[COUNTER_RESET_INDEX];
+       uint32_t *bits = &style->i.bits[COUNTER_RESET_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~COUNTER_RESET_MASK) | (((uint32_t)type & 0x1) <<
@@ -1060,9 +980,7 @@ static inline css_error 
set_counter_reset(css_computed_style *style, uint8_t
 static inline css_error set_cursor(css_computed_style *style, uint8_t type,
                lwc_string **string_arr)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[CURSOR_INDEX];
+       uint32_t *bits = &style->i.bits[CURSOR_INDEX];
        
        /* 5bits: ttttt : type */
        *bits = (*bits & ~CURSOR_MASK) | (((uint32_t)type & 0x1f) <<
@@ -1097,9 +1015,7 @@ static inline css_error set_cursor(css_computed_style 
*style, uint8_t type,
 
 static inline css_error set_direction(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[DIRECTION_INDEX];
+       uint32_t *bits = &style->i.bits[DIRECTION_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~DIRECTION_MASK) | (((uint32_t)type & 0x3) <<
@@ -1117,9 +1033,7 @@ static inline css_error set_direction(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_display(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[DISPLAY_INDEX];
+       uint32_t *bits = &style->i.bits[DISPLAY_INDEX];
        
        /* 5bits: ttttt : type */
        *bits = (*bits & ~DISPLAY_MASK) | (((uint32_t)type & 0x1f) <<
@@ -1137,9 +1051,7 @@ static inline css_error set_display(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_empty_cells(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[EMPTY_CELLS_INDEX];
+       uint32_t *bits = &style->i.bits[EMPTY_CELLS_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~EMPTY_CELLS_MASK) | (((uint32_t)type & 0x3) <<
@@ -1158,9 +1070,7 @@ static inline css_error 
set_empty_cells(css_computed_style *style, uint8_t type)
 static inline css_error set_flex_basis(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FLEX_BASIS_INDEX];
+       uint32_t *bits = &style->i.bits[FLEX_BASIS_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~FLEX_BASIS_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1181,9 +1091,7 @@ static inline css_error set_flex_basis(css_computed_style 
*style, uint8_t type,
 static inline css_error set_flex_direction(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FLEX_DIRECTION_INDEX];
+       uint32_t *bits = &style->i.bits[FLEX_DIRECTION_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~FLEX_DIRECTION_MASK) | (((uint32_t)type & 0x7) <<
@@ -1202,9 +1110,7 @@ static inline css_error 
set_flex_direction(css_computed_style *style, uint8_t
 static inline css_error set_flex_grow(css_computed_style *style, uint8_t type,
                css_fixed fixed)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FLEX_GROW_INDEX];
+       uint32_t *bits = &style->i.bits[FLEX_GROW_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~FLEX_GROW_MASK) | (((uint32_t)type & 0x1) <<
@@ -1225,9 +1131,7 @@ static inline css_error set_flex_grow(css_computed_style 
*style, uint8_t type,
 static inline css_error set_flex_shrink(css_computed_style *style, uint8_t
                type, css_fixed fixed)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FLEX_SHRINK_INDEX];
+       uint32_t *bits = &style->i.bits[FLEX_SHRINK_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~FLEX_SHRINK_MASK) | (((uint32_t)type & 0x1) <<
@@ -1247,9 +1151,7 @@ static inline css_error 
set_flex_shrink(css_computed_style *style, uint8_t
 
 static inline css_error set_flex_wrap(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FLEX_WRAP_INDEX];
+       uint32_t *bits = &style->i.bits[FLEX_WRAP_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~FLEX_WRAP_MASK) | (((uint32_t)type & 0x3) <<
@@ -1267,9 +1169,7 @@ static inline css_error set_flex_wrap(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_float(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FLOAT_INDEX];
+       uint32_t *bits = &style->i.bits[FLOAT_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~FLOAT_MASK) | (((uint32_t)type & 0x3) << FLOAT_SHIFT);
@@ -1287,9 +1187,7 @@ static inline css_error set_float(css_computed_style 
*style, uint8_t type)
 static inline css_error set_font_family(css_computed_style *style, uint8_t
                type, lwc_string **string_arr)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FONT_FAMILY_INDEX];
+       uint32_t *bits = &style->i.bits[FONT_FAMILY_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~FONT_FAMILY_MASK) | (((uint32_t)type & 0x7) <<
@@ -1325,9 +1223,7 @@ static inline css_error 
set_font_family(css_computed_style *style, uint8_t
 static inline css_error set_font_size(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FONT_SIZE_INDEX];
+       uint32_t *bits = &style->i.bits[FONT_SIZE_INDEX];
        
        /* 9bits: uuuuutttt : unit | type */
        *bits = (*bits & ~FONT_SIZE_MASK) | ((((uint32_t)type & 0xf) | (unit <<
@@ -1347,9 +1243,7 @@ static inline css_error set_font_size(css_computed_style 
*style, uint8_t type,
 
 static inline css_error set_font_style(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FONT_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[FONT_STYLE_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~FONT_STYLE_MASK) | (((uint32_t)type & 0x3) <<
@@ -1368,9 +1262,7 @@ static inline css_error set_font_style(css_computed_style 
*style, uint8_t type)
 static inline css_error set_font_variant(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FONT_VARIANT_INDEX];
+       uint32_t *bits = &style->i.bits[FONT_VARIANT_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~FONT_VARIANT_MASK) | (((uint32_t)type & 0x3) <<
@@ -1388,9 +1280,7 @@ static inline css_error 
set_font_variant(css_computed_style *style, uint8_t
 
 static inline css_error set_font_weight(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[FONT_WEIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[FONT_WEIGHT_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~FONT_WEIGHT_MASK) | (((uint32_t)type & 0xf) <<
@@ -1409,9 +1299,7 @@ static inline css_error 
set_font_weight(css_computed_style *style, uint8_t type)
 static inline css_error set_height(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[HEIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[HEIGHT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1432,9 +1320,7 @@ static inline css_error set_height(css_computed_style 
*style, uint8_t type,
 static inline css_error set_justify_content(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
+       uint32_t *bits = &style->i.bits[JUSTIFY_CONTENT_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~JUSTIFY_CONTENT_MASK) | (((uint32_t)type & 0x7) <<
@@ -1453,9 +1339,7 @@ static inline css_error 
set_justify_content(css_computed_style *style, uint8_t
 static inline css_error set_left(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[LEFT_INDEX];
+       uint32_t *bits = &style->i.bits[LEFT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -1476,9 +1360,7 @@ static inline css_error set_left(css_computed_style 
*style, uint8_t type,
 static inline css_error set_letter_spacing(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[LETTER_SPACING_INDEX];
+       uint32_t *bits = &style->i.bits[LETTER_SPACING_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~LETTER_SPACING_MASK) | ((((uint32_t)type & 0x3) | (
@@ -1499,9 +1381,7 @@ static inline css_error 
set_letter_spacing(css_computed_style *style, uint8_t
 static inline css_error set_line_height(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[LINE_HEIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[LINE_HEIGHT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~LINE_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1522,9 +1402,7 @@ static inline css_error 
set_line_height(css_computed_style *style, uint8_t
 static inline css_error set_list_style_image(css_computed_style *style, uint8_t
                type, lwc_string *string)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
+       uint32_t *bits = &style->i.bits[LIST_STYLE_IMAGE_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~LIST_STYLE_IMAGE_MASK) | (((uint32_t)type & 0x1) <<
@@ -1554,9 +1432,7 @@ static inline css_error 
set_list_style_image(css_computed_style *style, uint8_t
 static inline css_error set_list_style_position(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
+       uint32_t *bits = &style->i.bits[LIST_STYLE_POSITION_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~LIST_STYLE_POSITION_MASK) | (((uint32_t)type & 0x3)
@@ -1575,9 +1451,7 @@ static inline css_error 
set_list_style_position(css_computed_style *style,
 static inline css_error set_list_style_type(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
+       uint32_t *bits = &style->i.bits[LIST_STYLE_TYPE_INDEX];
        
        /* 6bits: tttttt : type */
        *bits = (*bits & ~LIST_STYLE_TYPE_MASK) | (((uint32_t)type & 0x3f) <<
@@ -1596,9 +1470,7 @@ static inline css_error 
set_list_style_type(css_computed_style *style, uint8_t
 static inline css_error set_margin_bottom(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
+       uint32_t *bits = &style->i.bits[MARGIN_BOTTOM_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MARGIN_BOTTOM_MASK) | ((((uint32_t)type & 0x3) | (
@@ -1619,9 +1491,7 @@ static inline css_error 
set_margin_bottom(css_computed_style *style, uint8_t
 static inline css_error set_margin_left(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MARGIN_LEFT_INDEX];
+       uint32_t *bits = &style->i.bits[MARGIN_LEFT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MARGIN_LEFT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1642,9 +1512,7 @@ static inline css_error 
set_margin_left(css_computed_style *style, uint8_t
 static inline css_error set_margin_right(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MARGIN_RIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[MARGIN_RIGHT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MARGIN_RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1665,9 +1533,7 @@ static inline css_error 
set_margin_right(css_computed_style *style, uint8_t
 static inline css_error set_margin_top(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MARGIN_TOP_INDEX];
+       uint32_t *bits = &style->i.bits[MARGIN_TOP_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MARGIN_TOP_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1688,9 +1554,7 @@ static inline css_error set_margin_top(css_computed_style 
*style, uint8_t type,
 static inline css_error set_max_height(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MAX_HEIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[MAX_HEIGHT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MAX_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1711,9 +1575,7 @@ static inline css_error set_max_height(css_computed_style 
*style, uint8_t type,
 static inline css_error set_max_width(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MAX_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[MAX_WIDTH_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MAX_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1734,9 +1596,7 @@ static inline css_error set_max_width(css_computed_style 
*style, uint8_t type,
 static inline css_error set_min_height(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MIN_HEIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[MIN_HEIGHT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MIN_HEIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -1757,9 +1617,7 @@ static inline css_error set_min_height(css_computed_style 
*style, uint8_t type,
 static inline css_error set_min_width(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[MIN_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[MIN_WIDTH_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~MIN_WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit <<
@@ -1780,9 +1638,7 @@ static inline css_error set_min_width(css_computed_style 
*style, uint8_t type,
 static inline css_error set_opacity(css_computed_style *style, uint8_t type,
                css_fixed fixed)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[OPACITY_INDEX];
+       uint32_t *bits = &style->i.bits[OPACITY_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~OPACITY_MASK) | (((uint32_t)type & 0x1) <<
@@ -1803,9 +1659,7 @@ static inline css_error set_opacity(css_computed_style 
*style, uint8_t type,
 static inline css_error set_order(css_computed_style *style, uint8_t type,
                int32_t integer)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[ORDER_INDEX];
+       uint32_t *bits = &style->i.bits[ORDER_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~ORDER_MASK) | (((uint32_t)type & 0x1) << ORDER_SHIFT);
@@ -1825,9 +1679,7 @@ static inline css_error set_order(css_computed_style 
*style, uint8_t type,
 static inline css_error set_orphans(css_computed_style *style, uint8_t type,
                int32_t integer)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[ORPHANS_INDEX];
+       uint32_t *bits = &style->i.bits[ORPHANS_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~ORPHANS_MASK) | (((uint32_t)type & 0x1) <<
@@ -1848,9 +1700,7 @@ static inline css_error set_orphans(css_computed_style 
*style, uint8_t type,
 static inline css_error set_outline_color(css_computed_style *style, uint8_t
                type, css_color color)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[OUTLINE_COLOR_INDEX];
+       uint32_t *bits = &style->i.bits[OUTLINE_COLOR_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~OUTLINE_COLOR_MASK) | (((uint32_t)type & 0x3) <<
@@ -1871,9 +1721,7 @@ static inline css_error 
set_outline_color(css_computed_style *style, uint8_t
 static inline css_error set_outline_style(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[OUTLINE_STYLE_INDEX];
+       uint32_t *bits = &style->i.bits[OUTLINE_STYLE_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~OUTLINE_STYLE_MASK) | (((uint32_t)type & 0xf) <<
@@ -1892,9 +1740,7 @@ static inline css_error 
set_outline_style(css_computed_style *style, uint8_t
 static inline css_error set_outline_width(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[OUTLINE_WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[OUTLINE_WIDTH_INDEX];
        
        /* 8bits: uuuuuttt : unit | type */
        *bits = (*bits & ~OUTLINE_WIDTH_MASK) | ((((uint32_t)type & 0x7) | (
@@ -1914,9 +1760,7 @@ static inline css_error 
set_outline_width(css_computed_style *style, uint8_t
 
 static inline css_error set_overflow_x(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[OVERFLOW_X_INDEX];
+       uint32_t *bits = &style->i.bits[OVERFLOW_X_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~OVERFLOW_X_MASK) | (((uint32_t)type & 0x7) <<
@@ -1934,9 +1778,7 @@ static inline css_error set_overflow_x(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_overflow_y(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[OVERFLOW_Y_INDEX];
+       uint32_t *bits = &style->i.bits[OVERFLOW_Y_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~OVERFLOW_Y_MASK) | (((uint32_t)type & 0x7) <<
@@ -1955,9 +1797,7 @@ static inline css_error set_overflow_y(css_computed_style 
*style, uint8_t type)
 static inline css_error set_padding_bottom(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PADDING_BOTTOM_INDEX];
+       uint32_t *bits = &style->i.bits[PADDING_BOTTOM_INDEX];
        
        /* 6bits: uuuuut : unit | type */
        *bits = (*bits & ~PADDING_BOTTOM_MASK) | ((((uint32_t)type & 0x1) | (
@@ -1978,9 +1818,7 @@ static inline css_error 
set_padding_bottom(css_computed_style *style, uint8_t
 static inline css_error set_padding_left(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PADDING_LEFT_INDEX];
+       uint32_t *bits = &style->i.bits[PADDING_LEFT_INDEX];
        
        /* 6bits: uuuuut : unit | type */
        *bits = (*bits & ~PADDING_LEFT_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2001,9 +1839,7 @@ static inline css_error 
set_padding_left(css_computed_style *style, uint8_t
 static inline css_error set_padding_right(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PADDING_RIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[PADDING_RIGHT_INDEX];
        
        /* 6bits: uuuuut : unit | type */
        *bits = (*bits & ~PADDING_RIGHT_MASK) | ((((uint32_t)type & 0x1) | (
@@ -2024,9 +1860,7 @@ static inline css_error 
set_padding_right(css_computed_style *style, uint8_t
 static inline css_error set_padding_top(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PADDING_TOP_INDEX];
+       uint32_t *bits = &style->i.bits[PADDING_TOP_INDEX];
        
        /* 6bits: uuuuut : unit | type */
        *bits = (*bits & ~PADDING_TOP_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2047,9 +1881,7 @@ static inline css_error 
set_padding_top(css_computed_style *style, uint8_t
 static inline css_error set_page_break_after(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PAGE_BREAK_AFTER_INDEX];
+       uint32_t *bits = &style->i.bits[PAGE_BREAK_AFTER_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~PAGE_BREAK_AFTER_MASK) | (((uint32_t)type & 0x7) <<
@@ -2068,9 +1900,7 @@ static inline css_error 
set_page_break_after(css_computed_style *style, uint8_t
 static inline css_error set_page_break_before(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PAGE_BREAK_BEFORE_INDEX];
+       uint32_t *bits = &style->i.bits[PAGE_BREAK_BEFORE_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~PAGE_BREAK_BEFORE_MASK) | (((uint32_t)type & 0x7) <<
@@ -2089,9 +1919,7 @@ static inline css_error 
set_page_break_before(css_computed_style *style,
 static inline css_error set_page_break_inside(css_computed_style *style,
                uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[PAGE_BREAK_INSIDE_INDEX];
+       uint32_t *bits = &style->i.bits[PAGE_BREAK_INSIDE_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~PAGE_BREAK_INSIDE_MASK) | (((uint32_t)type & 0x3) <<
@@ -2109,9 +1937,7 @@ static inline css_error 
set_page_break_inside(css_computed_style *style,
 
 static inline css_error set_position(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[POSITION_INDEX];
+       uint32_t *bits = &style->i.bits[POSITION_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~POSITION_MASK) | (((uint32_t)type & 0x7) <<
@@ -2130,9 +1956,7 @@ static inline css_error set_position(css_computed_style 
*style, uint8_t type)
 static inline css_error set_quotes(css_computed_style *style, uint8_t type,
                lwc_string **string_arr)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[QUOTES_INDEX];
+       uint32_t *bits = &style->i.bits[QUOTES_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~QUOTES_MASK) | (((uint32_t)type & 0x1) <<
@@ -2168,9 +1992,7 @@ static inline css_error set_quotes(css_computed_style 
*style, uint8_t type,
 static inline css_error set_right(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[RIGHT_INDEX];
+       uint32_t *bits = &style->i.bits[RIGHT_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~RIGHT_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2191,9 +2013,7 @@ static inline css_error set_right(css_computed_style 
*style, uint8_t type,
 static inline css_error set_table_layout(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[TABLE_LAYOUT_INDEX];
+       uint32_t *bits = &style->i.bits[TABLE_LAYOUT_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~TABLE_LAYOUT_MASK) | (((uint32_t)type & 0x3) <<
@@ -2211,9 +2031,7 @@ static inline css_error 
set_table_layout(css_computed_style *style, uint8_t
 
 static inline css_error set_text_align(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[TEXT_ALIGN_INDEX];
+       uint32_t *bits = &style->i.bits[TEXT_ALIGN_INDEX];
        
        /* 4bits: tttt : type */
        *bits = (*bits & ~TEXT_ALIGN_MASK) | (((uint32_t)type & 0xf) <<
@@ -2232,9 +2050,7 @@ static inline css_error set_text_align(css_computed_style 
*style, uint8_t type)
 static inline css_error set_text_decoration(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[TEXT_DECORATION_INDEX];
+       uint32_t *bits = &style->i.bits[TEXT_DECORATION_INDEX];
        
        /* 5bits: ttttt : type */
        *bits = (*bits & ~TEXT_DECORATION_MASK) | (((uint32_t)type & 0x1f) <<
@@ -2253,9 +2069,7 @@ static inline css_error 
set_text_decoration(css_computed_style *style, uint8_t
 static inline css_error set_text_indent(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[TEXT_INDENT_INDEX];
+       uint32_t *bits = &style->i.bits[TEXT_INDENT_INDEX];
        
        /* 6bits: uuuuut : unit | type */
        *bits = (*bits & ~TEXT_INDENT_MASK) | ((((uint32_t)type & 0x1) | (unit
@@ -2276,9 +2090,7 @@ static inline css_error 
set_text_indent(css_computed_style *style, uint8_t
 static inline css_error set_text_transform(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
+       uint32_t *bits = &style->i.bits[TEXT_TRANSFORM_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~TEXT_TRANSFORM_MASK) | (((uint32_t)type & 0x7) <<
@@ -2297,9 +2109,7 @@ static inline css_error 
set_text_transform(css_computed_style *style, uint8_t
 static inline css_error set_top(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[TOP_INDEX];
+       uint32_t *bits = &style->i.bits[TOP_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~TOP_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2320,9 +2130,7 @@ static inline css_error set_top(css_computed_style 
*style, uint8_t type,
 static inline css_error set_unicode_bidi(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[UNICODE_BIDI_INDEX];
+       uint32_t *bits = &style->i.bits[UNICODE_BIDI_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~UNICODE_BIDI_MASK) | (((uint32_t)type & 0x3) <<
@@ -2341,9 +2149,7 @@ static inline css_error 
set_unicode_bidi(css_computed_style *style, uint8_t
 static inline css_error set_vertical_align(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
+       uint32_t *bits = &style->i.bits[VERTICAL_ALIGN_INDEX];
        
        /* 9bits: uuuuutttt : unit | type */
        *bits = (*bits & ~VERTICAL_ALIGN_MASK) | ((((uint32_t)type & 0xf) | (
@@ -2363,9 +2169,7 @@ static inline css_error 
set_vertical_align(css_computed_style *style, uint8_t
 
 static inline css_error set_visibility(css_computed_style *style, uint8_t type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[VISIBILITY_INDEX];
+       uint32_t *bits = &style->i.bits[VISIBILITY_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~VISIBILITY_MASK) | (((uint32_t)type & 0x3) <<
@@ -2383,9 +2187,7 @@ static inline css_error set_visibility(css_computed_style 
*style, uint8_t type)
 
 static inline css_error set_white_space(css_computed_style *style, uint8_t 
type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[WHITE_SPACE_INDEX];
+       uint32_t *bits = &style->i.bits[WHITE_SPACE_INDEX];
        
        /* 3bits: ttt : type */
        *bits = (*bits & ~WHITE_SPACE_MASK) | (((uint32_t)type & 0x7) <<
@@ -2404,9 +2206,7 @@ static inline css_error 
set_white_space(css_computed_style *style, uint8_t type)
 static inline css_error set_widows(css_computed_style *style, uint8_t type,
                int32_t integer)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[WIDOWS_INDEX];
+       uint32_t *bits = &style->i.bits[WIDOWS_INDEX];
        
        /* 1bit: t : type */
        *bits = (*bits & ~WIDOWS_MASK) | (((uint32_t)type & 0x1) <<
@@ -2427,9 +2227,7 @@ static inline css_error set_widows(css_computed_style 
*style, uint8_t type,
 static inline css_error set_width(css_computed_style *style, uint8_t type,
                css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[WIDTH_INDEX];
+       uint32_t *bits = &style->i.bits[WIDTH_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~WIDTH_MASK) | ((((uint32_t)type & 0x3) | (unit << 2))
@@ -2450,9 +2248,7 @@ static inline css_error set_width(css_computed_style 
*style, uint8_t type,
 static inline css_error set_word_spacing(css_computed_style *style, uint8_t
                type, css_fixed length, css_unit unit)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[WORD_SPACING_INDEX];
+       uint32_t *bits = &style->i.bits[WORD_SPACING_INDEX];
        
        /* 7bits: uuuuutt : unit | type */
        *bits = (*bits & ~WORD_SPACING_MASK) | ((((uint32_t)type & 0x3) | (unit
@@ -2473,9 +2269,7 @@ static inline css_error 
set_word_spacing(css_computed_style *style, uint8_t
 static inline css_error set_writing_mode(css_computed_style *style, uint8_t
                type)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[WRITING_MODE_INDEX];
+       uint32_t *bits = &style->i.bits[WRITING_MODE_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~WRITING_MODE_MASK) | (((uint32_t)type & 0x3) <<
@@ -2494,9 +2288,7 @@ static inline css_error 
set_writing_mode(css_computed_style *style, uint8_t
 static inline css_error set_z_index(css_computed_style *style, uint8_t type,
                int32_t integer)
 {
-       uint32_t *bits;
-       
-       bits = &style->i.bits[Z_INDEX_INDEX];
+       uint32_t *bits = &style->i.bits[Z_INDEX_INDEX];
        
        /* 2bits: tt : type */
        *bits = (*bits & ~Z_INDEX_MASK) | (((uint32_t)type & 0x3) <<
diff --git a/src/select/select_generator.py b/src/select/select_generator.py
index 05a4511..9e92909 100644
--- a/src/select/select_generator.py
+++ b/src/select/select_generator.py
@@ -322,18 +322,16 @@ class CSSProperty:
         """
         vals = []
         for v in self.values:
+            star = '*' if pointer else ''
             vt, vn = shift_star(v.type, v.name)
-            vn += v.suffix
+            vn = star + vn + v.suffix
             if pointer:
-                vn = '*' + vn
                 if v.name == 'counter_arr' or v.name == 'content_item':
                     vt = 'const ' + vt
             vals.append((vt, vn))
             if v.bits is not None:
-                bt, bn = shift_star(v.bits['type'], v.bits['name'])
-                bn += v.suffix
-                if pointer:
-                    bn = '*' + bn
+                bt = v.bits['type']
+                bn = star + v.bits['name'] + v.suffix
                 vals.append((bt, bn))
         return vals
 
@@ -429,21 +427,12 @@ class CSSGroup:
 
         return bits_array
 
-    def get_idot_grp(self):
-        """Make parameters for accessing bits and values in this group."""
-        i_dot = '' if self.name == 'page' else 'i.'
-        grp = '' if self.name == 'style' else '->{}{}'.format(
-            '' if self.name == 'page' else i_dot, self.name)
-        return (i_dot, grp)
-
     def make_computed_h(self):
         """Output this group's text for the computed.h file."""
         t = Text()
         t.append()
 
-        typedef = 'typedef ' if self.name == 'page' else ''
-        t.append('{}struct css_computed_{}{} {{'.format(
-            typedef, self.name, '' if self.name == 'page' else '_i'))
+        t.append('struct css_computed_style_i {')
 
         t.comment()
         commented = []
@@ -490,103 +479,28 @@ class CSSGroup:
         t.append()
         t.append(self.make_value_declaration(for_commented=False))
 
-        if self.name == 'style':
-            t.append()
-            for g in css_groups:
-                if g.name != 'style' and g.name != 'page':
-                    t.append('css_computed_{0} *{0};'.format(g.name))
-
         t.indent(-1)
-        t.append('}}{};'.format(
-            ' css_computed_' + self.name if typedef else ''))
+        t.append('};')
 
-        if self.name != 'page':
-            typedef = 'typedef ' if self.name != 'style' else ''
-            t.append()
-            t.append('{}struct css_computed_{} {{'.format(
-                     typedef, self.name))
-            t.indent(1)
-            t.append('struct css_computed_' + self.name + '_i i;')
-            t.append()
-            t.append(self.make_value_declaration(for_commented=True))
-            t.append()
+        t.append()
+        t.append('struct css_computed_style {')
+        t.indent(1)
+        t.append('struct css_computed_style_i i;')
+        t.append()
+        t.append(self.make_value_declaration(for_commented=True))
+        t.append()
 
-            t.append('struct css_computed_' + self.name + ' *next;')
-            t.append('uint32_t count;')
-            t.append('uint32_t bin;')
-            t.indent(-1)
-            t.append('}}{};'.format(
-                ' css_computed_' + self.name if typedef else ''))
+        t.append('struct css_computed_style *next;')
+        t.append('uint32_t count;')
+        t.append('uint32_t bin;')
+        t.indent(-1)
+        t.append('};')
 
         return t.to_string()
 
     def make_propset_h(self):
-        """Output this group's property functions for the propset.h file.
-
-        If group is not `style`, will also output the defaults
-        and the ENSURE_{group} texts.
-        """
+        """Output this group's property functions for the propset.h file."""
         t = Text()
-        i_dot, grp = self.get_idot_grp()
-
-        if self.name != 'style':
-            t.append('static const css_computed_{0} default_{0} = {{'.format(
-                self.name))
-            t.indent(1)
-
-            if self.name != 'page':
-                t.append('.i = {')
-                t.indent(1)
-
-            t.append('.bits = {') 
-            t.indent(1)
-
-            bits_ops = []
-            for b in self.bits_array:
-                or_ops = []
-                for p in b.contents:
-                    or_ops.append('({} << {})'.format(p.defaults, str(p.shift))
-                                  if p.shift else p.defaults)
-                bits_ops.append(' | '.join(or_ops))
-
-            t.append(',\n'.join(bits_ops).split('\n'))
-            t.indent(-1)
-            t.append('},')
-            t.append(',\n'.join(
-                self.make_value_declaration(False, True)).split('\n'))
-
-            if self.name != 'page':
-                t.indent(-1)
-                t.append('},')
-                t.append(',\n'.join(
-                    self.make_value_declaration(True, True) +
-                    [ '.next = NULL', '.count = 0', '.bin = UINT32_MAX' ]
-                    ).split('\n'))
-
-            t.indent(-1)
-            t.append('};')
-
-            t.append()
-            t.escape_newline()
-            t.append('#define ENSURE_{} do {{'.format(self.name.upper()))
-            t.indent(1)
-            t.append('if (style->{}{} == NULL) {{'.format(i_dot, self.name))
-            t.indent(1)
-            t.append('style->{}{n} = malloc(sizeof(css_computed_{n}));'.format(
-                i_dot, n=self.name))
-            t.append('if (style->{}{} == NULL)'.format(i_dot, self.name))
-            t.indent(1)
-            t.append('return CSS_NOMEM;')
-            t.indent(-1)
-            t.append()
-            t.append('memcpy(style->{}{n}, &default_{n}, '
-                     'sizeof(css_computed_{n}));'.format(i_dot, n=self.name))
-            t.indent(-1)
-            t.append('}')
-            t.indent(-1)
-            t.append('} while(0)')
-            t.escape_newline()
-            t.append()
 
         for p in sorted(self.props, key=(lambda x: x.name)):
             defines, undefs = p.def_undefs
@@ -608,15 +522,7 @@ class CSSGroup:
             t.append('{')
             t.indent(1)
 
-            t.append('uint32_t *bits;')
-            t.append()
-
-            if self.name != 'style':
-                t.append('ENSURE_{};'.format(self.name.upper()))
-                t.append()
-
-            t.append('bits = &style{}->{}bits[{}_INDEX];'.format(
-                grp, i_dot, p.name.upper()))
+            t.append('uint32_t *bits = 
&style->i.bits[{}_INDEX];'.format(p.name.upper()))
             t.append()
 
             type_mask, shift_list, bits_comment = p.get_bits()
@@ -637,19 +543,17 @@ class CSSGroup:
                 old_t, old_n_shift = shift_star(v.type, old_n)
 
                 if v.name == 'string':
-                    t.append('{} {} = style{}->{}{};'.format(
-                        old_t, old_n_shift,
-                        grp, i_dot, p.name + v.suffix))
+                    t.append('{} {} = style->i.{};'.format(
+                        old_t, old_n_shift, p.name + v.suffix))
                     t.append()
                     t.append('if ({} != NULL) {{'.format(v.name + v.suffix))
                     t.indent(1)
-                    t.append('style{}->{}{} = lwc_string_ref({});'.format(
-                        grp, i_dot, p.name + v.suffix, v.name + v.suffix))
+                    t.append('style->i.{} = lwc_string_ref({});'.format(
+                        p.name + v.suffix, v.name + v.suffix))
                     t.indent(-1)
                     t.append('} else {')
                     t.indent(1)
-                    t.append('style{}->{}{} = NULL;'.format(
-                        grp, i_dot, p.name + v.suffix))
+                    t.append('style->i.{} = NULL;'.format(p.name + v.suffix))
                     t.indent(-1)
                     t.append('}')
                     t.append()
@@ -661,9 +565,9 @@ class CSSGroup:
                 elif v.name == 'string_arr' or v.name == 'counter_arr':
                     iter_var = 's' if v.name == 'string_arr' else 'c'
                     iter_deref = '*s' if v.name == 'string_arr' else 'c->name'
-                    t.append('{} {} = style{}->{};'.format(
+                    t.append('{} {} = style->{};'.format(
                         old_t, old_n_shift,
-                        grp, p.name + v.suffix))
+                        p.name + v.suffix))
                     t.append('{} {};'.format(old_t,
                                              shift_star(v.type, iter_var)[1]))
                     t.append()
@@ -674,8 +578,8 @@ class CSSGroup:
                     t.append('{0} = lwc_string_ref({0});'.format(iter_deref))
                     t.indent(-1)
                     t.append()
-                    t.append('style{}->{} = {};'.format(
-                        grp, p.name + v.suffix, v.name + v.suffix))
+                    t.append('style->{} = {};'.format(
+                        p.name + v.suffix, v.name + v.suffix))
                     t.append()
                     t.append('/* Free existing array */')
                     t.append('if ({} != NULL) {{'.format(old_n))
@@ -693,8 +597,8 @@ class CSSGroup:
                     t.append('}')
 
                 elif not v.is_ptr:
-                    t.append('style{}->{}{} = {};'.format(
-                        grp, i_dot, p.name + v.suffix, v.name + v.suffix))
+                    t.append('style->i.{} = {};'.format(
+                        p.name + v.suffix, v.name + v.suffix))
 
                 else:
                     raise ValueError('Cannot handle value ' + v.name +'!')
@@ -708,23 +612,18 @@ class CSSGroup:
         return t.to_string()
 
     def print_propget(self, t, p, only_bits=False):
-        i_dot, grp = self.get_idot_grp()
-
         vals = [] if only_bits else p.get_param_values(pointer=True)
         params = ', '.join([ 'css_computed_style *style' ]
                            + [ ' '.join(x) for x in vals ])
+
         underscore_bits = '_bits' if only_bits else ''
         t.append('static inline uint8_t get_{}{}(const {})'.format(
             p.name, underscore_bits, params))
         t.append('{')
         t.indent(1)
 
-        if self.name != 'style':
-            t.append('if (style{} != NULL) {{'.format(grp))
-            t.indent(1)
-
-        t.append('uint32_t bits = style{}->{}bits[{}_INDEX];'.format(
-            grp, i_dot, p.name.upper()))
+        t.append('uint32_t bits = style->i.bits[{}_INDEX];'.format(
+            p.name.upper()))
         t.append('bits &= {}_MASK;'.format(p.name.upper()))
         t.append('bits >>= {}_SHIFT;'.format(p.name.upper()))
         t.append()
@@ -733,16 +632,15 @@ class CSSGroup:
         t.append(bits_comment)
 
         if only_bits == False:
-
             if p.condition:
                 t.append('if ((bits & {}) == {}) {{'.format(
                     type_mask, p.condition))
                 t.indent(1)
 
             for v in p.values:
-                this_idot = '' if v.is_ptr and v.name != 'string' else i_dot
-                t.append('*{} = style{}->{}{};'.format(
-                    v.name + v.suffix, grp, this_idot, p.name + v.suffix))
+                i_dot = '' if v.is_ptr and v.name != 'string' else 'i.'
+                t.append('*{} = style->{}{};'.format(
+                    v.name + v.suffix, i_dot, p.name + v.suffix))
             for i, v in enumerate(list(reversed(shift_list))):
                 if i == 0:
                     t.append('*{} = bits >> {};'.format(v[0], v[1]))
@@ -757,18 +655,6 @@ class CSSGroup:
 
         t.append('return (bits & {});'.format(type_mask))
 
-        if self.name != 'style':
-            t.indent(-1)
-            t.append('}')
-            t.append()
-            t.append('/* Initial value */')
-            for v in p.values:
-                t.append('*{} = {};'.format(v.name + v.suffix, v.defaults))
-                if v.bits is not None:
-                    t.append('*{} = {};'.format(
-                        v.bits['name'] + v.suffix, v.bits['defaults']))
-                t.append('return {};'.format(p.defaults))
-
         t.indent(-1)
         t.append('}')
 
@@ -793,7 +679,7 @@ class CSSGroup:
 
         return t.to_string()
 
-    def make_value_declaration(self, for_commented, defaults=False):
+    def make_value_declaration(self, for_commented):
         """Output declarations of values for this group's properties.
 
         Args:
@@ -805,12 +691,8 @@ class CSSGroup:
         for p in sorted(self.props, key=(lambda x: x.name)):
             if bool(p.comments) == for_commented:
                 for v in p.values:
-                    if defaults:
-                        r.append('.{}{} = {}'.format(p.name, v.suffix,
-                                                     v.defaults))
-                    else:
-                        v_type, v_name = shift_star(v.type, p.name)
-                        r.append('{} {}{};'.format(v_type, v_name, v.suffix))
+                    v_type, v_name = shift_star(v.type, p.name)
+                    r.append('{} {}{};'.format(v_type, v_name, v.suffix))
         return r
 
     def make_text(self, filename):


-- 
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to