summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-06-01 18:32:37 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2014-06-01 18:32:37 +0100
commitc6d7f24987a90bc61e408c4249a6a212276b4174 (patch)
tree75a3f5478618e0e583db6f168193e7645c012dda
parent89a4d061a46490d5fad3792a565a1a0114c400e0 (diff)
downloadlibcss-c6d7f24987a90bc61e408c4249a6a212276b4174.tar.gz
libcss-c6d7f24987a90bc61e408c4249a6a212276b4174.tar.bz2
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.
-rw-r--r--docs/API-ABI-Changes21
-rw-r--r--docs/Bytecode11
-rw-r--r--include/libcss/computed.h9
-rw-r--r--include/libcss/properties.h3
-rw-r--r--src/parse/properties/Makefile1
-rw-r--r--src/parse/properties/overflow.c97
-rw-r--r--src/parse/properties/properties.c2
-rw-r--r--src/parse/properties/properties.gen4
-rw-r--r--src/parse/properties/properties.h8
-rw-r--r--src/parse/propstrings.c2
-rw-r--r--src/parse/propstrings.h18
-rw-r--r--src/select/computed.c9
-rw-r--r--src/select/computed.h3
-rw-r--r--src/select/dispatch.c7
-rw-r--r--src/select/properties/Makefile3
-rw-r--r--src/select/properties/overflow_x.c (renamed from src/select/properties/overflow.c)20
-rw-r--r--src/select/properties/overflow_y.c72
-rw-r--r--src/select/properties/properties.h3
-rw-r--r--src/select/propget.h37
-rw-r--r--src/select/propset.h38
-rw-r--r--test/data/parse/properties.dat46
-rw-r--r--test/data/parse2/INDEX3
-rw-r--r--test/data/parse2/overflow.dat97
-rw-r--r--test/data/select/tests1.dat129
-rw-r--r--test/dump.h6
-rw-r--r--test/dump_computed.h39
26 files changed, 577 insertions, 111 deletions
diff --git a/docs/API-ABI-Changes b/docs/API-ABI-Changes
index c70c6f0..0216234 100644
--- a/docs/API-ABI-Changes
+++ b/docs/API-ABI-Changes
@@ -35,3 +35,24 @@ LibCSS 0.2.0 --> LibCSS 0.3.0
get_libcss_node_data
New selection handler function used to retrieve private cache belonging
to libcss from document element nodes.
+
+
+LibCSS 0.3.0 --> LibCSS 0.4.0
+-----------------------------
+
+ The API is changed.
+
+ Due to the change from CSS2 overflow to CSS3 overflow properties, the
+ computed style access functions for overflow properties have changed.
+ The overflow property is removed. Added are overflow-x and overflow-y
+ properties. (The overflow shorthand property now sets overflow-x and
+ overflow-y.)
+
+ This change affects the following functions:
+
+ Removed from include/libcss/computed.h -- css_computed_overflow()
+
+ Added to include/libcss/computed.h -- css_computed_overflow_x()
+
+ Added to include/libcss/computed.h -- css_computed_overflow_y()
+
diff --git a/docs/Bytecode b/docs/Bytecode
index b4154b5..3f53d71 100644
--- a/docs/Bytecode
+++ b/docs/Bytecode
@@ -739,7 +739,7 @@ Opcodes
0000010 => thick,
other => rffe.
-3c - overflow
+3c - overflow-x
<value> (14bits) :
0 => visible,
1 => hidden,
@@ -1241,6 +1241,13 @@ Opcodes
00000010 => vertical-lr,
other => Reserved for future expansion.
+70 - overflow-y
+ <value> (14bits) :
+ 0 => visible,
+ 1 => hidden,
+ 2 => scroll,
+ 3 => auto,
+ other => Reserved for future expansion.
-70-3ff - Reserved for future expansion.
+71-3ff - Reserved for future expansion.
diff --git a/include/libcss/computed.h b/include/libcss/computed.h
index 324af3f..8e327d2 100644
--- a/include/libcss/computed.h
+++ b/include/libcss/computed.h
@@ -303,10 +303,13 @@ uint8_t css_computed_padding_bottom(
uint8_t css_computed_padding_left(
const css_computed_style *style,
css_fixed *length, css_unit *unit);
-
-uint8_t css_computed_overflow(
+
+uint8_t css_computed_overflow_x(
const css_computed_style *style);
-
+
+uint8_t css_computed_overflow_y(
+ const css_computed_style *style);
+
uint8_t css_computed_position(
const css_computed_style *style);
diff --git a/include/libcss/properties.h b/include/libcss/properties.h
index bbb6baa..dbcd75a 100644
--- a/include/libcss/properties.h
+++ b/include/libcss/properties.h
@@ -74,7 +74,7 @@ enum css_properties_e {
CSS_PROP_OUTLINE_COLOR = 0x039,
CSS_PROP_OUTLINE_STYLE = 0x03a,
CSS_PROP_OUTLINE_WIDTH = 0x03b,
- CSS_PROP_OVERFLOW = 0x03c,
+ CSS_PROP_OVERFLOW_X = 0x03c,
CSS_PROP_PADDING_TOP = 0x03d,
CSS_PROP_PADDING_RIGHT = 0x03e,
CSS_PROP_PADDING_BOTTOM = 0x03f,
@@ -126,6 +126,7 @@ enum css_properties_e {
CSS_PROP_COLUMN_SPAN = 0x06d,
CSS_PROP_COLUMN_WIDTH = 0x06e,
CSS_PROP_WRITING_MODE = 0x06f,
+ CSS_PROP_OVERFLOW_Y = 0x070,
CSS_N_PROPERTIES
};
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 <tlsa@netsurf-browser.org>
+ */
+
+#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 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 | <unused>
* 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 | <unused>
*/
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_x.c
index 7d7d0a9..0173f5a 100644
--- a/src/select/properties/overflow.c
+++ b/src/select/properties/overflow_x.c
@@ -14,7 +14,7 @@
#include "select/properties/properties.h"
#include "select/properties/helpers.h"
-css_error css__cascade_overflow(uint32_t opv, css_style *style,
+css_error css__cascade_overflow_x(uint32_t opv, css_style *style,
css_select_state *state)
{
uint16_t value = CSS_OVERFLOW_INHERIT;
@@ -40,33 +40,33 @@ css_error css__cascade_overflow(uint32_t opv, css_style *style,
if (css__outranks_existing(getOpcode(opv), isImportant(opv), state,
isInherit(opv))) {
- return set_overflow(state->computed, value);
+ return set_overflow_x(state->computed, value);
}
return CSS_OK;
}
-css_error css__set_overflow_from_hint(const css_hint *hint,
+css_error css__set_overflow_x_from_hint(const css_hint *hint,
css_computed_style *style)
{
- return set_overflow(style, hint->status);
+ return set_overflow_x(style, hint->status);
}
-css_error css__initial_overflow(css_select_state *state)
+css_error css__initial_overflow_x(css_select_state *state)
{
- return set_overflow(state->computed, CSS_OVERFLOW_VISIBLE);
+ return set_overflow_x(state->computed, CSS_OVERFLOW_VISIBLE);
}
-css_error css__compose_overflow(const css_computed_style *parent,
+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(child);
+ uint8_t type = get_overflow_x(child);
if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow(parent);
+ type = get_overflow_x(parent);
}
- return set_overflow(result, type);
+ 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 <jmb@netsurf-browser.org>
+ */
+
+#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
diff --git a/test/data/parse/properties.dat b/test/data/parse/properties.dat
index d96d826..4716929 100644
--- a/test/data/parse/properties.dat
+++ b/test/data/parse/properties.dat
@@ -2447,11 +2447,11 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at
#reset
##
-## 3c - overflow
+## 3c - overflow-x
##
#data
-* { overflow: visible; }
+* { overflow-x: visible; }
#errors
#expected
| 1 *
@@ -2459,7 +2459,7 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at
#reset
#data
-* { overflow: hidden; }
+* { overflow-x: hidden; }
#errors
#expected
| 1 *
@@ -2467,7 +2467,7 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at
#reset
#data
-* { overflow: scroll; }
+* { overflow-x: scroll; }
#errors
#expected
| 1 *
@@ -2475,7 +2475,7 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at
#reset
#data
-* { overflow: auto; }
+* { overflow-x: auto; }
#errors
#expected
| 1 *
@@ -2483,6 +2483,42 @@ p:before { content: open-quote url('http://picodrive.acornarcade.com/') " : " at
#reset
##
+## 70 - overflow-y
+##
+
+#data
+* { overflow-y: visible; }
+#errors
+#expected
+| 1 *
+| 0x00000070
+#reset
+
+#data
+* { overflow-y: hidden; }
+#errors
+#expected
+| 1 *
+| 0x00040070
+#reset
+
+#data
+* { overflow-y: scroll; }
+#errors
+#expected
+| 1 *
+| 0x00080070
+#reset
+
+#data
+* { overflow-y: auto; }
+#errors
+#expected
+| 1 *
+| 0x000c0070
+#reset
+
+##
## 3d - padding-top
## 3e - padding-right
## 3f - padding-bottom
diff --git a/test/data/parse2/INDEX b/test/data/parse2/INDEX
index 651a87e..1afb4da 100644
--- a/test/data/parse2/INDEX
+++ b/test/data/parse2/INDEX
@@ -17,5 +17,6 @@ font.dat Font property tests
list.dat List property tests
margin.dat Margin property tests
outline.dat Outline property tests
+overflow.dat Overflow property tests
padding.dat Padding property tests
-multicol.dat Multi-column layout property tests \ No newline at end of file
+multicol.dat Multi-column layout property tests
diff --git a/test/data/parse2/overflow.dat b/test/data/parse2/overflow.dat
new file mode 100644
index 0000000..436b455
--- /dev/null
+++ b/test/data/parse2/overflow.dat
@@ -0,0 +1,97 @@
+#data
+* { overflow: auto; }
+#errors
+#expected
+| *
+| overflow-x: auto
+| overflow-y: auto
+#reset
+
+#data
+* { overflow: hidden; }
+#errors
+#expected
+| *
+| overflow-x: hidden
+| overflow-y: hidden
+#reset
+
+#data
+* { overflow: visible; }
+#errors
+#expected
+| *
+| overflow-x: visible
+| overflow-y: visible
+#reset
+
+#data
+* { overflow: scroll; }
+#errors
+#expected
+| *
+| overflow-x: scroll
+| overflow-y: scroll
+#reset
+
+#data
+* { overflow: inherit; }
+#errors
+#expected
+| *
+| overflow-x: inherit
+| overflow-y: inherit
+#reset
+
+#data
+* { overflow-x: inherit; }
+#errors
+#expected
+| *
+| overflow-x: inherit
+#reset
+
+#data
+* { overflow-x: scroll; }
+#errors
+#expected
+| *
+| overflow-x: scroll
+#reset
+
+#data
+* { overflow-y: visible; }
+#errors
+#expected
+| *
+| overflow-y: visible
+#reset
+
+#data
+* { overflow-y: auto; }
+#errors
+#expected
+| *
+| overflow-y: auto
+#reset
+
+#data
+* { overflow-x: visible; overflow-y: hidden; }
+#errors
+#expected
+| *
+| overflow-x: visible
+| overflow-y: hidden
+#reset
+
+#data
+* { overflow-y: auto; overflow-x: inherit; }
+#errors
+#expected
+| *
+| overflow-y: auto
+| overflow-x: inherit
+#reset
+
+
+
diff --git a/test/data/select/tests1.dat b/test/data/select/tests1.dat
index 51c5426..96e57bf 100644
--- a/test/data/select/tests1.dat
+++ b/test/data/select/tests1.dat
@@ -69,7 +69,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -165,7 +166,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -261,7 +263,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -357,7 +360,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -445,7 +449,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -531,7 +536,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -618,7 +624,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -705,7 +712,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -791,7 +799,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -882,7 +891,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -973,7 +983,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1065,7 +1076,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1160,7 +1172,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1254,7 +1267,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1354,7 +1368,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1454,7 +1469,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1554,7 +1570,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1658,7 +1675,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1761,7 +1779,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1862,7 +1881,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -1962,7 +1982,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2062,7 +2083,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2162,7 +2184,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2262,7 +2285,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2362,7 +2386,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2462,7 +2487,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2562,7 +2588,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2662,7 +2689,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2762,7 +2790,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2862,7 +2891,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -2962,7 +2992,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3062,7 +3093,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3162,7 +3194,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3262,7 +3295,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3362,7 +3396,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3462,7 +3497,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3562,7 +3598,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3662,7 +3699,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3762,7 +3800,8 @@ opacity: 0.500
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3862,7 +3901,8 @@ opacity: inherit
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -3955,7 +3995,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: 2px
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -4048,7 +4089,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
@@ -4141,7 +4183,8 @@ opacity: 1.000
outline-color: invert
outline-style: none
outline-width: medium
-overflow: visible
+overflow-x: visible
+overflow-y: visible
padding-top: 0px
padding-right: 0px
padding-bottom: 0px
diff --git a/test/dump.h b/test/dump.h
index 941117c..7ffec4f 100644
--- a/test/dump.h
+++ b/test/dump.h
@@ -425,7 +425,7 @@ static const char *opcode_names[] = {
"outline-color",
"outline-style",
"outline-width",
- "overflow",
+ "overflow-x",
"padding-top",
"padding-right",
"padding-bottom",
@@ -477,6 +477,7 @@ static const char *opcode_names[] = {
"column-span",
"column-width",
"writing-mode",
+ "overflow-y",
};
static void dump_css_fixed(css_fixed f, char **ptr)
@@ -2076,7 +2077,8 @@ void dump_bytecode(css_style *style, char **ptr, uint32_t depth)
break;
}
break;
- case CSS_PROP_OVERFLOW:
+ case CSS_PROP_OVERFLOW_X:
+ case CSS_PROP_OVERFLOW_Y:
switch (value) {
case OVERFLOW_VISIBLE:
*ptr += sprintf(*ptr, "visible");
diff --git a/test/dump_computed.h b/test/dump_computed.h
index 451ba1a..5f83767 100644
--- a/test/dump_computed.h
+++ b/test/dump_computed.h
@@ -1918,23 +1918,48 @@ static void dump_computed_style(const css_computed_style *style, char *buf,
ptr += wrote;
*len -= wrote;
- /* overflow */
- val = css_computed_overflow(style);
+ /* overflow-x */
+ val = css_computed_overflow_x(style);
switch (val) {
case CSS_OVERFLOW_INHERIT:
- wrote = snprintf(ptr, *len, "overflow: inherit\n");
+ wrote = snprintf(ptr, *len, "overflow-x: inherit\n");
break;
case CSS_OVERFLOW_VISIBLE:
- wrote = snprintf(ptr, *len, "overflow: visible\n");
+ wrote = snprintf(ptr, *len, "overflow-x: visible\n");
break;
case CSS_OVERFLOW_HIDDEN:
- wrote = snprintf(ptr, *len, "overflow: hidden\n");
+ wrote = snprintf(ptr, *len, "overflow-x: hidden\n");
break;
case CSS_OVERFLOW_SCROLL:
- wrote = snprintf(ptr, *len, "overflow: scroll\n");
+ wrote = snprintf(ptr, *len, "overflow-x: scroll\n");
break;
case CSS_OVERFLOW_AUTO:
- wrote = snprintf(ptr, *len, "overflow: auto\n");
+ wrote = snprintf(ptr, *len, "overflow-x: auto\n");
+ break;
+ default:
+ wrote = 0;
+ break;
+ }
+ ptr += wrote;
+ *len -= wrote;
+
+ /* overflow-y */
+ val = css_computed_overflow_y(style);
+ switch (val) {
+ case CSS_OVERFLOW_INHERIT:
+ wrote = snprintf(ptr, *len, "overflow-y: inherit\n");
+ break;
+ case CSS_OVERFLOW_VISIBLE:
+ wrote = snprintf(ptr, *len, "overflow-y: visible\n");
+ break;
+ case CSS_OVERFLOW_HIDDEN:
+ wrote = snprintf(ptr, *len, "overflow-y: hidden\n");
+ break;
+ case CSS_OVERFLOW_SCROLL:
+ wrote = snprintf(ptr, *len, "overflow-y: scroll\n");
+ break;
+ case CSS_OVERFLOW_AUTO:
+ wrote = snprintf(ptr, *len, "overflow-y: auto\n");
break;
default:
wrote = 0;