From c6d7f24987a90bc61e408c4249a6a212276b4174 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 1 Jun 2014 18:32:37 +0100 Subject: Add support for CSS3 overflow-x and overflow-y properties. Now, overflow is a shorthand property setting both overflow-x and overflow-y. The getter for the computed overflow has been removed, and replaced with two for overflow-x and overflow-y. --- src/parse/properties/Makefile | 1 + src/parse/properties/overflow.c | 97 +++++++++++++++++++++++++++++++++++++ src/parse/properties/properties.c | 2 + src/parse/properties/properties.gen | 4 +- src/parse/properties/properties.h | 8 ++- src/parse/propstrings.c | 2 + src/parse/propstrings.h | 18 +++---- src/select/computed.c | 9 +++- src/select/computed.h | 3 +- src/select/dispatch.c | 7 ++- src/select/properties/Makefile | 3 +- src/select/properties/overflow.c | 72 --------------------------- src/select/properties/overflow_x.c | 72 +++++++++++++++++++++++++++ src/select/properties/overflow_y.c | 72 +++++++++++++++++++++++++++ src/select/properties/properties.h | 3 +- src/select/propget.h | 37 ++++++++++---- src/select/propset.h | 38 +++++++++++---- 17 files changed, 339 insertions(+), 109 deletions(-) create mode 100644 src/parse/properties/overflow.c delete mode 100644 src/select/properties/overflow.c create mode 100644 src/select/properties/overflow_x.c create mode 100644 src/select/properties/overflow_y.c (limited to 'src') diff --git a/src/parse/properties/Makefile b/src/parse/properties/Makefile index 2b84354..0e29d1c 100644 --- a/src/parse/properties/Makefile +++ b/src/parse/properties/Makefile @@ -53,6 +53,7 @@ DIR_SOURCES := \ margin.c \ opacity.c \ outline.c \ + overflow.c \ padding.c \ pause.c \ play_during.c \ diff --git a/src/parse/properties/overflow.c b/src/parse/properties/overflow.c new file mode 100644 index 0000000..ca133ed --- /dev/null +++ b/src/parse/properties/overflow.c @@ -0,0 +1,97 @@ +/* + * This file is part of LibCSS. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2012 Michael Drake + */ + +#include +#include + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "parse/properties/properties.h" +#include "parse/properties/utils.h" + +/** + * Parse overflow shorthand + * + * \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_overflow(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result) +{ + int orig_ctx = *ctx; + css_error error1, error2 = CSS_OK; + const css_token *token; + bool match; + + token = parserutils_vector_iterate(vector, ctx); + if ((token == NULL) || ((token->type != CSS_TOKEN_IDENT))) { + *ctx = orig_ctx; + return CSS_INVALID; + } + + if ((lwc_string_caseless_isequal(token->idata, + c->strings[INHERIT], &match) == lwc_error_ok && + match)) { + error1 = css_stylesheet_style_inherit(result, + CSS_PROP_OVERFLOW_X); + error2 = css_stylesheet_style_inherit(result, + CSS_PROP_OVERFLOW_Y); + + } else if ((lwc_string_caseless_isequal(token->idata, + c->strings[VISIBLE], &match) == lwc_error_ok && + match)) { + error1 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_X, 0, OVERFLOW_VISIBLE); + error2 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_VISIBLE); + + } else if ((lwc_string_caseless_isequal(token->idata, + c->strings[HIDDEN], &match) == lwc_error_ok && + match)) { + error1 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_X, 0, OVERFLOW_HIDDEN); + error2 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_HIDDEN); + + } else if ((lwc_string_caseless_isequal(token->idata, + c->strings[SCROLL], &match) == lwc_error_ok && + match)) { + error1 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_X, 0, OVERFLOW_SCROLL); + error2 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_SCROLL); + + } else if ((lwc_string_caseless_isequal(token->idata, + c->strings[AUTO], &match) == lwc_error_ok && + match)) { + error1 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_X, 0, OVERFLOW_AUTO); + error2 = css__stylesheet_style_appendOPV(result, + CSS_PROP_OVERFLOW_Y, 0, OVERFLOW_AUTO); + + } else { + error1 = CSS_INVALID; + } + + if (error2 != CSS_OK) + error1 = error2; + + if (error1 != CSS_OK) + *ctx = orig_ctx; + + return error1; +} + diff --git a/src/parse/properties/properties.c b/src/parse/properties/properties.c index c4e939a..49933cd 100644 --- a/src/parse/properties/properties.c +++ b/src/parse/properties/properties.c @@ -101,6 +101,8 @@ const css_prop_handler property_handlers[LAST_PROP + 1 - FIRST_PROP] = css__parse_outline_style, css__parse_outline_width, css__parse_overflow, + css__parse_overflow_x, + css__parse_overflow_y, css__parse_padding, css__parse_padding_bottom, css__parse_padding_left, diff --git a/src/parse/properties/properties.gen b/src/parse/properties/properties.gen index 80f1a30..4417cb6 100644 --- a/src/parse/properties/properties.gen +++ b/src/parse/properties/properties.gen @@ -129,7 +129,9 @@ outline_style:CSS_PROP_OUTLINE_STYLE IDENT:( INHERIT: NONE:0,BORDER_STYLE_NONE D outline_width:CSS_PROP_OUTLINE_WIDTH WRAP:css__parse_border_side_width -overflow:CSS_PROP_OVERFLOW IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:) +overflow_x:CSS_PROP_OVERFLOW_X IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:) + +overflow_y:CSS_PROP_OVERFLOW_Y IDENT:( INHERIT: VISIBLE:0,OVERFLOW_VISIBLE HIDDEN:0,OVERFLOW_HIDDEN SCROLL:0,OVERFLOW_SCROLL AUTO:0,OVERFLOW_AUTO IDENT:) page_break_after:CSS_PROP_PAGE_BREAK_AFTER IDENT:( INHERIT: AUTO:0,PAGE_BREAK_AFTER_AUTO ALWAYS:0,PAGE_BREAK_AFTER_ALWAYS AVOID:0,PAGE_BREAK_AFTER_AVOID LEFT:0,PAGE_BREAK_AFTER_LEFT RIGHT:0,PAGE_BREAK_AFTER_RIGHT IDENT:) diff --git a/src/parse/properties/properties.h b/src/parse/properties/properties.h index 7c4d8a1..cf80761 100644 --- a/src/parse/properties/properties.h +++ b/src/parse/properties/properties.h @@ -287,7 +287,13 @@ css_error css__parse_outline_width(css_language *c, const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_overflow(css_language *c, - const parserutils_vector *vector, int *ctx, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_overflow_x(css_language *c, + const parserutils_vector *vector, int *ctx, + css_style *result); +css_error css__parse_overflow_y(css_language *c, + const parserutils_vector *vector, int *ctx, css_style *result); css_error css__parse_padding(css_language *c, const parserutils_vector *vector, int *ctx, diff --git a/src/parse/propstrings.c b/src/parse/propstrings.c index 913241c..2c166a0 100644 --- a/src/parse/propstrings.c +++ b/src/parse/propstrings.c @@ -171,6 +171,8 @@ const stringmap_entry stringmap[LAST_KNOWN] = { { "outline-style", SLEN("outline-style") }, { "outline-width", SLEN("outline-width") }, { "overflow", SLEN("overflow") }, + { "overflow-x", SLEN("overflow-x") }, + { "overflow-y", SLEN("overflow-y") }, { "padding", SLEN("padding") }, { "padding-bottom", SLEN("padding-bottom") }, { "padding-left", SLEN("padding-left") }, diff --git a/src/parse/propstrings.h b/src/parse/propstrings.h index 72a60ae..c686a91 100644 --- a/src/parse/propstrings.h +++ b/src/parse/propstrings.h @@ -57,15 +57,15 @@ enum { 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, 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, + 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, diff --git a/src/select/computed.c b/src/select/computed.c index bd72dc2..9b59dc4 100644 --- a/src/select/computed.c +++ b/src/select/computed.c @@ -743,9 +743,14 @@ uint8_t css_computed_padding_left(const css_computed_style *style, return get_padding_left(style, length, unit); } -uint8_t css_computed_overflow(const css_computed_style *style) +uint8_t css_computed_overflow_x(const css_computed_style *style) { - return get_overflow(style); + return get_overflow_x(style); +} + +uint8_t css_computed_overflow_y(const css_computed_style *style) +{ + return get_overflow_y(style); } uint8_t css_computed_position(const css_computed_style *style) diff --git a/src/select/computed.h b/src/select/computed.h index 58964af..ed9141f 100644 --- a/src/select/computed.h +++ b/src/select/computed.h @@ -218,7 +218,7 @@ struct css_computed_style { * 19 wwwwwwff width | font-style * 20 mmmmmbbb min-height | background-repeat * 21 mmmmmccc min-width | clear - * 22 tttttooo padding-top | overflow + * 22 tttttxxx padding-top | overflow-x * 23 rrrrrppp padding-right | position * 24 bbbbbo.. padding-bottom | opacity | * 25 lllllttt padding-left | text-transform @@ -231,6 +231,7 @@ struct css_computed_style { * 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 | */ uint8_t bits[34]; diff --git a/src/select/dispatch.c b/src/select/dispatch.c index 03d5c63..b03e468 100644 --- a/src/select/dispatch.c +++ b/src/select/dispatch.c @@ -319,7 +319,7 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { GROUP_UNCOMMON }, { - PROPERTY_FUNCS(overflow), + PROPERTY_FUNCS(overflow_x), 0, GROUP_NORMAL }, @@ -577,5 +577,10 @@ struct prop_table prop_dispatch[CSS_N_PROPERTIES] = { PROPERTY_FUNCS(writing_mode), 0, GROUP_UNCOMMON + }, + { + PROPERTY_FUNCS(overflow_y), + 0, + GROUP_NORMAL } }; diff --git a/src/select/properties/Makefile b/src/select/properties/Makefile index 8905695..ce3ddfa 100644 --- a/src/select/properties/Makefile +++ b/src/select/properties/Makefile @@ -72,7 +72,8 @@ orphans.c \ outline_color.c \ outline_style.c \ outline_width.c \ -overflow.c \ +overflow_x.c \ +overflow_y.c \ padding_bottom.c \ padding_left.c \ padding_right.c \ diff --git a/src/select/properties/overflow.c b/src/select/properties/overflow.c deleted file mode 100644 index 7d7d0a9..0000000 --- a/src/select/properties/overflow.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of LibCSS - * Licensed under the MIT License, - * http://www.opensource.org/licenses/mit-license.php - * Copyright 2009 John-Mark Bell - */ - -#include "bytecode/bytecode.h" -#include "bytecode/opcodes.h" -#include "select/propset.h" -#include "select/propget.h" -#include "utils/utils.h" - -#include "select/properties/properties.h" -#include "select/properties/helpers.h" - -css_error css__cascade_overflow(uint32_t opv, css_style *style, - css_select_state *state) -{ - uint16_t value = CSS_OVERFLOW_INHERIT; - - UNUSED(style); - - if (isInherit(opv) == false) { - switch (getValue(opv)) { - case OVERFLOW_VISIBLE: - value = CSS_OVERFLOW_VISIBLE; - break; - case OVERFLOW_HIDDEN: - value = CSS_OVERFLOW_HIDDEN; - break; - case OVERFLOW_SCROLL: - value = CSS_OVERFLOW_SCROLL; - break; - case OVERFLOW_AUTO: - value = CSS_OVERFLOW_AUTO; - break; - } - } - - if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, - isInherit(opv))) { - return set_overflow(state->computed, value); - } - - return CSS_OK; -} - -css_error css__set_overflow_from_hint(const css_hint *hint, - css_computed_style *style) -{ - return set_overflow(style, hint->status); -} - -css_error css__initial_overflow(css_select_state *state) -{ - return set_overflow(state->computed, CSS_OVERFLOW_VISIBLE); -} - -css_error css__compose_overflow(const css_computed_style *parent, - const css_computed_style *child, - css_computed_style *result) -{ - uint8_t type = get_overflow(child); - - if (type == CSS_OVERFLOW_INHERIT) { - type = get_overflow(parent); - } - - return set_overflow(result, type); -} - diff --git a/src/select/properties/overflow_x.c b/src/select/properties/overflow_x.c new file mode 100644 index 0000000..0173f5a --- /dev/null +++ b/src/select/properties/overflow_x.c @@ -0,0 +1,72 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 John-Mark Bell + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_overflow_x(uint32_t opv, css_style *style, + css_select_state *state) +{ + uint16_t value = CSS_OVERFLOW_INHERIT; + + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case OVERFLOW_VISIBLE: + value = CSS_OVERFLOW_VISIBLE; + break; + case OVERFLOW_HIDDEN: + value = CSS_OVERFLOW_HIDDEN; + break; + case OVERFLOW_SCROLL: + value = CSS_OVERFLOW_SCROLL; + break; + case OVERFLOW_AUTO: + value = CSS_OVERFLOW_AUTO; + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + return set_overflow_x(state->computed, value); + } + + return CSS_OK; +} + +css_error css__set_overflow_x_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_overflow_x(style, hint->status); +} + +css_error css__initial_overflow_x(css_select_state *state) +{ + return set_overflow_x(state->computed, CSS_OVERFLOW_VISIBLE); +} + +css_error css__compose_overflow_x(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + uint8_t type = get_overflow_x(child); + + if (type == CSS_OVERFLOW_INHERIT) { + type = get_overflow_x(parent); + } + + return set_overflow_x(result, type); +} + diff --git a/src/select/properties/overflow_y.c b/src/select/properties/overflow_y.c new file mode 100644 index 0000000..13213b5 --- /dev/null +++ b/src/select/properties/overflow_y.c @@ -0,0 +1,72 @@ +/* + * This file is part of LibCSS + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2009 John-Mark Bell + */ + +#include "bytecode/bytecode.h" +#include "bytecode/opcodes.h" +#include "select/propset.h" +#include "select/propget.h" +#include "utils/utils.h" + +#include "select/properties/properties.h" +#include "select/properties/helpers.h" + +css_error css__cascade_overflow_y(uint32_t opv, css_style *style, + css_select_state *state) +{ + uint16_t value = CSS_OVERFLOW_INHERIT; + + UNUSED(style); + + if (isInherit(opv) == false) { + switch (getValue(opv)) { + case OVERFLOW_VISIBLE: + value = CSS_OVERFLOW_VISIBLE; + break; + case OVERFLOW_HIDDEN: + value = CSS_OVERFLOW_HIDDEN; + break; + case OVERFLOW_SCROLL: + value = CSS_OVERFLOW_SCROLL; + break; + case OVERFLOW_AUTO: + value = CSS_OVERFLOW_AUTO; + break; + } + } + + if (css__outranks_existing(getOpcode(opv), isImportant(opv), state, + isInherit(opv))) { + return set_overflow_y(state->computed, value); + } + + return CSS_OK; +} + +css_error css__set_overflow_y_from_hint(const css_hint *hint, + css_computed_style *style) +{ + return set_overflow_y(style, hint->status); +} + +css_error css__initial_overflow_y(css_select_state *state) +{ + return set_overflow_y(state->computed, CSS_OVERFLOW_VISIBLE); +} + +css_error css__compose_overflow_y(const css_computed_style *parent, + const css_computed_style *child, + css_computed_style *result) +{ + uint8_t type = get_overflow_y(child); + + if (type == CSS_OVERFLOW_INHERIT) { + type = get_overflow_y(parent); + } + + return set_overflow_y(result, type); +} + diff --git a/src/select/properties/properties.h b/src/select/properties/properties.h index 63cdb17..f0ab29d 100644 --- a/src/select/properties/properties.h +++ b/src/select/properties/properties.h @@ -93,7 +93,8 @@ PROPERTY_FUNCS(orphans); PROPERTY_FUNCS(outline_color); PROPERTY_FUNCS(outline_style); PROPERTY_FUNCS(outline_width); -PROPERTY_FUNCS(overflow); +PROPERTY_FUNCS(overflow_x); +PROPERTY_FUNCS(overflow_y); PROPERTY_FUNCS(padding_top); PROPERTY_FUNCS(padding_right); PROPERTY_FUNCS(padding_bottom); diff --git a/src/select/propget.h b/src/select/propget.h index 7fff136..b124cfe 100644 --- a/src/select/propget.h +++ b/src/select/propget.h @@ -1338,22 +1338,39 @@ static inline uint8_t get_padding_left( #undef PADDING_LEFT_SHIFT #undef PADDING_LEFT_INDEX -#define OVERFLOW_INDEX 21 -#define OVERFLOW_SHIFT 0 -#define OVERFLOW_MASK 0x7 -static inline uint8_t get_overflow( +#define OVERFLOW_X_INDEX 21 +#define OVERFLOW_X_SHIFT 0 +#define OVERFLOW_X_MASK 0x7 +static inline uint8_t get_overflow_x( const css_computed_style *style) { - uint8_t bits = style->bits[OVERFLOW_INDEX]; - bits &= OVERFLOW_MASK; - bits >>= OVERFLOW_SHIFT; + uint8_t bits = style->bits[OVERFLOW_X_INDEX]; + bits &= OVERFLOW_X_MASK; + bits >>= OVERFLOW_X_SHIFT; /* 3bits: type */ return bits; } -#undef OVERFLOW_MASK -#undef OVERFLOW_SHIFT -#undef OVERFLOW_INDEX +#undef OVERFLOW_X_MASK +#undef OVERFLOW_X_SHIFT +#undef OVERFLOW_X_INDEX + +#define OVERFLOW_Y_INDEX 34 +#define OVERFLOW_Y_SHIFT 5 +#define OVERFLOW_Y_MASK 0xe0 +static inline uint8_t get_overflow_y( + const css_computed_style *style) +{ + uint8_t bits = style->bits[OVERFLOW_Y_INDEX]; + bits &= OVERFLOW_Y_MASK; + bits >>= OVERFLOW_Y_SHIFT; + + /* 3bits: type */ + return bits; +} +#undef OVERFLOW_Y_MASK +#undef OVERFLOW_Y_SHIFT +#undef OVERFLOW_Y_INDEX #define POSITION_INDEX 22 #define POSITION_SHIFT 0 diff --git a/src/select/propset.h b/src/select/propset.h index 4aa15af..b7da5a6 100644 --- a/src/select/propset.h +++ b/src/select/propset.h @@ -1411,23 +1411,41 @@ static inline css_error set_padding_left( #undef PADDING_LEFT_SHIFT #undef PADDING_LEFT_INDEX -#define OVERFLOW_INDEX 21 -#define OVERFLOW_SHIFT 0 -#define OVERFLOW_MASK 0x7 -static inline css_error set_overflow( +#define OVERFLOW_X_INDEX 21 +#define OVERFLOW_X_SHIFT 0 +#define OVERFLOW_X_MASK 0x7 +static inline css_error set_overflow_x( css_computed_style *style, uint8_t type) { - uint8_t *bits = &style->bits[OVERFLOW_INDEX]; + uint8_t *bits = &style->bits[OVERFLOW_X_INDEX]; /* 3bits: type */ - *bits = (*bits & ~OVERFLOW_MASK) | - ((type & 0x7) << OVERFLOW_SHIFT); + *bits = (*bits & ~OVERFLOW_X_MASK) | + ((type & 0x7) << OVERFLOW_X_SHIFT); return CSS_OK; } -#undef OVERFLOW_MASK -#undef OVERFLOW_SHIFT -#undef OVERFLOW_INDEX +#undef OVERFLOW_X_MASK +#undef OVERFLOW_X_SHIFT +#undef OVERFLOW_X_INDEX + +#define OVERFLOW_Y_INDEX 34 +#define OVERFLOW_Y_SHIFT 5 +#define OVERFLOW_Y_MASK 0xe0 +static inline css_error set_overflow_y( + css_computed_style *style, uint8_t type) +{ + uint8_t *bits = &style->bits[OVERFLOW_Y_INDEX]; + + /* 3bits: type */ + *bits = (*bits & ~OVERFLOW_Y_MASK) | + ((type & 0x7) << OVERFLOW_Y_SHIFT); + + return CSS_OK; +} +#undef OVERFLOW_Y_MASK +#undef OVERFLOW_Y_SHIFT +#undef OVERFLOW_Y_INDEX #define POSITION_INDEX 22 #define POSITION_SHIFT 0 -- cgit v1.2.3