summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Neves <lcneves@gmail.com>2017-09-28 15:30:14 (GMT)
committer Lucas Neves <lcneves@gmail.com>2017-10-01 18:29:54 (GMT)
commitcc8fe0d97fe6158afeafe58d4a6282631840bb79 (patch)
tree600338869a5ebd4679155411456cac41cb3e4ec7
parentbccdcf3846822b530ac62ad3994d775d05d9a2fb (diff)
downloadlibcss-cc8fe0d97fe6158afeafe58d4a6282631840bb79.tar.gz
libcss-cc8fe0d97fe6158afeafe58d4a6282631840bb79.tar.bz2
Parsing: Add support for parsing the flexbox properties.
-rw-r--r--src/parse/important.c20
-rw-r--r--src/parse/properties/Makefile2
-rw-r--r--src/parse/properties/flex.c213
-rw-r--r--src/parse/properties/flex_flow.c137
-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.c26
-rw-r--r--src/parse/propstrings.h48
9 files changed, 492 insertions, 30 deletions
diff --git a/src/parse/important.c b/src/parse/important.c
index ca4d60c..e0e8620 100644
--- a/src/parse/important.c
+++ b/src/parse/important.c
@@ -258,6 +258,21 @@ void css__make_style_important(css_style *style)
offset += 2; /* length + units */
break;
+ case CSS_PROP_FLEX_BASIS:
+ if (value == FLEX_BASIS_SET)
+ offset += 2; /* length + units */
+ break;
+
+ case CSS_PROP_FLEX_GROW:
+ if (value == FLEX_GROW_SET)
+ offset++; /* value */
+ break;
+
+ case CSS_PROP_FLEX_SHRINK:
+ if (value == FLEX_SHRINK_SET)
+ offset++; /* value */
+ break;
+
case CSS_PROP_FONT_FAMILY:
while (value != FONT_FAMILY_END) {
switch (value) {
@@ -331,6 +346,11 @@ void css__make_style_important(css_style *style)
offset++; /* value */
break;
+ case CSS_PROP_ORDER:
+ if (value == ORDER_SET)
+ offset++; /* value */
+ break;
+
case CSS_PROP_ORPHANS:
case CSS_PROP_PITCH_RANGE:
case CSS_PROP_RICHNESS:
diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile
index 6d6cff0..6461dda 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -45,6 +45,8 @@ DIR_SOURCES := \
cue.c \
cursor.c \
elevation.c \
+ flex.c \
+ flex_flow.c \
font.c \
font_family.c \
font_weight.c \
diff --git a/src/parse/properties/flex.c b/src/parse/properties/flex.c
new file mode 100644
index 0000000..9e284d9
--- a/dev/null
+++ b/src/parse/properties/flex.c
@@ -0,0 +1,213 @@
+/*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 Lucas Neves <lcneves@gmail.com>
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+/**
+ * Parse list-style
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result Pointer to location to receive resulting style
+ * \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_flex(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result)
+{
+ int orig_ctx = *ctx;
+ int prev_ctx;
+ const css_token *token;
+ css_error error;
+ bool grow = true;
+ bool shrink = true;
+ bool basis = true;
+ css_style *grow_style;
+ css_style *shrink_style;
+ css_style *basis_style;
+ bool short_auto = false;
+ bool short_none = false;
+ bool match;
+
+ /* Firstly, handle inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL)
+ return CSS_INVALID;
+
+ if (is_css_inherit(c, token)) {
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FLEX_GROW);
+ if (error != CSS_OK)
+ return error;
+
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FLEX_SHRINK);
+
+ if (error != CSS_OK)
+ return error;
+
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FLEX_BASIS);
+
+ if (error == CSS_OK)
+ parserutils_vector_iterate(vector, ctx);
+
+ return error;
+ }
+
+ /* allocate styles */
+ error = css__stylesheet_style_create(c->sheet, &grow_style);
+ if (error != CSS_OK)
+ return error;
+
+ error = css__stylesheet_style_create(c->sheet, &shrink_style);
+ if (error != CSS_OK) {
+ css__stylesheet_style_destroy(grow_style);
+ return error;
+ }
+
+ error = css__stylesheet_style_create(c->sheet, &basis_style);
+ if (error != CSS_OK) {
+ css__stylesheet_style_destroy(grow_style);
+ css__stylesheet_style_destroy(shrink_style);
+ return error;
+ }
+
+ /* Handle shorthand none, equivalent of flex: 0 0 auto; */
+ if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[NONE],
+ &match) == lwc_error_ok && match)) {
+ short_none = true;
+ parserutils_vector_iterate(vector, ctx);
+
+ } else if ((token->type == CSS_TOKEN_IDENT) &&
+ (lwc_string_caseless_isequal(
+ token->idata, c->strings[AUTO],
+ &match) == lwc_error_ok && match)) {
+ /* Handle shorthand auto, equivalent of flex: 1 1 auto; */
+ short_auto = true;
+ parserutils_vector_iterate(vector, ctx);
+
+ } else do {
+ /* Attempt to parse the various longhand properties */
+ prev_ctx = *ctx;
+ error = CSS_OK;
+
+ /* Ensure that we're not about to parse another inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token != NULL && is_css_inherit(c, token)) {
+ error = CSS_INVALID;
+ goto css__parse_flex_cleanup;
+ }
+
+ if ((grow) &&
+ (error = css__parse_flex_grow(c, vector,
+ ctx, grow_style)) == CSS_OK) {
+ grow = false;
+ } else if ((basis) &&
+ (error = css__parse_flex_basis(c, vector,
+ ctx, basis_style)) == CSS_OK) {
+ basis = false;
+ } else if ((shrink) &&
+ (error = css__parse_flex_shrink(c, vector,
+ ctx, shrink_style)) == CSS_OK) {
+ shrink = false;
+ }
+
+ if (error == CSS_OK) {
+ consumeWhitespace(vector, ctx);
+ token = parserutils_vector_peek(vector, *ctx);
+ } else {
+ /* Forcibly cause loop to exit */
+ token = NULL;
+ }
+ } while (*ctx != prev_ctx && token != NULL);
+
+ /* defaults */
+ if (grow) {
+ error = css__stylesheet_style_appendOPV(grow_style,
+ CSS_PROP_FLEX_GROW, 0, FLEX_GROW_SET);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+
+ css_fixed grow_num = short_auto ? INTTOFIX(1) : 0;
+ error = css__stylesheet_style_append(grow_style, grow_num);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+ }
+
+ if (shrink) {
+ error = css__stylesheet_style_appendOPV(shrink_style,
+ CSS_PROP_FLEX_SHRINK, 0, FLEX_SHRINK_SET);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+
+ css_fixed shrink_num = short_none ? 0 : INTTOFIX(1);
+ error = css__stylesheet_style_append(shrink_style, shrink_num);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+ }
+
+ if (basis) {
+ /* Default is auto, but zero if grow or shrink are set */
+ if (!grow || !shrink) {
+ error = css__stylesheet_style_appendOPV(basis_style,
+ CSS_PROP_FLEX_BASIS, 0,
+ FLEX_BASIS_SET);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+
+ error = css__stylesheet_style_vappend(
+ basis_style, 2, 0, UNIT_PX);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+
+ } else {
+ error = css__stylesheet_style_appendOPV(basis_style,
+ CSS_PROP_FLEX_BASIS, 0,
+ FLEX_BASIS_AUTO);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+ }
+ }
+
+ error = css__stylesheet_merge_style(result, grow_style);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+
+ error = css__stylesheet_merge_style(result, shrink_style);
+ if (error != CSS_OK)
+ goto css__parse_flex_cleanup;
+
+ error = css__stylesheet_merge_style(result, basis_style);
+
+css__parse_flex_cleanup:
+
+ css__stylesheet_style_destroy(basis_style);
+ css__stylesheet_style_destroy(shrink_style);
+ css__stylesheet_style_destroy(grow_style);
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/flex_flow.c b/src/parse/properties/flex_flow.c
new file mode 100644
index 0000000..40a42d9
--- a/dev/null
+++ b/src/parse/properties/flex_flow.c
@@ -0,0 +1,137 @@
+*
+ * This file is part of LibCSS.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2017 Lucas Neves <lcneves@gmail.com>
+ */
+
+#include <assert.h>
+#include <string.h>
+
+#include "bytecode/bytecode.h"
+#include "bytecode/opcodes.h"
+#include "parse/properties/properties.h"
+#include "parse/properties/utils.h"
+
+/**
+ * Parse flex-flow
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result Pointer to location to receive resulting style
+ * \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_flex_flow(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result)
+{
+ int orig_ctx = *ctx;
+ int prev_ctx;
+ const css_token *token;
+ css_error error;
+ bool direction = true;
+ bool wrap = true;
+ css_style *direction_style;
+ css_style *wrap_style;
+
+ /* Firstly, handle inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token == NULL)
+ return CSS_INVALID;
+
+ if (is_css_inherit(c, token)) {
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FLEX_DIRECTION);
+ if (error != CSS_OK)
+ return error;
+
+ error = css_stylesheet_style_inherit(result,
+ CSS_PROP_FLEX_WRAP);
+
+ if (error == CSS_OK)
+ parserutils_vector_iterate(vector, ctx);
+
+ return error;
+ }
+
+ /* allocate styles */
+ error = css__stylesheet_style_create(c->sheet, &direction_style);
+ if (error != CSS_OK)
+ return error;
+
+ error = css__stylesheet_style_create(c->sheet, &wrap_style);
+ if (error != CSS_OK) {
+ css__stylesheet_style_destroy(direction_style);
+ return error;
+ }
+
+ /* Attempt to parse the various longhand properties */
+ do {
+ prev_ctx = *ctx;
+ error = CSS_OK;
+
+ /* Ensure that we're not about to parse another inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token != NULL && is_css_inherit(c, token)) {
+ error = CSS_INVALID;
+ goto css__parse_flex_flow_cleanup;
+ }
+
+ if ((wrap) &&
+ (error = css__parse_flex_wrap(c, vector,
+ ctx, wrap_style)) == CSS_OK) {
+ wrap = false;
+ } else if ((direction) &&
+ (error = css__parse_flex_direction(c, vector,
+ ctx, direction_style)) == CSS_OK) {
+ direction = false;
+ }
+
+ if (error == CSS_OK) {
+ consumeWhitespace(vector, ctx);
+
+ token = parserutils_vector_peek(vector, *ctx);
+ } else {
+ /* Forcibly cause loop to exit */
+ token = NULL;
+ }
+ } while (*ctx != prev_ctx && token != NULL);
+
+
+ /* defaults */
+ if (direction) {
+ error = css__stylesheet_style_appendOPV(direction_style,
+ CSS_PROP_FLEX_DIRECTION,
+ 0, FLEX_DIRECTION_ROW);
+ }
+
+ if (wrap) {
+ error = css__stylesheet_style_appendOPV(wrap_style,
+ CSS_PROP_FLEX_WRAP,
+ 0, FLEX_WRAP_NOWRAP);
+ }
+
+ error = css__stylesheet_merge_style(result, direction_style);
+ if (error != CSS_OK)
+ goto css__parse_flex_flow_cleanup;
+
+ error = css__stylesheet_merge_style(result, wrap_style);
+
+css__parse_flex_flow_cleanup:
+
+ css__stylesheet_style_destroy(wrap_style);
+ css__stylesheet_style_destroy(direction_style);
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
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..61dcd5e 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:( false:FLEX_GROW_SET RANGE:num<0 NUMBER:)
+
+flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:( false:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+
+flex_wrap:CSS_PROP_FLEX_WRAP IDENT:( INHERIT: 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: 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..bfd2965 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,18 @@ const stringmap_entry stringmap[LAST_KNOWN] = {
{ "vertical-lr", SLEN("vertical-lr") },
{ "content-box", SLEN("content-box") },
{ "border-box", SLEN("border-box") },
+ { "stretch", SLEN("stretch") },
+ { "inline-flex", SLEN("inline-flex") },
+ { "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 +645,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..67eaa5f 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, INLINE_FLEX, FLEX_START,
+ FLEX_END, SPACE_BETWEEN, SPACE_AROUND, SPACE_EVENLY, ROW, ROW_REVERSE,
+ COLUMN_REVERSE, WRAP_STRING, WRAP_REVERSE,
/* Named colours */
FIRST_COLOUR,
@@ -138,4 +141,3 @@ css_error css__propstrings_get(lwc_string ***strings);
void css__propstrings_unref(void);
#endif
-