Gitweb links:
...log
http://git.netsurf-browser.org/libcss.git/shortlog/e39304a177b8907e0c1f4fd356634cb56757e6ac
...commit
http://git.netsurf-browser.org/libcss.git/commit/e39304a177b8907e0c1f4fd356634cb56757e6ac
...tree
http://git.netsurf-browser.org/libcss.git/tree/e39304a177b8907e0c1f4fd356634cb56757e6ac
The branch, lcneves/flexbox has been updated
via e39304a177b8907e0c1f4fd356634cb56757e6ac (commit)
from 344c2c04790def1f9bebe3092844e454fa3a70b3 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libcss.git/commit/?id=e39304a177b8907e0c1f4fd356634cb56757e6ac
commit e39304a177b8907e0c1f4fd356634cb56757e6ac
Author: Lucas Neves <[email protected]>
Commit: Lucas Neves <[email protected]>
Parse: enable float parsing for flex-grow and flex-shrink
diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile
index 74cd204..e7b50c0 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -47,6 +47,8 @@ DIR_SOURCES := \
elevation.c \
flex.c \
flex_flow.c \
+ flex_grow.c \
+ flex_shrink.c \
font.c \
font_family.c \
font_weight.c \
@@ -54,7 +56,7 @@ DIR_SOURCES := \
list_style_type.c \
margin.c \
opacity.c \
- order.c \
+ order.c \
outline.c \
overflow.c \
padding.c \
diff --git a/src/parse/properties/flex_grow.c b/src/parse/properties/flex_grow.c
new file mode 100644
index 0000000..5ae5959
--- /dev/null
+++ b/src/parse/properties/flex_grow.c
@@ -0,0 +1,84 @@
+/*
+ * This file was generated by LibCSS gen_parser
+ *
+ * Generated from:
+ *
+ * flex_grow:CSS_PROP_FLEX_GROW IDENT:INHERIT NUMBER:( true:FLEX_GROW_SET
RANGE:num<0 NUMBER:)
+ *
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2010 The NetSurf Browser Project.
+ */
+
+#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_grow
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result 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_grow(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result)
+{
+ int orig_ctx = *ctx;
+ css_error error;
+ const css_token *token;
+ bool match;
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) &&
(token->type != CSS_TOKEN_NUMBER))) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) ==
lwc_error_ok && match)) {
+ error = css_stylesheet_style_inherit(result,
CSS_PROP_FLEX_GROW);
+ } else if (token->type == CSS_TOKEN_NUMBER) {
+ css_fixed num = 0;
+ size_t consumed = 0;
+
+ num = css__number_from_lwc_string(
+ token->idata, false, &consumed);
+ /* Invalid if there are trailing characters */
+ if (consumed != lwc_string_length(token->idata)) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+ if (num<0) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ error = css__stylesheet_style_appendOPV(result,
CSS_PROP_FLEX_GROW, 0, FLEX_GROW_SET);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ error = css__stylesheet_style_append(result, num);
+ } else {
+ error = CSS_INVALID;
+ }
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/flex_shrink.c
b/src/parse/properties/flex_shrink.c
new file mode 100644
index 0000000..7fb9d57
--- /dev/null
+++ b/src/parse/properties/flex_shrink.c
@@ -0,0 +1,84 @@
+/*
+ * This file was generated by LibCSS gen_parser
+ *
+ * Generated from:
+ *
+ * flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:(
true:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
+ *
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2010 The NetSurf Browser Project.
+ */
+
+#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_shrink
+ *
+ * \param c Parsing context
+ * \param vector Vector of tokens to process
+ * \param ctx Pointer to vector iteration context
+ * \param result 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_shrink(css_language *c,
+ const parserutils_vector *vector, int *ctx,
+ css_style *result)
+{
+ int orig_ctx = *ctx;
+ css_error error;
+ const css_token *token;
+ bool match;
+
+ token = parserutils_vector_iterate(vector, ctx);
+ if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT) &&
(token->type != CSS_TOKEN_NUMBER))) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) ==
lwc_error_ok && match)) {
+ error = css_stylesheet_style_inherit(result,
CSS_PROP_FLEX_SHRINK);
+ } else if (token->type == CSS_TOKEN_NUMBER) {
+ css_fixed num = 0;
+ size_t consumed = 0;
+
+ num = css__number_from_lwc_string(
+ token->idata, false, &consumed);
+ /* Invalid if there are trailing characters */
+ if (consumed != lwc_string_length(token->idata)) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+ if (num<0) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ error = css__stylesheet_style_appendOPV(result,
CSS_PROP_FLEX_SHRINK, 0, FLEX_SHRINK_SET);
+ if (error != CSS_OK) {
+ *ctx = orig_ctx;
+ return error;
+ }
+
+ error = css__stylesheet_style_append(result, num);
+ } else {
+ error = CSS_INVALID;
+ }
+
+ if (error != CSS_OK)
+ *ctx = orig_ctx;
+
+ return error;
+}
+
diff --git a/src/parse/properties/properties.gen
b/src/parse/properties/properties.gen
index 403fb36..26627ad 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -228,10 +228,6 @@ flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT:
AUTO:0,FLEX_BASIS_AUTO CONTENT:0
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_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:)
-----------------------------------------------------------------------
Summary of changes:
src/parse/properties/Makefile | 4 +++-
src/parse/properties/{order.c => flex_grow.c} | 19 +++++++++++--------
src/parse/properties/{order.c => flex_shrink.c} | 19 +++++++++++--------
src/parse/properties/properties.gen | 4 ----
4 files changed, 25 insertions(+), 21 deletions(-)
copy src/parse/properties/{order.c => flex_grow.c} (81%)
copy src/parse/properties/{order.c => flex_shrink.c} (80%)
diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile
index 74cd204..e7b50c0 100644
--- a/src/parse/properties/Makefile
+++ b/src/parse/properties/Makefile
@@ -47,6 +47,8 @@ DIR_SOURCES := \
elevation.c \
flex.c \
flex_flow.c \
+ flex_grow.c \
+ flex_shrink.c \
font.c \
font_family.c \
font_weight.c \
@@ -54,7 +56,7 @@ DIR_SOURCES := \
list_style_type.c \
margin.c \
opacity.c \
- order.c \
+ order.c \
outline.c \
overflow.c \
padding.c \
diff --git a/src/parse/properties/order.c b/src/parse/properties/flex_grow.c
similarity index 81%
copy from src/parse/properties/order.c
copy to src/parse/properties/flex_grow.c
index 9d617bc..5ae5959 100644
--- a/src/parse/properties/order.c
+++ b/src/parse/properties/flex_grow.c
@@ -3,7 +3,7 @@
*
* Generated from:
*
- * order:CSS_PROP_ORDER IDENT:INHERIT NUMBER:( true:ORDER_SET NUMBER:)
+ * flex_grow:CSS_PROP_FLEX_GROW IDENT:INHERIT NUMBER:( true:FLEX_GROW_SET
RANGE:num<0 NUMBER:)
*
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
@@ -19,7 +19,7 @@
#include "parse/properties/utils.h"
/**
- * Parse order
+ * Parse flex_grow
*
* \param c Parsing context
* \param vector Vector of tokens to process
@@ -32,7 +32,7 @@
* 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_order(css_language *c,
+css_error css__parse_flex_grow(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result)
{
@@ -48,21 +48,24 @@ css_error css__parse_order(css_language *c,
}
if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) ==
lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result,
CSS_PROP_ORDER);
+ error = css_stylesheet_style_inherit(result,
CSS_PROP_FLEX_GROW);
} else if (token->type == CSS_TOKEN_NUMBER) {
css_fixed num = 0;
size_t consumed = 0;
- /* Undo the <<10 shift, because this is an integer */
num = css__number_from_lwc_string(
- token->idata, true, &consumed) >> 10;
-
+ token->idata, false, &consumed);
/* Invalid if there are trailing characters */
if (consumed != lwc_string_length(token->idata)) {
*ctx = orig_ctx;
return CSS_INVALID;
}
- error = css__stylesheet_style_appendOPV(result, CSS_PROP_ORDER,
0, ORDER_SET);
+ if (num<0) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ error = css__stylesheet_style_appendOPV(result,
CSS_PROP_FLEX_GROW, 0, FLEX_GROW_SET);
if (error != CSS_OK) {
*ctx = orig_ctx;
return error;
diff --git a/src/parse/properties/order.c b/src/parse/properties/flex_shrink.c
similarity index 80%
copy from src/parse/properties/order.c
copy to src/parse/properties/flex_shrink.c
index 9d617bc..7fb9d57 100644
--- a/src/parse/properties/order.c
+++ b/src/parse/properties/flex_shrink.c
@@ -3,7 +3,7 @@
*
* Generated from:
*
- * order:CSS_PROP_ORDER IDENT:INHERIT NUMBER:( true:ORDER_SET NUMBER:)
+ * flex_shrink:CSS_PROP_FLEX_SHRINK IDENT:INHERIT NUMBER:(
true:FLEX_SHRINK_SET RANGE:num<0 NUMBER:)
*
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
@@ -19,7 +19,7 @@
#include "parse/properties/utils.h"
/**
- * Parse order
+ * Parse flex_shrink
*
* \param c Parsing context
* \param vector Vector of tokens to process
@@ -32,7 +32,7 @@
* 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_order(css_language *c,
+css_error css__parse_flex_shrink(css_language *c,
const parserutils_vector *vector, int *ctx,
css_style *result)
{
@@ -48,21 +48,24 @@ css_error css__parse_order(css_language *c,
}
if ((token->type == CSS_TOKEN_IDENT) &&
(lwc_string_caseless_isequal(token->idata, c->strings[INHERIT], &match) ==
lwc_error_ok && match)) {
- error = css_stylesheet_style_inherit(result,
CSS_PROP_ORDER);
+ error = css_stylesheet_style_inherit(result,
CSS_PROP_FLEX_SHRINK);
} else if (token->type == CSS_TOKEN_NUMBER) {
css_fixed num = 0;
size_t consumed = 0;
- /* Undo the <<10 shift, because this is an integer */
num = css__number_from_lwc_string(
- token->idata, true, &consumed) >> 10;
-
+ token->idata, false, &consumed);
/* Invalid if there are trailing characters */
if (consumed != lwc_string_length(token->idata)) {
*ctx = orig_ctx;
return CSS_INVALID;
}
- error = css__stylesheet_style_appendOPV(result, CSS_PROP_ORDER,
0, ORDER_SET);
+ if (num<0) {
+ *ctx = orig_ctx;
+ return CSS_INVALID;
+ }
+
+ error = css__stylesheet_style_appendOPV(result,
CSS_PROP_FLEX_SHRINK, 0, FLEX_SHRINK_SET);
if (error != CSS_OK) {
*ctx = orig_ctx;
return error;
diff --git a/src/parse/properties/properties.gen
b/src/parse/properties/properties.gen
index 403fb36..26627ad 100644
--- a/src/parse/properties/properties.gen
+++ b/src/parse/properties/properties.gen
@@ -228,10 +228,6 @@ flex_basis:CSS_PROP_FLEX_BASIS IDENT:( INHERIT:
AUTO:0,FLEX_BASIS_AUTO CONTENT:0
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_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:)
--
Cascading Style Sheets library
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org