summaryrefslogtreecommitdiff
path: root/src/select
diff options
context:
space:
mode:
Diffstat (limited to 'src/select')
-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
9 files changed, 156 insertions, 36 deletions
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