From 3c0c6b6def402f0c0b654974e193c8c4bf55047f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 3 Nov 2022 08:56:43 +0000 Subject: properties: position: Add support for 'sticky' value --- docs/Bytecode | 1 + include/libcss/properties.h | 3 ++- src/bytecode/opcodes.h | 3 ++- src/parse/properties/properties.gen | 2 +- src/parse/propstrings.c | 1 + src/parse/propstrings.h | 2 +- src/select/properties/position.c | 3 +++ 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/Bytecode b/docs/Bytecode index e547b17..67450cd 100644 --- a/docs/Bytecode +++ b/docs/Bytecode @@ -876,6 +876,7 @@ Opcodes 1 => relative, 2 => absolute, 3 => fixed, + 4 => sticky, other => Reserved for future expansion. 4a - quotes diff --git a/include/libcss/properties.h b/include/libcss/properties.h index e056a75..f600bcc 100644 --- a/include/libcss/properties.h +++ b/include/libcss/properties.h @@ -763,7 +763,8 @@ enum css_position_e { CSS_POSITION_STATIC = 0x1, CSS_POSITION_RELATIVE = 0x2, CSS_POSITION_ABSOLUTE = 0x3, - CSS_POSITION_FIXED = 0x4 + CSS_POSITION_FIXED = 0x4, + CSS_POSITION_STICKY = 0x5 }; enum css_quotes_e { diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h index 52886b9..b82172f 100644 --- a/src/bytecode/opcodes.h +++ b/src/bytecode/opcodes.h @@ -665,7 +665,8 @@ enum op_position { POSITION_STATIC = 0x0000, POSITION_RELATIVE = 0x0001, POSITION_ABSOLUTE = 0x0002, - POSITION_FIXED = 0x0003 + POSITION_FIXED = 0x0003, + POSITION_STICKY = 0x0004 }; enum op_quotes { diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen index a001370..b0e797c 100644 --- a/src/parse/properties/properties.gen +++ b/src/parse/properties/properties.gen @@ -148,7 +148,7 @@ pitch:CSS_PROP_PITCH IDENT:( INHERIT: INITIAL: REVERT: UNSET: X_LOW:0,PITCH_X_LO pitch_range:CSS_PROP_PITCH_RANGE IDENT:( INHERIT: INITIAL: REVERT: UNSET: IDENT:) NUMBER:( false:PITCH_RANGE_SET RANGE:num<0||num>F_100 NUMBER:) -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 IDENT:) +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:) diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c index 2cac65f..786a3b7 100644 --- a/src/parse/propstrings.c +++ b/src/parse/propstrings.c @@ -488,6 +488,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = { SMAP("infinite"), SMAP("grid"), SMAP("inline-grid"), + SMAP("sticky"), SMAP("aliceblue"), SMAP("antiquewhite"), diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h index 6c84f71..6d6dd49 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, + GRID, INLINE_GRID, STICKY, /* Named colours */ FIRST_COLOUR, diff --git a/src/select/properties/position.c b/src/select/properties/position.c index 738dbff..cc4b3e7 100644 --- a/src/select/properties/position.c +++ b/src/select/properties/position.c @@ -35,6 +35,9 @@ css_error css__cascade_position(uint32_t opv, css_style *style, case POSITION_FIXED: value = CSS_POSITION_FIXED; break; + case POSITION_STICKY: + value = CSS_POSITION_STICKY; + break; } } -- cgit v1.2.1