summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Neves <lcneves@gmail.com>2017-08-27 23:29:59 (GMT)
committer Lucas Neves <lcneves@gmail.com>2017-09-26 01:56:33 (GMT)
commitba72b2061e3142a1ea17d51d2020c0cb45d752f7 (patch)
treecd5411f27176f794d2e657e638c679aa43293088
parent6128da4f4dc74f1a77f99ce4eea06a1dd55d2125 (diff)
downloadlibcss-ba72b2061e3142a1ea17d51d2020c0cb45d752f7.tar.gz
libcss-ba72b2061e3142a1ea17d51d2020c0cb45d752f7.tar.bz2
Implements parse and select for flexbox properties.
-rw-r--r--docs/Bytecode3
-rw-r--r--include/libcss/properties.h96
-rw-r--r--src/bytecode/opcodes.h78
-rw-r--r--src/parse/properties/properties.c13
-rw-r--r--src/parse/properties/properties.gen26
-rw-r--r--src/parse/properties/properties.h37
-rw-r--r--src/parse/propstrings.c25
-rw-r--r--src/parse/propstrings.h48
-rw-r--r--src/select/computed.h35
-rw-r--r--src/select/dispatch.c50
-rw-r--r--src/select/properties/Makefile10
-rw-r--r--src/select/properties/properties.h10
12 files changed, 386 insertions, 45 deletions
diff --git a/docs/Bytecode b/docs/Bytecode
index 699aae8..01d4cff 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -1266,7 +1266,8 @@ Opcodes
2 => flex-end,
3 => center,
4 => space-between,
- 5 => space-around
+ 5 => space-around,
+ 6 => space-evenly
other => Reserved for future expansion.
73 - align-items
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index 06c033f..2163068 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -128,10 +128,49 @@ enum css_properties_e {
CSS_PROP_WRITING_MODE = 0x06f,
CSS_PROP_OVERFLOW_Y = 0x070,
CSS_PROP_BOX_SIZING = 0x071,
+ CSS_PROP_ALIGN_CONTENT = 0x072,
+ CSS_PROP_ALIGN_ITEMS = 0x073,
+ CSS_PROP_ALIGN_SELF = 0x074,
+ CSS_PROP_FLEX_BASIS = 0x075,
+ CSS_PROP_FLEX_DIRECTION = 0x076,
+ CSS_PROP_FLEX_GROW = 0x077,
+ CSS_PROP_FLEX_SHRINK = 0x078,
+ CSS_PROP_FLEX_WRAP = 0x079,
+ CSS_PROP_JUSTIFY_CONTENT = 0x07a,
+ CSS_PROP_ORDER = 0x07b,
CSS_N_PROPERTIES
};
+enum css_align_content_e {
+ CSS_ALIGN_CONTENT_INHERIT = 0x0,
+ CSS_ALIGN_CONTENT_STRETCH = 0x1,
+ CSS_ALIGN_CONTENT_FLEX_START = 0x2,
+ CSS_ALIGN_CONTENT_FLEX_END = 0x3,
+ CSS_ALIGN_CONTENT_CENTER = 0x4,
+ CSS_ALIGN_CONTENT_SPACE_BETWEEN = 0x5,
+ CSS_ALIGN_CONTENT_SPACE_AROUND = 0x6,
+ CSS_ALIGN_CONTENT_SPACE_EVENLY = 0x7
+};
+
+enum css_align_items_e {
+ CSS_ALIGN_ITEMS_INHERIT = 0x0,
+ CSS_ALIGN_ITEMS_STRETCH = 0x1,
+ CSS_ALIGN_ITEMS_FLEX_START = 0x2,
+ CSS_ALIGN_ITEMS_FLEX_END = 0x3,
+ CSS_ALIGN_ITEMS_CENTER = 0x4,
+ CSS_ALIGN_ITEMS_BASELINE = 0x5
+};
+
+enum css_align_self_e {
+ CSS_ALIGN_SELF_INHERIT = 0x0,
+ CSS_ALIGN_SELF_STRETCH = 0x1,
+ CSS_ALIGN_SELF_FLEX_START = 0x2,
+ CSS_ALIGN_SELF_FLEX_END = 0x3,
+ CSS_ALIGN_SELF_CENTER = 0x4,
+ CSS_ALIGN_SELF_BASELINE = 0x5,
+ CSS_ALIGN_SELF_AUTO = 0x6
+};
enum css_background_attachment_e {
CSS_BACKGROUND_ATTACHMENT_INHERIT = 0x0,
@@ -399,7 +438,9 @@ enum css_display_e {
CSS_DISPLAY_TABLE_COLUMN = 0x0d,
CSS_DISPLAY_TABLE_CELL = 0x0e,
CSS_DISPLAY_TABLE_CAPTION = 0x0f,
- CSS_DISPLAY_NONE = 0x10
+ CSS_DISPLAY_NONE = 0x10,
+ CSS_DISPLAY_FLEX = 0x11,
+ CSS_DISPLAY_INLINE_FLEX = 0x12
};
enum css_empty_cells_e {
@@ -408,6 +449,38 @@ enum css_empty_cells_e {
CSS_EMPTY_CELLS_HIDE = 0x2
};
+enum css_flex_basis_e {
+ CSS_FLEX_BASIS_INHERIT = 0x0,
+ CSS_FLEX_BASIS_AUTO = 0x1,
+ CSS_FLEX_BASIS_CONTENT = 0x2,
+ CSS_FLEX_BASIS_SET = 0x3
+};
+
+enum css_flex_direction_e {
+ CSS_FLEX_DIRECTION_INHERIT = 0x0,
+ CSS_FLEX_DIRECTION_ROW = 0x1,
+ CSS_FLEX_DIRECTION_ROW_REVERSE = 0x2,
+ CSS_FLEX_DIRECTION_COLUMN = 0x3,
+ CSS_FLEX_DIRECTION_COLUMN_REVERSE = 0x4
+};
+
+enum css_flex_grow_e {
+ CSS_FLEX_GROW_INHERIT = 0x0,
+ CSS_FLEX_GROW_SET = 0x1
+};
+
+enum css_flex_shrink_e {
+ CSS_FLEX_SHRINK_INHERIT = 0x0,
+ CSS_FLEX_SHRINK_SET = 0x1
+};
+
+enum css_flex_wrap_e {
+ CSS_FLEX_WRAP_INHERIT = 0x0,
+ CSS_FLEX_WRAP_NOWRAP = 0x1,
+ CSS_FLEX_WRAP_WRAP = 0x2,
+ CSS_FLEX_WRAP_WRAP_REVERSE = 0x3
+};
+
enum css_float_e {
CSS_FLOAT_INHERIT = 0x0,
CSS_FLOAT_LEFT = 0x1,
@@ -475,6 +548,16 @@ enum css_height_e {
CSS_HEIGHT_AUTO = 0x2
};
+enum css_justify_content_e {
+ CSS_JUSTIFY_CONTENT_INHERIT = 0x0,
+ CSS_JUSTIFY_CONTENT_FLEX_START = 0x1,
+ CSS_JUSTIFY_CONTENT_FLEX_END = 0x2,
+ CSS_JUSTIFY_CONTENT_CENTER = 0x3,
+ CSS_JUSTIFY_CONTENT_SPACE_BETWEEN = 0x4,
+ CSS_JUSTIFY_CONTENT_SPACE_AROUND = 0x5,
+ CSS_JUSTIFY_CONTENT_SPACE_EVENLY = 0x6
+};
+
enum css_left_e {
CSS_LEFT_INHERIT = 0x0,
CSS_LEFT_SET = 0x1,
@@ -546,12 +629,14 @@ enum css_max_width_e {
enum css_min_height_e {
CSS_MIN_HEIGHT_INHERIT = 0x0,
- CSS_MIN_HEIGHT_SET = 0x1
+ CSS_MIN_HEIGHT_SET = 0x1,
+ CSS_MIN_HEIGHT_AUTO = 0x2
};
enum css_min_width_e {
CSS_MIN_WIDTH_INHERIT = 0x0,
- CSS_MIN_WIDTH_SET = 0x1
+ CSS_MIN_WIDTH_SET = 0x1,
+ CSS_MIN_WIDTH_AUTO = 0x2
};
enum css_opacity_e {
@@ -559,6 +644,11 @@ enum css_opacity_e {
CSS_OPACITY_SET = 0x1
};
+enum css_order_e {
+ CSS_ORDER_INHERIT = 0x0,
+ CSS_ORDER_SET = 0x1
+};
+
enum css_outline_color_e {
CSS_OUTLINE_COLOR_INHERIT = CSS_BACKGROUND_COLOR_INHERIT,
CSS_OUTLINE_COLOR_COLOR = CSS_BACKGROUND_COLOR_COLOR,
diff --git a/src/bytecode/opcodes.h b/src/bytecode/opcodes.h
index 64ea482..82bf75f 100644
--- a/src/bytecode/opcodes.h
+++ b/src/bytecode/opcodes.h
@@ -10,6 +10,33 @@
#include <inttypes.h>
+enum op_align_content {
+ ALIGN_CONTENT_STRETCH = 0x0000,
+ ALIGN_CONTENT_FLEX_START = 0x0001,
+ ALIGN_CONTENT_FLEX_END = 0x0002,
+ ALIGN_CONTENT_CENTER = 0x0003,
+ ALIGN_CONTENT_SPACE_BETWEEN = 0x0004,
+ ALIGN_CONTENT_SPACE_AROUND = 0x0005,
+ ALIGN_CONTENT_SPACE_EVENLY = 0x0006
+};
+
+enum op_align_items {
+ ALIGN_ITEMS_STRETCH = 0x0000,
+ ALIGN_ITEMS_FLEX_START = 0x0001,
+ ALIGN_ITEMS_FLEX_END = 0x0002,
+ ALIGN_ITEMS_CENTER = 0x0003,
+ ALIGN_ITEMS_BASELINE = 0x0004
+};
+
+enum op_align_self {
+ ALIGN_SELF_STRETCH = 0x0000,
+ ALIGN_SELF_FLEX_START = 0x0001,
+ ALIGN_SELF_FLEX_END = 0x0002,
+ ALIGN_SELF_CENTER = 0x0003,
+ ALIGN_SELF_BASELINE = 0x0004,
+ ALIGN_SELF_AUTO = 0x0005
+};
+
enum op_azimuth {
AZIMUTH_ANGLE = 0x0080,
@@ -303,7 +330,9 @@ enum op_display {
DISPLAY_TABLE_COLUMN = 0x000c,
DISPLAY_TABLE_CELL = 0x000d,
DISPLAY_TABLE_CAPTION = 0x000e,
- DISPLAY_NONE = 0x000f
+ DISPLAY_NONE = 0x000f,
+ DISPLAY_FLEX = 0x0010,
+ DISPLAY_INLINE_FLEX = 0x0011
};
enum op_elevation {
@@ -320,6 +349,33 @@ enum op_empty_cells {
EMPTY_CELLS_HIDE = 0x0001
};
+enum op_flex_basis {
+ FLEX_BASIS_AUTO = 0x0000,
+ FLEX_BASIS_CONTENT = 0x0001,
+ FLEX_BASIS_SET = 0x0080
+};
+
+enum op_flex_direction {
+ FLEX_DIRECTION_ROW = 0x0000,
+ FLEX_DIRECTION_ROW_REVERSE = 0x0001,
+ FLEX_DIRECTION_COLUMN = 0x0002,
+ FLEX_DIRECTION_COLUMN_REVERSE = 0x0003
+};
+
+enum op_flex_grow {
+ FLEX_GROW_SET = 0x0080
+};
+
+enum op_flex_shrink {
+ FLEX_SHRINK_SET = 0x0080
+};
+
+enum op_flex_wrap {
+ FLEX_WRAP_NOWRAP = 0x0000,
+ FLEX_WRAP_WRAP = 0x0001,
+ FLEX_WRAP_WRAP_REVERSE = 0x0002
+};
+
enum op_float {
FLOAT_LEFT = 0x0000,
FLOAT_RIGHT = 0x0001,
@@ -385,6 +441,15 @@ enum op_height {
HEIGHT_AUTO = 0x0000
};
+enum op_justify_content {
+ JUSTIFY_CONTENT_FLEX_START = 0x0000,
+ JUSTIFY_CONTENT_FLEX_END = 0x0001,
+ JUSTIFY_CONTENT_CENTER = 0x0002,
+ JUSTIFY_CONTENT_SPACE_BETWEEN = 0x0003,
+ JUSTIFY_CONTENT_SPACE_AROUND = 0x0004,
+ JUSTIFY_CONTENT_SPACE_EVENLY = 0x0005
+};
+
enum op_left {
LEFT_SET = BOTTOM_SET,
LEFT_AUTO = BOTTOM_AUTO
@@ -445,17 +510,23 @@ enum op_max_width {
};
enum op_min_height {
- MIN_HEIGHT_SET = 0x0080
+ MIN_HEIGHT_SET = 0x0080,
+ MIN_HEIGHT_AUTO = 0x0000
};
enum op_min_width {
- MIN_WIDTH_SET = 0x0080
+ MIN_WIDTH_SET = 0x0080,
+ MIN_WIDTH_AUTO = 0x0000
};
enum op_opacity {
OPACITY_SET = 0x0080
};
+enum op_order {
+ ORDER_SET = 0x0080
+};
+
enum op_orphans {
ORPHANS_SET = 0x0080
};
@@ -735,4 +806,3 @@ enum op_z_index {
};
#endif
-
diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c
index f32e374..3f374fa 100644
--- a/src/parse/properties/properties.c
+++ b/src/parse/properties/properties.c
@@ -12,6 +12,9 @@
*/
const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
{
+ css__parse_align_content,
+ css__parse_align_items,
+ css__parse_align_self,
css__parse_azimuth,
css__parse_background,
css__parse_background_attachment,
@@ -71,6 +74,13 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_display,
css__parse_elevation,
css__parse_empty_cells,
+ css__parse_flex,
+ css__parse_flex_basis,
+ css__parse_flex_direction,
+ css__parse_flex_flow,
+ css__parse_flex_grow,
+ css__parse_flex_shrink,
+ css__parse_flex_wrap,
css__parse_float,
css__parse_font,
css__parse_font_family,
@@ -79,6 +89,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_font_variant,
css__parse_font_weight,
css__parse_height,
+ css__parse_justify_content,
css__parse_left,
css__parse_letter_spacing,
css__parse_line_height,
@@ -96,6 +107,7 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_min_height,
css__parse_min_width,
css__parse_opacity,
+ css__parse_order,
css__parse_orphans,
css__parse_outline,
css__parse_outline_color,
@@ -146,4 +158,3 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] =
css__parse_writing_mode,
css__parse_z_index
};
-
diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen
index 60d5536..e9167c8 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -16,7 +16,7 @@ cue_before:CSS_PROP_CUE_BEFORE IDENT:( INHERIT: NONE:0,CUE_BEFORE_NONE IDENT:) U
direction:CSS_PROP_DIRECTION IDENT:( INHERIT: LTR:0,DIRECTION_LTR RTL:0,DIRECTION_RTL IDENT:)
-display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE IDENT:)
+display:CSS_PROP_DISPLAY IDENT:( INHERIT: INLINE:0,DISPLAY_INLINE BLOCK:0,DISPLAY_BLOCK LIST_ITEM:0,DISPLAY_LIST_ITEM RUN_IN:0,DISPLAY_RUN_IN INLINE_BLOCK:0,DISPLAY_INLINE_BLOCK TABLE:0,DISPLAY_TABLE INLINE_TABLE:0,DISPLAY_INLINE_TABLE TABLE_ROW_GROUP:0,DISPLAY_TABLE_ROW_GROUP TABLE_HEADER_GROUP:0,DISPLAY_TABLE_HEADER_GROUP TABLE_FOOTER_GROUP:0,DISPLAY_TABLE_FOOTER_GROUP TABLE_ROW:0,DISPLAY_TABLE_ROW TABLE_COLUMN_GROUP:0,DISPLAY_TABLE_COLUMN_GROUP TABLE_COLUMN:0,DISPLAY_TABLE_COLUMN TABLE_CELL:0,DISPLAY_TABLE_CELL TABLE_CAPTION:0,DISPLAY_TABLE_CAPTION NONE:0,DISPLAY_NONE FLEX:0,DISPLAY_FLEX INLINE_FLEX:0,DISPLAY_INLINE_FLEX IDENT:)
empty_cells:CSS_PROP_EMPTY_CELLS IDENT:( INHERIT: SHOW:0,EMPTY_CELLS_SHOW HIDE:0,EMPTY_CELLS_HIDE IDENT:)
@@ -43,9 +43,9 @@ max_height:CSS_PROP_MAX_HEIGHT IDENT:( INHERIT: NONE:0,MAX_HEIGHT_NONE IDENT:) L
max_width:CSS_PROP_MAX_WIDTH IDENT:( INHERIT: NONE:0,MAX_WIDTH_NONE IDENT:) LENGTH_UNIT:( UNIT_PX:MAX_WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
-min_height:CSS_PROP_MIN_HEIGHT IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
+min_height:CSS_PROP_MIN_HEIGHT IDENT:( INHERIT: AUTO:0,MIN_HEIGHT_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_HEIGHT_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
-min_width:CSS_PROP_MIN_WIDTH IDENT:INHERIT LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
+min_width:CSS_PROP_MIN_WIDTH IDENT:( INHERIT: AUTO:0,MIN_WIDTH_AUTO IDENT:) LENGTH_UNIT:( UNIT_PX:MIN_WIDTH_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
color:CSS_PROP_COLOR IDENT:INHERIT COLOR:COLOR_SET
@@ -217,3 +217,23 @@ column_width:CSS_PROP_COLUMN_WIDTH IDENT:( INHERIT: AUTO:0,COLUMN_WIDTH_AUTO IDE
writing_mode:CSS_PROP_WRITING_MODE IDENT:( INHERIT: HORIZONTAL_TB:0,WRITING_MODE_HORIZONTAL_TB VERTICAL_RL:0,WRITING_MODE_VERTICAL_RL VERTICAL_LR:0,WRITING_MODE_VERTICAL_LR IDENT:)
box_sizing:CSS_PROP_BOX_SIZING IDENT:( INHERIT: CONTENT_BOX:0,BOX_SIZING_CONTENT_BOX BORDER_BOX:0,BOX_SIZING_BORDER_BOX IDENT:)
+
+align_content:CSS_PROP_ALIGN_CONTENT IDENT:( INHERIT: STRETCH:0,ALIGN_CONTENT_STRETCH FLEX_START:0,ALIGN_CONTENT_FLEX_START FLEX_END:0,ALIGN_CONTENT_FLEX_END CENTER:0,ALIGN_CONTENT_CENTER SPACE_BETWEEN:0,ALIGN_CONTENT_SPACE_BETWEEN SPACE_AROUND:0,ALIGN_CONTENT_SPACE_AROUND SPACE_EVENLY:0,ALIGN_CONTENT_SPACE_EVENLY IDENT:)
+
+align_items:CSS_PROP_ALIGN_ITEMS IDENT:( INHERIT: STRETCH:0,ALIGN_ITEMS_STRETCH FLEX_START:0,ALIGN_ITEMS_FLEX_START FLEX_END:0,ALIGN_ITEMS_FLEX_END CENTER:0,ALIGN_ITEMS_CENTER BASELINE:0,ALIGN_ITEMS_BASELINE IDENT:)
+
+align_self:CSS_PROP_ALIGN_SELF IDENT:( INHERIT: 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: AUTO:0,FLEX_BASIS_AUTO CONTENT:0,FLEX_BASIS_CONTENT IDENT:) LENGTH_UNIT:( UNIT_PX:FLEX_BASIS_SET DISALLOW:unit&UNIT_ANGLE||unit&UNIT_TIME||unit&UNIT_FREQ RANGE:<0 LENGTH_UNIT:)
+
+flex_direction:CSS_PROP_FLEX_DIRECTION IDENT:( INHERIT: 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 NUMBER:( true:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:( true:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+
+flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: NOWRAP:0,FLEX_WRAP_NOWRAP WRAP:0,FLEX_WRAP_WRAP WRAP_REVERSE:0,FLEX_WRAP_WRAP_REVERSE IDENT:)
+
+justify_content:CSS_PROP_JUSTIFY_CONTENT IDENT:( INHERIT: 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 NUMBER:( true:ORDER_SET NUMBER:)
diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h
index 4517515..1e085c5 100644
--- a/src/parse/properties/properties.h
+++ b/src/parse/properties/properties.h
@@ -22,6 +22,15 @@ typedef css_error (*css_prop_handler)(css_language *c,
extern const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP];
+css_error css__parse_align_content(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_align_items(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_align_self(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
css_error css__parse_azimuth(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
@@ -199,6 +208,27 @@ css_error css__parse_elevation(css_language *c,
css_error css__parse_empty_cells(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
+css_error css__parse_flex(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_flex_basis(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_flex_direction(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_flex_flow(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_flex_grow(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_flex_shrink(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
+css_error css__parse_flex_wrap(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
css_error css__parse_float(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
@@ -223,6 +253,9 @@ css_error css__parse_font_weight(css_language *c,
css_error css__parse_height(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
+css_error css__parse_justify_content(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
css_error css__parse_left(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
@@ -274,6 +307,9 @@ css_error css__parse_min_width(css_language *c,
css_error css__parse_opacity(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
+css_error css__parse_order(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result);
css_error css__parse_orphans(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result);
@@ -423,4 +459,3 @@ css_error css__parse_z_index(css_language *c,
css_style *result);
#endif
-
diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c
index dd6bee4..f698f06 100644
--- a/src/parse/propstrings.c
+++ b/src/parse/propstrings.c
@@ -82,6 +82,9 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "before", SLEN("before") },
{ "after", SLEN("after") },
+ { "align-content", SLEN("align-content") },
+ { "align-items", SLEN("align-items") },
+ { "align-self", SLEN("align-self") },
{ "azimuth", SLEN("azimuth") },
{ "background", SLEN("background") },
{ "background-attachment", SLEN("background-attachment") },
@@ -141,6 +144,13 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "display", SLEN("display") },
{ "elevation", SLEN("elevation") },
{ "empty-cells", SLEN("empty-cells") },
+ { "flex", SLEN("flex") },
+ { "flex-basis", SLEN("flex-basis") },
+ { "flex-direction", SLEN("flex-direction") },
+ { "flex-flow", SLEN("flex-flow") },
+ { "flex-grow", SLEN("flex-grow") },
+ { "flex-shrink", SLEN("flex-shrink") },
+ { "flex-wrap", SLEN("flex-wrap") },
{ "float", SLEN("float") },
{ "font", SLEN("font") },
{ "font-family", SLEN("font-family") },
@@ -149,6 +159,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "font-variant", SLEN("font-variant") },
{ "font-weight", SLEN("font-weight") },
{ "height", SLEN("height") },
+ { "justify-content", SLEN("justify-content") },
{ "left", SLEN("left") },
{ "letter-spacing", SLEN("letter-spacing") },
{ "line-height", SLEN("line-height") },
@@ -166,6 +177,7 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "min-height", SLEN("min-height") },
{ "min-width", SLEN("min-width") },
{ "opacity", SLEN("opacity") },
+ { "order", SLEN("order") },
{ "orphans", SLEN("orphans") },
{ "outline", SLEN("outline") },
{ "outline-color", SLEN("outline-color") },
@@ -415,6 +427,17 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "vertical-lr", SLEN("vertical-lr") },
{ "content-box", SLEN("content-box") },
{ "border-box", SLEN("border-box") },
+ { "stretch", SLEN("stretch") },
+ { "flex-start", SLEN("flex-start") },
+ { "flex-end", SLEN("flex-end") },
+ { "space-between", SLEN("space-between") },
+ { "space-around", SLEN("space-around") },
+ { "space-evenly", SLEN("space-evenly") },
+ { "row", SLEN("row") },
+ { "row-reverse", SLEN("row-reverse") },
+ { "column-reverse", SLEN("column-reverse") },
+ { "wrap", SLEN("wrap") },
+ { "wrap-reverse", SLEN("wrap-reverse") },
{ "aliceblue", SLEN("aliceblue") },
{ "antiquewhite", SLEN("antiquewhite") },
@@ -621,5 +644,3 @@ void css__propstrings_unref(void)
lwc_string_unref(css__propstrings.strings[i]);
}
}
-
-
diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h
index e0d16e2..1c07c13 100644
--- a/src/parse/propstrings.h
+++ b/src/parse/propstrings.h
@@ -38,12 +38,12 @@ enum {
/* Properties */
FIRST_PROP,
- AZIMUTH = FIRST_PROP, BACKGROUND, BACKGROUND_ATTACHMENT,
- BACKGROUND_COLOR, BACKGROUND_IMAGE, BACKGROUND_POSITION,
- BACKGROUND_REPEAT, BORDER, BORDER_BOTTOM, BORDER_BOTTOM_COLOR,
- BORDER_BOTTOM_STYLE, BORDER_BOTTOM_WIDTH, BORDER_COLLAPSE,
- BORDER_COLOR, BORDER_LEFT, BORDER_LEFT_COLOR, BORDER_LEFT_STYLE,
- BORDER_LEFT_WIDTH, BORDER_RIGHT, BORDER_RIGHT_COLOR,
+ ALIGN_CONTENT = FIRST_PROP, ALIGN_ITEMS, ALIGN_SELF, AZIMUTH,
+ BACKGROUND, BACKGROUND_ATTACHMENT, BACKGROUND_COLOR, BACKGROUND_IMAGE,
+ BACKGROUND_POSITION, BACKGROUND_REPEAT, BORDER, BORDER_BOTTOM,
+ BORDER_BOTTOM_COLOR, BORDER_BOTTOM_STYLE, BORDER_BOTTOM_WIDTH,
+ BORDER_COLLAPSE, BORDER_COLOR, BORDER_LEFT, BORDER_LEFT_COLOR,
+ BORDER_LEFT_STYLE, BORDER_LEFT_WIDTH, BORDER_RIGHT, BORDER_RIGHT_COLOR,
BORDER_RIGHT_STYLE, BORDER_RIGHT_WIDTH, BORDER_SPACING,
BORDER_STYLE, BORDER_TOP, BORDER_TOP_COLOR, BORDER_TOP_STYLE,
BORDER_TOP_WIDTH, BORDER_WIDTH, BOTTOM, BOX_SIZING, BREAK_AFTER,
@@ -51,21 +51,22 @@ enum {
COLUMN_COUNT, COLUMN_FILL, COLUMN_GAP, COLUMN_RULE, COLUMN_RULE_COLOR,
COLUMN_RULE_STYLE, COLUMN_RULE_WIDTH, COLUMN_SPAN, COLUMN_WIDTH,
CONTENT, COUNTER_INCREMENT, COUNTER_RESET, CUE, CUE_AFTER, CUE_BEFORE,
- CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, LIBCSS_FLOAT, FONT,
- FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT, FONT_WEIGHT, HEIGHT,
- LEFT, LETTER_SPACING, LINE_HEIGHT, LIST_STYLE, LIST_STYLE_IMAGE,
- LIST_STYLE_POSITION, LIST_STYLE_TYPE, MARGIN, MARGIN_BOTTOM,
- MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, MAX_HEIGHT, MAX_WIDTH,
- MIN_HEIGHT, MIN_WIDTH, OPACITY, ORPHANS, OUTLINE, OUTLINE_COLOR,
- OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW, OVERFLOW_X, OVERFLOW_Y, PADDING,
- PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP,
- PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE, PAGE_BREAK_INSIDE, PAUSE,
- PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH, PLAY_DURING, POSITION,
- QUOTES, RICHNESS, RIGHT, SPEAK_HEADER, SPEAK_NUMERAL, SPEAK_PUNCTUATION,
- SPEAK, SPEECH_RATE, STRESS, TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION,
- TEXT_INDENT, TEXT_TRANSFORM, TOP, UNICODE_BIDI, VERTICAL_ALIGN,
- VISIBILITY, VOICE_FAMILY, VOLUME, WHITE_SPACE, WIDOWS, WIDTH,
- WORD_SPACING, WRITING_MODE, Z_INDEX,
+ CURSOR, DIRECTION, DISPLAY, ELEVATION, EMPTY_CELLS, FLEX, FLEX_BASIS,
+ FLEX_DIRECTION, FLEX_FLOW, FLEX_GROW, FLEX_SHRINK, FLEX_WRAP,
+ LIBCSS_FLOAT, FONT, FONT_FAMILY, FONT_SIZE, FONT_STYLE, FONT_VARIANT,
+ FONT_WEIGHT, HEIGHT, JUSTIFY_CONTENT, LEFT, LETTER_SPACING, LINE_HEIGHT,
+ LIST_STYLE, LIST_STYLE_IMAGE, LIST_STYLE_POSITION, LIST_STYLE_TYPE,
+ MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP,
+ MAX_HEIGHT, MAX_WIDTH, MIN_HEIGHT, MIN_WIDTH, OPACITY, ORDER, ORPHANS,
+ OUTLINE, OUTLINE_COLOR, OUTLINE_STYLE, OUTLINE_WIDTH, OVERFLOW,
+ OVERFLOW_X, OVERFLOW_Y, PADDING, PADDING_BOTTOM, PADDING_LEFT,
+ PADDING_RIGHT, PADDING_TOP, PAGE_BREAK_AFTER, PAGE_BREAK_BEFORE,
+ PAGE_BREAK_INSIDE, PAUSE, PAUSE_AFTER, PAUSE_BEFORE, PITCH_RANGE, PITCH,
+ PLAY_DURING, POSITION, QUOTES, RICHNESS, RIGHT, SPEAK_HEADER,
+ SPEAK_NUMERAL, SPEAK_PUNCTUATION, SPEAK, SPEECH_RATE, STRESS,
+ TABLE_LAYOUT, TEXT_ALIGN, TEXT_DECORATION, TEXT_INDENT, TEXT_TRANSFORM,
+ TOP, UNICODE_BIDI, VERTICAL_ALIGN, VISIBILITY, VOICE_FAMILY, VOLUME,
+ WHITE_SPACE, WIDOWS, WIDTH, WORD_SPACING, WRITING_MODE, Z_INDEX,
LAST_PROP = Z_INDEX,
@@ -98,7 +99,9 @@ enum {
LIBCSS_RIGHT, CURRENTCOLOR, ODD, EVEN, SRC, LOCAL, INITIAL,
FORMAT, WOFF, TRUETYPE, OPENTYPE, EMBEDDED_OPENTYPE, SVG, COLUMN,
AVOID_PAGE, AVOID_COLUMN, BALANCE, HORIZONTAL_TB, VERTICAL_RL,
- VERTICAL_LR, CONTENT_BOX, BORDER_BOX,
+ VERTICAL_LR, CONTENT_BOX, BORDER_BOX, STRETCH, FLEX_START, FLEX_END,
+ SPACE_BETWEEN, SPACE_AROUND, SPACE_EVENLY, ROW, ROW_REVERSE,
+ COLUMN_REVERSE, WRAP, WRAP_REVERSE
/* Named colours */
FIRST_COLOUR,
@@ -138,4 +141,3 @@ css_error css__propstrings_get(lwc_string ***strings);
void css__propstrings_unref(void);
#endif
-
diff --git a/src/select/computed.h b/src/select/computed.h
index 9f2abdd..ca9b1c6 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -160,8 +160,14 @@ struct css_computed_style_i {
* visibility 2
* white_space 3
* box_sizing 2
+ * align_content 3
+ * align_items 3
+ * align_self 3
+ * flex_direction 3
+ * flex_wrap 2
+ * justify_content 3
* ---
- * 86 bits
+ * 103 bits
*
* Colours are 32bits of AARRGGBB
* Dimensions are encoded as a fixed point value + 4 bits of unit data
@@ -202,8 +208,12 @@ struct css_computed_style_i {
* vertical_align 4 + 4 4
* width 2 + 4 4
* z_index 2 4
+ * flex_basis 2 + 4 4
+ * flex_grow 1 4
+ * flex_shrink 1 4
+ * order 1 4
* --- ---
- * 181 bits 140 + 2sizeof(ptr) bytes
+ * 190 bits 156 + 2sizeof(ptr) bytes
*
* Encode font family as an array of string objects, terminated with a
* blank entry.
@@ -219,11 +229,11 @@ struct css_computed_style_i {
* 1 bit sizeof(ptr) bytes
*
* ___ ___
- * 269 bits 140 + 4sizeof(ptr) bytes
+ * 297 bits 156 + 4sizeof(ptr) bytes
*
- * 34 bytes 140 + 4sizeof(ptr) bytes
+ * 38 bytes 156 + 4sizeof(ptr) bytes
* ===================
- * 174 + 4sizeof(ptr) bytes
+ * 194 + 4sizeof(ptr) bytes
*
* Bit allocations:
*
@@ -262,9 +272,12 @@ struct css_computed_style_i {
* 32 ffffllll font-weight | list-style-type
* 33 oooottuu outline-style | table-layout | unicode-bidi
* 34 vvlltttt visibility | list-style-position | text-align
- * 35 yyy..... overflow-y | <unused>
+ * 35 yyyaaaff overflow-y | align-content | flex_wrap
+ * 36 bbbbbbsg flex-basis | flex-shrink | flex_grow
+ * 37 fffjjjo. flex-direction | justify_content | order
+ * 38 iiisss.. align-items | align-self
*/
- uint8_t bits[35];
+ uint8_t bits[38];
uint8_t unused[1];
@@ -310,6 +323,14 @@ struct css_computed_style_i {
int32_t z_index;
+ css_fixed flex_basis;
+
+ css_fixed flex_grow;
+
+ css_fixed flex_shrink;
+
+ css_fixed order;
+
css_computed_uncommon *uncommon;/**< Uncommon properties */
void *aural; /**< Aural properties */
};
diff --git a/src/select/dispatch.c b/src/select/dispatch.c
index 7af9000..a65afbc 100644
--- a/src/select/dispatch.c
+++ b/src/select/dispatch.c
@@ -19,6 +19,21 @@
struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
{
+ PROPERTY_FUNCS(align_content),
+ 0,
+ GROUP_NORMAL
+ },
+ {
+ PROPERTY_FUNCS(align_items),
+ 0,
+ GROUP_NORMAL
+ },
+ {
+ PROPERTY_FUNCS(align_self),
+ 0,
+ GROUP_NORMAL
+ },
+ {
PROPERTY_FUNCS(azimuth),
1,
GROUP_AURAL
@@ -194,6 +209,31 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
GROUP_NORMAL
},
{
+ PROPERTY_FUNCS(flex_basis),
+ 0,
+ GROUP_NORMAL
+ },
+ {
+ PROPERTY_FUNCS(flex_direction),
+ 0,
+ GROUP_NORMAL
+ },
+ {
+ PROPERTY_FUNCS(flex_grow),
+ 0,
+ GROUP_NORMAL
+ },
+ {
+ PROPERTY_FUNCS(flex_shrink),
+ 0,
+ GROUP_NORMAL
+ },
+ {
+ PROPERTY_FUNCS(flex_wrap),
+ 0,
+ GROUP_NORMAL
+ },
+ {
PROPERTY_FUNCS(float),
0,
GROUP_NORMAL
@@ -229,6 +269,11 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
GROUP_NORMAL
},
{
+ PROPERTY_FUNCS(justify_content),
+ 0,
+ GROUP_NORMAL
+ },
+ {
PROPERTY_FUNCS(left),
0,
GROUP_NORMAL
@@ -299,6 +344,11 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = {
GROUP_NORMAL
},
{
+ PROPERTY_FUNCS(order),
+ 0,
+ GROUP_NORMAL
+ },
+ {
PROPERTY_FUNCS(orphans),
1,
GROUP_PAGE
diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile
index 288eda9..6c6cf84 100644
--- a/src/select/properties/Makefile
+++ b/src/select/properties/Makefile
@@ -1,5 +1,8 @@
# Sources
DIR_SOURCES := helpers.c \
+align_content.c \
+align_items.c \
+align_self.c \
azimuth.c \
background_attachment.c \
background_color.c \
@@ -47,6 +50,11 @@ direction.c \
display.c \
elevation.c \
empty_cells.c \
+flex_basis.c \
+flex_direction.c \
+flex_grow.c \
+flex_shrink.c \
+flex_wrap.c \
float.c \
font_family.c \
font_size.c \
@@ -54,6 +62,7 @@ font_style.c \
font_variant.c \
font_weight.c \
height.c \
+justify_content.c \
left.c \
letter_spacing.c \
line_height.c \
@@ -69,6 +78,7 @@ max_width.c \
min_height.c \
min_width.c \
opacity.c \
+order.c \
orphans.c \
outline_color.c \
outline_style.c \
diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h
index a1ab49f..6eac397 100644
--- a/src/select/properties/properties.h
+++ b/src/select/properties/properties.h
@@ -21,6 +21,9 @@
css_error css__compose_##pname (const css_computed_style *parent, const css_computed_style *child, css_computed_style *result); \
uint32_t destroy_##pname (void *bytecode)
+PROPERTY_FUNCS(align_content);
+PROPERTY_FUNCS(align_items);
+PROPERTY_FUNCS(align_self);
PROPERTY_FUNCS(azimuth);
PROPERTY_FUNCS(background_attachment);
PROPERTY_FUNCS(background_color);
@@ -68,6 +71,11 @@ PROPERTY_FUNCS(direction);
PROPERTY_FUNCS(display);
PROPERTY_FUNCS(elevation);
PROPERTY_FUNCS(empty_cells);
+PROPERTY_FUNCS(flex_basis);
+PROPERTY_FUNCS(flex_direction);
+PROPERTY_FUNCS(flex_grow);
+PROPERTY_FUNCS(flex_shrink);
+PROPERTY_FUNCS(flex_wrap);
PROPERTY_FUNCS(float);
PROPERTY_FUNCS(font_family);
PROPERTY_FUNCS(font_size);
@@ -75,6 +83,7 @@ PROPERTY_FUNCS(font_style);
PROPERTY_FUNCS(font_variant);
PROPERTY_FUNCS(font_weight);
PROPERTY_FUNCS(height);
+PROPERTY_FUNCS(justify_content);
PROPERTY_FUNCS(left);
PROPERTY_FUNCS(letter_spacing);
PROPERTY_FUNCS(line_height);
@@ -90,6 +99,7 @@ PROPERTY_FUNCS(max_width);
PROPERTY_FUNCS(min_height);
PROPERTY_FUNCS(min_width);
PROPERTY_FUNCS(opacity);
+PROPERTY_FUNCS(order);
PROPERTY_FUNCS(orphans);
PROPERTY_FUNCS(outline_color);
PROPERTY_FUNCS(outline_style);