diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2017-02-04 17:57:47 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2018-07-28 15:27:12 +0100 |
commit | d395468875d27c5df5b5f6ec838ad623bc6a5a41 (patch) | |
tree | 4396ba5801aba4d3c5aede17455f3320dfd79a51 | |
parent | e1e68795ebcd243a08cf493f5a6f95558b0f7fdc (diff) | |
download | libcss-d395468875d27c5df5b5f6ec838ad623bc6a5a41.tar.gz libcss-d395468875d27c5df5b5f6ec838ad623bc6a5a41.tar.bz2 |
Units: parse new unit names
-rw-r--r-- | src/bytecode/bytecode.h | 8 | ||||
-rw-r--r-- | src/parse/properties/utils.c | 8 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/bytecode/bytecode.h b/src/bytecode/bytecode.h index 422f141..22703f7 100644 --- a/src/bytecode/bytecode.h +++ b/src/bytecode/bytecode.h @@ -52,6 +52,7 @@ typedef enum unit { UNIT_DEG = (1 << 9) + 0, UNIT_GRAD = (1 << 9) + 1, UNIT_RAD = (1 << 9) + 2, + UNIT_TURN = (1 << 9) + 3, UNIT_TIME = (1 << 10), UNIT_MS = (1 << 10) + 0, @@ -59,7 +60,12 @@ typedef enum unit { UNIT_FREQ = (1 << 11), UNIT_HZ = (1 << 11) + 0, - UNIT_KHZ = (1 << 11) + 1 + UNIT_KHZ = (1 << 11) + 1, + + UNIT_RESOLUTION = (1 << 12), + UNIT_DPI = (1 << 12) + 0, + UNIT_DPCM = (1 << 12) + 1, + UNIT_DPPX = (1 << 12) + 2, } unit; typedef uint32_t colour; diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c index 7abef24..0e49853 100644 --- a/src/parse/properties/utils.c +++ b/src/parse/properties/utils.c @@ -1007,6 +1007,12 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit) if (len == 4) { if (strncasecmp(ptr, "grad", 4) == 0) *unit = UNIT_GRAD; + else if (strncasecmp(ptr, "turn", 4) == 0) + *unit = UNIT_TURN; + else if (strncasecmp(ptr, "dppx", 4) == 0) + *unit = UNIT_DPPX; + else if (strncasecmp(ptr, "dpcm", 4) == 0) + *unit = UNIT_DPCM; else if (strncasecmp(ptr, "vmin", 4) == 0) *unit = UNIT_VMIN; else if (strncasecmp(ptr, "vmax", 4) == 0) @@ -1026,6 +1032,8 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit) *unit = UNIT_REM; else if (strncasecmp(ptr, "rlh", 3) == 0) *unit = UNIT_RLH; + else if (strncasecmp(ptr, "dpi", 3) == 0) + *unit = UNIT_DPI; else return CSS_INVALID; } else if (len == 2) { |