diff options
author | Lucas Neves <lcneves@gmail.com> | 2017-11-13 21:19:03 +0000 |
---|---|---|
committer | Lucas Neves <lcneves@gmail.com> | 2017-11-13 21:19:03 +0000 |
commit | dfbf50683125344885c26d5d7407356d97f54651 (patch) | |
tree | 031e2d8b8f13cc7ff06a5f3ba94d8c1f21f6d38f /src/parse/properties/utils.c | |
parent | 3f00f3b7c6f2492600feb7bce70e1ae6ca8f4475 (diff) | |
download | libcss-dfbf50683125344885c26d5d7407356d97f54651.tar.gz libcss-dfbf50683125344885c26d5d7407356d97f54651.tar.bz2 |
Add support for new length units.
Diffstat (limited to 'src/parse/properties/utils.c')
-rw-r--r-- | src/parse/properties/utils.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c index 47b06e3..76b406b 100644 --- a/src/parse/properties/utils.c +++ b/src/parse/properties/utils.c @@ -1007,6 +1007,10 @@ 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, "vmin", 4) == 0) + *unit = UNIT_VMIN; + else if (strncasecmp(ptr, "vmax", 4) == 0) + *unit = UNIT_VMAX; else return CSS_INVALID; } else if (len == 3) { @@ -1016,6 +1020,12 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit) *unit = UNIT_DEG; else if (strncasecmp(ptr, "rad", 3) == 0) *unit = UNIT_RAD; + else if (strncasecmp(ptr, "cap", 3) == 0) + *unit = UNIT_CAP; + else if (strncasecmp(ptr, "rem", 3) == 0) + *unit = UNIT_REM; + else if (strncasecmp(ptr, "rlh", 3) == 0) + *unit = UNIT_RLH; else return CSS_INVALID; } else if (len == 2) { @@ -1039,11 +1049,27 @@ css_error css__parse_unit_keyword(const char *ptr, size_t len, uint32_t *unit) *unit = UNIT_PT; else if (strncasecmp(ptr, "pc", 2) == 0) *unit = UNIT_PC; + else if (strncasecmp(ptr, "ch", 2) == 0) + *unit = UNIT_CH; + else if (strncasecmp(ptr, "ic", 2) == 0) + *unit = UNIT_IC; + else if (strncasecmp(ptr, "lh", 2) == 0) + *unit = UNIT_LH; + else if (strncasecmp(ptr, "vh", 2) == 0) + *unit = UNIT_VH; + else if (strncasecmp(ptr, "vw", 2) == 0) + *unit = UNIT_VW; + else if (strncasecmp(ptr, "vi", 2) == 0) + *unit = UNIT_VI; + else if (strncasecmp(ptr, "vb", 2) == 0) + *unit = UNIT_VB; else return CSS_INVALID; } else if (len == 1) { if (strncasecmp(ptr, "s", 1) == 0) *unit = UNIT_S; + else if (strncasecmp(ptr, "q", 1) == 0) + *unit = UNIT_Q; else return CSS_INVALID; } else |