netsurf: branch master updated. release/3.1-239-g5abfbba
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5abfbba0490555cfc776b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5abfbba0490555cfc776b45...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5abfbba0490555cfc776b4519...
The branch, master has been updated
via 5abfbba0490555cfc776b4519cc162637a8e5a6a (commit)
from 56556a677e86f24462542f951043b2f8d7647c31 (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/netsurf.git/commit/?id=5abfbba0490555cfc77...
commit 5abfbba0490555cfc776b4519cc162637a8e5a6a
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Make the glyph style more readable in the debug output.
diff --git a/framebuffer/convert_font.c b/framebuffer/convert_font.c
index b29c6ed..40cf589 100644
--- a/framebuffer/convert_font.c
+++ b/framebuffer/convert_font.c
@@ -28,10 +28,10 @@ const char *var_lables[4] = {
};
const char *short_labels[4] = {
- " r ",
- " i ",
- " b ",
- "b+i"
+ " ",
+ " i",
+ "b ",
+ "bi"
};
enum font_style {
-----------------------------------------------------------------------
Summary of changes:
framebuffer/convert_font.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/framebuffer/convert_font.c b/framebuffer/convert_font.c
index b29c6ed..40cf589 100644
--- a/framebuffer/convert_font.c
+++ b/framebuffer/convert_font.c
@@ -28,10 +28,10 @@ const char *var_lables[4] = {
};
const char *short_labels[4] = {
- " r ",
- " i ",
- " b ",
- "b+i"
+ " ",
+ " i",
+ "b ",
+ "bi"
};
enum font_style {
--
NetSurf Browser
9 years
libcss: branch master updated. release/0.3.0-3-g2a508df
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/2a508df4ad666163ec4768...
...commit http://git.netsurf-browser.org/libcss.git/commit/2a508df4ad666163ec476809...
...tree http://git.netsurf-browser.org/libcss.git/tree/2a508df4ad666163ec476809aa...
The branch, master has been updated
via 2a508df4ad666163ec476809aa2f609ac8a4da24 (commit)
from 096d136937c18e9a588f3b6df66293cecfb5cdaa (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=2a508df4ad666163ec47...
commit 2a508df4ad666163ec476809aa2f609ac8a4da24
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix warning.
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 9c4be2a..d6c7fd9 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -523,7 +523,8 @@ int main(int argc, char **argv)
while (*curpos != 0) {
rkv = get_keyval(&curpos);
if (rkv == NULL) {
- fprintf(stderr,"Token error at offset %ld\n", curpos - descriptor);
+ fprintf(stderr,"Token error at offset %ld\n",
+ (long)(curpos - descriptor));
fclose(outputf);
return 2;
}
-----------------------------------------------------------------------
Summary of changes:
src/parse/properties/css_property_parser_gen.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/parse/properties/css_property_parser_gen.c b/src/parse/properties/css_property_parser_gen.c
index 9c4be2a..d6c7fd9 100644
--- a/src/parse/properties/css_property_parser_gen.c
+++ b/src/parse/properties/css_property_parser_gen.c
@@ -523,7 +523,8 @@ int main(int argc, char **argv)
while (*curpos != 0) {
rkv = get_keyval(&curpos);
if (rkv == NULL) {
- fprintf(stderr,"Token error at offset %ld\n", curpos - descriptor);
+ fprintf(stderr,"Token error at offset %ld\n",
+ (long)(curpos - descriptor));
fclose(outputf);
return 2;
}
--
Cascading Style Sheets library
9 years
libcss: branch master updated. release/0.3.0-2-g096d136
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/096d136937c18e9a588f3b...
...commit http://git.netsurf-browser.org/libcss.git/commit/096d136937c18e9a588f3b6d...
...tree http://git.netsurf-browser.org/libcss.git/tree/096d136937c18e9a588f3b6df6...
The branch, master has been updated
via 096d136937c18e9a588f3b6df66293cecfb5cdaa (commit)
from c6d7f24987a90bc61e408c4249a6a212276b4174 (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=096d136937c18e9a588f...
commit 096d136937c18e9a588f3b6df66293cecfb5cdaa
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Length of computed bits array has increased by one byte.
Reduce unused bytes from 2 to 1.
diff --git a/src/select/computed.h b/src/select/computed.h
index ed9141f..e7f3742 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -233,9 +233,9 @@ struct css_computed_style {
* 34 vvlltttt visibility | list-style-position | text-align
* 35 yyy..... overflow-y | <unused>
*/
- uint8_t bits[34];
+ uint8_t bits[35];
- uint8_t unused[2];
+ uint8_t unused[1];
css_color background_color;
lwc_string *background_image;
-----------------------------------------------------------------------
Summary of changes:
src/select/computed.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/select/computed.h b/src/select/computed.h
index ed9141f..e7f3742 100644
--- a/src/select/computed.h
+++ b/src/select/computed.h
@@ -233,9 +233,9 @@ struct css_computed_style {
* 34 vvlltttt visibility | list-style-position | text-align
* 35 yyy..... overflow-y | <unused>
*/
- uint8_t bits[34];
+ uint8_t bits[35];
- uint8_t unused[2];
+ uint8_t unused[1];
css_color background_color;
lwc_string *background_image;
--
Cascading Style Sheets library
9 years
netsurf: branch master updated. release/3.1-238-g56556a6
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/56556a677e86f24462542...
...commit http://git.netsurf-browser.org/netsurf.git/commit/56556a677e86f24462542f9...
...tree http://git.netsurf-browser.org/netsurf.git/tree/56556a677e86f24462542f951...
The branch, master has been updated
via 56556a677e86f24462542f951043b2f8d7647c31 (commit)
from 5085bfbf99ff3885acb2e23f8a48d18f150e294a (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/netsurf.git/commit/?id=56556a677e86f244625...
commit 56556a677e86f24462542f951043b2f8d7647c31
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Detect bad line endings and print error.
diff --git a/framebuffer/convert_font.c b/framebuffer/convert_font.c
index d71688e..b29c6ed 100644
--- a/framebuffer/convert_font.c
+++ b/framebuffer/convert_font.c
@@ -781,6 +781,11 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len,
}
while (pos < end) {
+ if (*pos == '\r') {
+ LOG(LOG_ERROR, "Detected \'\\r\': Bad line ending\n");
+ return false;
+ }
+
switch (ctx->state) {
case START:
if (*pos != '*') {
-----------------------------------------------------------------------
Summary of changes:
framebuffer/convert_font.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/framebuffer/convert_font.c b/framebuffer/convert_font.c
index d71688e..b29c6ed 100644
--- a/framebuffer/convert_font.c
+++ b/framebuffer/convert_font.c
@@ -781,6 +781,11 @@ static bool parse_chunk(struct parse_context *ctx, const char *buf, size_t len,
}
while (pos < end) {
+ if (*pos == '\r') {
+ LOG(LOG_ERROR, "Detected \'\\r\': Bad line ending\n");
+ return false;
+ }
+
switch (ctx->state) {
case START:
if (*pos != '*') {
--
NetSurf Browser
9 years
netsurf: branch master updated. release/3.1-237-g5085bfb
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5085bfbf99ff3885acb2e...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5085bfbf99ff3885acb2e23...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5085bfbf99ff3885acb2e23f8...
The branch, master has been updated
via 5085bfbf99ff3885acb2e23f8a48d18f150e294a (commit)
from 576e93e1f33614003dd876b93f2f5bbf8228eeed (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/netsurf.git/commit/?id=5085bfbf99ff3885acb...
commit 5085bfbf99ff3885acb2e23f8a48d18f150e294a
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Handle overflow-x and overflow-y properties.
Fixes display of BBC Sport.
Requires LibCSS with support for overflow-x and overflow-y.
diff --git a/css/dump.c b/css/dump.c
index fa34284..d3ebc94 100644
--- a/css/dump.c
+++ b/css/dump.c
@@ -1294,19 +1294,38 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
}
/* overflow */
- val = css_computed_overflow(style);
+ val = css_computed_overflow_x(style);
switch (val) {
case CSS_OVERFLOW_VISIBLE:
- fprintf(stream, "overflow: visible ");
+ fprintf(stream, "overflow-x: visible ");
break;
case CSS_OVERFLOW_HIDDEN:
- fprintf(stream, "overflow: hidden ");
+ fprintf(stream, "overflow-x: hidden ");
break;
case CSS_OVERFLOW_SCROLL:
- fprintf(stream, "overflow: scroll ");
+ fprintf(stream, "overflow-x: scroll ");
break;
case CSS_OVERFLOW_AUTO:
- fprintf(stream, "overflow: auto ");
+ fprintf(stream, "overflow-x auto ");
+ break;
+ default:
+ break;
+ }
+
+ /* overflow */
+ val = css_computed_overflow_y(style);
+ switch (val) {
+ case CSS_OVERFLOW_VISIBLE:
+ fprintf(stream, "overflow-y: visible ");
+ break;
+ case CSS_OVERFLOW_HIDDEN:
+ fprintf(stream, "overflow-y: hidden ");
+ break;
+ case CSS_OVERFLOW_SCROLL:
+ fprintf(stream, "overflow-y: scroll ");
+ break;
+ case CSS_OVERFLOW_AUTO:
+ fprintf(stream, "overflow-y: auto ");
break;
default:
break;
diff --git a/render/box.c b/render/box.c
index 295308b..53f6c75 100644
--- a/render/box.c
+++ b/render/box.c
@@ -584,11 +584,17 @@ bool box_contains_point(struct box *box, int x, int y, bool *physically)
*physically = true;
return true;
}
- if ((box->style && css_computed_overflow(box->style) ==
+ if ((box->style && css_computed_overflow_x(box->style) ==
CSS_OVERFLOW_VISIBLE) || !box->style) {
if (box->x + box->descendant_x0 <= x &&
- x < box->x + box->descendant_x1 &&
- box->y + box->descendant_y0 <= y &&
+ x < box->x + box->descendant_x1) {
+ *physically = false;
+ return true;
+ }
+ }
+ if ((box->style && css_computed_overflow_y(box->style) ==
+ CSS_OVERFLOW_VISIBLE) || !box->style) {
+ if (box->y + box->descendant_y0 <= y &&
y < box->y + box->descendant_y1) {
*physically = false;
return true;
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 13cffe6..46d38da 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -1905,10 +1905,18 @@ bool html_redraw_box(const html_content *html, struct box *box,
struct box *bg_box = NULL;
bool has_x_scroll, has_y_scroll;
css_computed_clip_rect css_rect;
+ enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE;
+ enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE;
+ bool need_clip;
if (html_redraw_printing && (box->flags & PRINTED))
return true;
+ if (box->style != NULL) {
+ overflow_x = css_computed_overflow_x(box->style);
+ overflow_y = css_computed_overflow_y(box->style);
+ }
+
/* avoid trivial FP maths */
if (scale == 1.0) {
x = x_parent + box->x;
@@ -1946,49 +1954,64 @@ bool html_redraw_box(const html_content *html, struct box *box,
}
/* calculate rectangle covering this box and descendants */
- if (box->style && css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) {
+ if (box->style && overflow_x != CSS_OVERFLOW_VISIBLE) {
/* box contents clipped to box size */
r.x0 = x - border_left;
- r.y0 = y - border_top;
r.x1 = x + padding_width + border_right;
- r.y1 = y + padding_height + border_bottom;
} else {
/* box contents can hang out of the box; use descendant box */
if (scale == 1.0) {
r.x0 = x + box->descendant_x0;
- r.y0 = y + box->descendant_y0;
r.x1 = x + box->descendant_x1 + 1;
- r.y1 = y + box->descendant_y1 + 1;
} else {
r.x0 = x + box->descendant_x0 * scale;
- r.y0 = y + box->descendant_y0 * scale;
r.x1 = x + box->descendant_x1 * scale + 1;
- r.y1 = y + box->descendant_y1 * scale + 1;
}
if (!box->parent) {
/* root element */
int margin_left, margin_right;
- int margin_top, margin_bottom;
if (scale == 1.0) {
margin_left = box->margin[LEFT];
- margin_top = box->margin[TOP];
margin_right = box->margin[RIGHT];
- margin_bottom = box->margin[BOTTOM];
} else {
margin_left = box->margin[LEFT] * scale;
- margin_top = box->margin[TOP] * scale;
margin_right = box->margin[RIGHT] * scale;
- margin_bottom = box->margin[BOTTOM] * scale;
}
r.x0 = x - border_left - margin_left < r.x0 ?
x - border_left - margin_left : r.x0;
- r.y0 = y - border_top - margin_top < r.y0 ?
- y - border_top - margin_top : r.y0;
r.x1 = x + padding_width + border_right +
margin_right > r.x1 ?
x + padding_width + border_right +
margin_right : r.x1;
+ }
+ }
+
+ /* calculate rectangle covering this box and descendants */
+ if (box->style && overflow_y != CSS_OVERFLOW_VISIBLE) {
+ /* box contents clipped to box size */
+ r.y0 = y - border_top;
+ r.y1 = y + padding_height + border_bottom;
+ } else {
+ /* box contents can hang out of the box; use descendant box */
+ if (scale == 1.0) {
+ r.y0 = y + box->descendant_y0;
+ r.y1 = y + box->descendant_y1 + 1;
+ } else {
+ r.y0 = y + box->descendant_y0 * scale;
+ r.y1 = y + box->descendant_y1 * scale + 1;
+ }
+ if (!box->parent) {
+ /* root element */
+ int margin_top, margin_bottom;
+ if (scale == 1.0) {
+ margin_top = box->margin[TOP];
+ margin_bottom = box->margin[BOTTOM];
+ } else {
+ margin_top = box->margin[TOP] * scale;
+ margin_bottom = box->margin[BOTTOM] * scale;
+ }
+ r.y0 = y - border_top - margin_top < r.y0 ?
+ y - border_top - margin_top : r.y0;
r.y1 = y + padding_height + border_bottom +
margin_bottom > r.y1 ?
y + padding_height + border_bottom +
@@ -2308,24 +2331,38 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* clip to the padding edge for objects, or boxes with overflow hidden
* or scroll */
- if ((box->style && css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) || box->object ||
- box->flags & IFRAME) {
+ need_clip = false;
+ if (box->object || box->flags & IFRAME ||
+ (box->style && (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE))) {
r.x0 = x;
- r.y0 = y;
r.x1 = x + padding_width;
- r.y1 = y + padding_height;
if (r.x0 < clip->x0) r.x0 = clip->x0;
- if (r.y0 < clip->y0) r.y0 = clip->y0;
if (clip->x1 < r.x1) r.x1 = clip->x1;
+ if (r.x1 <= r.x0)
+ return ((!plot->group_end) || (plot->group_end()));
+ need_clip = true;
+ }
+
+ /* clip to the padding edge for objects, or boxes with overflow hidden
+ * or scroll */
+ if (box->object || box->flags & IFRAME ||
+ (box->style && (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE))) {
+ r.y0 = y;
+ r.y1 = y + padding_height;
+ if (r.y0 < clip->y0) r.y0 = clip->y0;
if (clip->y1 < r.y1) r.y1 = clip->y1;
- if (r.x1 <= r.x0 || r.y1 <= r.y0)
+ if (r.y1 <= r.y0)
return ((!plot->group_end) || (plot->group_end()));
- if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
- box->type == BOX_TABLE_CELL || box->object) {
- if (!plot->clip(&r))
- return false;
- }
+ need_clip = true;
+ }
+
+ if (need_clip && (box->type == BOX_BLOCK ||
+ box->type == BOX_INLINE_BLOCK ||
+ box->type == BOX_TABLE_CELL || box->object)) {
+ if (!plot->clip(&r))
+ return false;
}
/* text decoration */
@@ -2440,12 +2477,12 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* scrollbars */
if (((box->style && box->type != BOX_BR &&
box->type != BOX_TABLE && box->type != BOX_INLINE &&
- (css_computed_overflow(box->style) ==
- CSS_OVERFLOW_SCROLL ||
- css_computed_overflow(box->style) ==
- CSS_OVERFLOW_AUTO)) || (box->object &&
- content_get_type(box->object) == CONTENT_HTML)) &&
- box->parent != NULL) {
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO ||
+ overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO)) ||
+ (box->object && content_get_type(box->object) ==
+ CONTENT_HTML)) && box->parent != NULL) {
has_x_scroll = box_hscrollbar_present(box);
has_y_scroll = box_vscrollbar_present(box);
diff --git a/render/layout.c b/render/layout.c
index 7de0490..891fc42 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -281,6 +281,9 @@ bool layout_block_context(struct box *block, int viewport_height,
* then the while loop will visit each box marked with *, setting box
* to each in the order shown. */
while (box) {
+ enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE;
+ enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE;
+
assert(box->type == BOX_BLOCK || box->type == BOX_TABLE ||
box->type == BOX_INLINE_CONTAINER);
@@ -321,6 +324,12 @@ bool layout_block_context(struct box *block, int viewport_height,
y = layout_clear(block->float_children,
css_computed_clear(box->style));
+ /* Find box's overflow properties */
+ if (box->style) {
+ overflow_x = css_computed_overflow_x(box->style);
+ overflow_y = css_computed_overflow_y(box->style);
+ }
+
/* Blocks establishing a block formatting context get minimum
* left and right margins to avoid any floats. */
lm = rm = 0;
@@ -329,8 +338,8 @@ bool layout_block_context(struct box *block, int viewport_height,
if (!box->object && !(box->flags & IFRAME) &&
!(box->flags & REPLACE_DIM) &&
box->style &&
- css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) {
+ (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE)) {
/* box establishes new block formatting context
* so available width may be diminished due to
* floats. */
@@ -437,8 +446,8 @@ bool layout_block_context(struct box *block, int viewport_height,
/* Unless the box has an overflow style of visible, the box
* establishes a new block context. */
if (box->type == BOX_BLOCK && box->style &&
- css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) {
+ (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE)) {
layout_block_context(box, viewport_height, content);
@@ -922,7 +931,7 @@ struct box* layout_next_margin_block(struct box *box, struct box *block,
box->border[TOP].width ||
box->padding[TOP] ||
(box->style &&
- css_computed_overflow(box->style) !=
+ css_computed_overflow_y(box->style) !=
CSS_OVERFLOW_VISIBLE) ||
(box->type == BOX_INLINE_CONTAINER &&
box != box->parent->children)) {
@@ -935,7 +944,7 @@ struct box* layout_next_margin_block(struct box *box, struct box *block,
/* Find next box */
if (box->type == BOX_BLOCK && !box->object && box->children &&
box->style &&
- css_computed_overflow(box->style) ==
+ css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_VISIBLE) {
/* Down into children. */
box = box->children;
@@ -1286,32 +1295,42 @@ bool layout_apply_minmax_height(struct box *box, struct box *container)
void layout_block_add_scrollbar(struct box *box, int which)
{
- enum css_overflow_e overflow;
+ enum css_overflow_e overflow_x, overflow_y;
assert(box->type == BOX_BLOCK && (which == RIGHT || which == BOTTOM));
if (box->style == NULL)
return;
- overflow = css_computed_overflow(box->style);
+ overflow_x = css_computed_overflow_x(box->style);
+ overflow_y = css_computed_overflow_y(box->style);
+
+ if (which == BOTTOM &&
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO ||
+ (box->object &&
+ content_get_type(box->object) == CONTENT_HTML))) {
+ /* make space for scrollbar, unless height is AUTO */
+ if (box->height != AUTO &&
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ box_hscrollbar_present(box))) {
+ box->padding[BOTTOM] += SCROLLBAR_WIDTH;
+ }
- if (overflow == CSS_OVERFLOW_SCROLL || overflow == CSS_OVERFLOW_AUTO ||
- (box->object && content_get_type(box->object) ==
- CONTENT_HTML)) {
- /* make space for scrollbars, unless height/width are AUTO */
+ } else if (which == RIGHT &&
+ (overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO ||
+ (box->object &&
+ content_get_type(box->object) == CONTENT_HTML))) {
+ /* make space for scrollbars, unless width is AUTO */
enum css_height_e htype;
css_fixed height = 0;
css_unit hunit = CSS_UNIT_PX;
htype = css_computed_height(box->style, &height, &hunit);
- if (which == BOTTOM && box->height != AUTO &&
- (overflow == CSS_OVERFLOW_SCROLL ||
- box_hscrollbar_present(box))) {
- box->padding[BOTTOM] += SCROLLBAR_WIDTH;
- }
if (which == RIGHT && box->width != AUTO &&
htype == CSS_HEIGHT_SET &&
- (overflow == CSS_OVERFLOW_SCROLL ||
+ (overflow_y == CSS_OVERFLOW_SCROLL ||
box_vscrollbar_present(box))) {
box->width -= SCROLLBAR_WIDTH;
box->padding[RIGHT] += SCROLLBAR_WIDTH;
@@ -1458,9 +1477,15 @@ void layout_float_find_dimensions(int available_width,
int *margin = box->margin;
int *padding = box->padding;
struct box_border *border = box->border;
- int scrollbar_width =
- (css_computed_overflow(style) == CSS_OVERFLOW_SCROLL ||
- css_computed_overflow(style) == CSS_OVERFLOW_AUTO) ?
+ enum css_overflow_e overflow_x = css_computed_overflow_x(style);
+ enum css_overflow_e overflow_y = css_computed_overflow_y(style);
+ int scrollbar_width_x =
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO) ?
+ SCROLLBAR_WIDTH : 0;
+ int scrollbar_width_y =
+ (overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO) ?
SCROLLBAR_WIDTH : 0;
layout_find_dimensions(available_width, -1, box, style, &width, &height,
@@ -1473,8 +1498,8 @@ void layout_float_find_dimensions(int available_width,
margin[RIGHT] = 0;
if (box->gadget == NULL) {
- padding[RIGHT] += scrollbar_width;
- padding[BOTTOM] += scrollbar_width;
+ padding[RIGHT] += scrollbar_width_y;
+ padding[BOTTOM] += scrollbar_width_x;
}
if (box->object && !(box->flags & REPLACE_DIM) &&
@@ -1555,7 +1580,7 @@ void layout_float_find_dimensions(int available_width,
} else {
if (max_width >= 0 && width > max_width) width = max_width;
if (min_width > 0 && width < min_width) width = min_width;
- width -= scrollbar_width;
+ width -= scrollbar_width_y;
}
box->width = width;
@@ -3490,18 +3515,28 @@ bool layout_table(struct box *table, int available_width,
row_group = row_group->next) {
for (row = row_group->children; row; row = row->next) {
for (c = row->children; c; c = c->next) {
+ enum css_overflow_e overflow_x;
+ enum css_overflow_e overflow_y;
+
assert(c->style);
table_used_border_for_cell(c);
layout_find_dimensions(available_width, -1,
c, c->style, 0, 0, 0, 0, 0, 0,
0, c->padding, c->border);
- if (css_computed_overflow(c->style) ==
- CSS_OVERFLOW_SCROLL ||
- css_computed_overflow(c->style) ==
+
+ overflow_x = css_computed_overflow_x(c->style);
+ overflow_y = css_computed_overflow_y(c->style);
+
+ if (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x ==
CSS_OVERFLOW_AUTO) {
- c->padding[RIGHT] += SCROLLBAR_WIDTH;
c->padding[BOTTOM] += SCROLLBAR_WIDTH;
}
+ if (overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y ==
+ CSS_OVERFLOW_AUTO) {
+ c->padding[RIGHT] += SCROLLBAR_WIDTH;
+ }
}
}
}
@@ -5024,7 +5059,7 @@ static void layout_get_box_bbox(struct box *box, int *desc_x0, int *desc_y0,
/* To stop the top of text getting clipped when css line-height is
* reduced, we increase the top of the descendant bbox. */
if (box->type == BOX_BLOCK && box->style != NULL &&
- css_computed_overflow(box->style) ==
+ css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_VISIBLE &&
box->object == NULL) {
css_fixed font_size = 0;
@@ -5060,22 +5095,47 @@ static void layout_update_descendant_bbox(struct box *box, struct box *child,
bool html_object = (child->object &&
content_get_type(child->object) == CONTENT_HTML);
+ enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE;
+ enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE;
+
+ if (child->style != NULL) {
+ overflow_x = css_computed_overflow_x(child->style);
+ overflow_y = css_computed_overflow_y(child->style);
+ }
+
+ if (html_object == true ||
+ overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE)
+ layout_get_box_bbox(child, &child_desc_x0, &child_desc_y0,
+ &child_desc_x1, &child_desc_y1);
+
if (child->style == NULL ||
- (child->style && css_computed_overflow(child->style) ==
- CSS_OVERFLOW_VISIBLE && html_object == false)) {
+ (child->style &&
+ overflow_x == CSS_OVERFLOW_VISIBLE &&
+ html_object == false)) {
/* get child's descendant bbox relative to box */
child_desc_x0 = child_x + child->descendant_x0;
- child_desc_y0 = child_y + child->descendant_y0;
child_desc_x1 = child_x + child->descendant_x1;
+ } else {
+ /* child's descendants don't matter; use child's border edge */
+ /* get the bbox relative to box */
+ child_desc_x0 += child_x;
+ child_desc_x1 += child_x;
+ }
+
+ if (child->style == NULL ||
+ (child->style &&
+ overflow_y == CSS_OVERFLOW_VISIBLE &&
+ html_object == false)) {
+ /* get child's descendant bbox relative to box */
+ child_desc_y0 = child_y + child->descendant_y0;
child_desc_y1 = child_y + child->descendant_y1;
} else {
/* child's descendants don't matter; use child's border edge */
layout_get_box_bbox(child, &child_desc_x0, &child_desc_y0,
&child_desc_x1, &child_desc_y1);
/* get the bbox relative to box */
- child_desc_x0 += child_x;
child_desc_y0 += child_y;
- child_desc_x1 += child_x;
child_desc_y1 += child_y;
}
@@ -5159,7 +5219,9 @@ void layout_calculate_descendant_bboxes(struct box *box)
layout_calculate_descendant_bboxes(child);
- if (box->style && css_computed_overflow(box->style) ==
+ if (box->style && css_computed_overflow_x(box->style) ==
+ CSS_OVERFLOW_HIDDEN &&
+ css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_HIDDEN)
continue;
-----------------------------------------------------------------------
Summary of changes:
css/dump.c | 29 +++++++++--
render/box.c | 12 +++-
render/html_redraw.c | 103 ++++++++++++++++++++++++++------------
render/layout.c | 132 ++++++++++++++++++++++++++++++++++++-------------
4 files changed, 200 insertions(+), 76 deletions(-)
diff --git a/css/dump.c b/css/dump.c
index fa34284..d3ebc94 100644
--- a/css/dump.c
+++ b/css/dump.c
@@ -1294,19 +1294,38 @@ void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
}
/* overflow */
- val = css_computed_overflow(style);
+ val = css_computed_overflow_x(style);
switch (val) {
case CSS_OVERFLOW_VISIBLE:
- fprintf(stream, "overflow: visible ");
+ fprintf(stream, "overflow-x: visible ");
break;
case CSS_OVERFLOW_HIDDEN:
- fprintf(stream, "overflow: hidden ");
+ fprintf(stream, "overflow-x: hidden ");
break;
case CSS_OVERFLOW_SCROLL:
- fprintf(stream, "overflow: scroll ");
+ fprintf(stream, "overflow-x: scroll ");
break;
case CSS_OVERFLOW_AUTO:
- fprintf(stream, "overflow: auto ");
+ fprintf(stream, "overflow-x auto ");
+ break;
+ default:
+ break;
+ }
+
+ /* overflow */
+ val = css_computed_overflow_y(style);
+ switch (val) {
+ case CSS_OVERFLOW_VISIBLE:
+ fprintf(stream, "overflow-y: visible ");
+ break;
+ case CSS_OVERFLOW_HIDDEN:
+ fprintf(stream, "overflow-y: hidden ");
+ break;
+ case CSS_OVERFLOW_SCROLL:
+ fprintf(stream, "overflow-y: scroll ");
+ break;
+ case CSS_OVERFLOW_AUTO:
+ fprintf(stream, "overflow-y: auto ");
break;
default:
break;
diff --git a/render/box.c b/render/box.c
index 295308b..53f6c75 100644
--- a/render/box.c
+++ b/render/box.c
@@ -584,11 +584,17 @@ bool box_contains_point(struct box *box, int x, int y, bool *physically)
*physically = true;
return true;
}
- if ((box->style && css_computed_overflow(box->style) ==
+ if ((box->style && css_computed_overflow_x(box->style) ==
CSS_OVERFLOW_VISIBLE) || !box->style) {
if (box->x + box->descendant_x0 <= x &&
- x < box->x + box->descendant_x1 &&
- box->y + box->descendant_y0 <= y &&
+ x < box->x + box->descendant_x1) {
+ *physically = false;
+ return true;
+ }
+ }
+ if ((box->style && css_computed_overflow_y(box->style) ==
+ CSS_OVERFLOW_VISIBLE) || !box->style) {
+ if (box->y + box->descendant_y0 <= y &&
y < box->y + box->descendant_y1) {
*physically = false;
return true;
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 13cffe6..46d38da 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -1905,10 +1905,18 @@ bool html_redraw_box(const html_content *html, struct box *box,
struct box *bg_box = NULL;
bool has_x_scroll, has_y_scroll;
css_computed_clip_rect css_rect;
+ enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE;
+ enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE;
+ bool need_clip;
if (html_redraw_printing && (box->flags & PRINTED))
return true;
+ if (box->style != NULL) {
+ overflow_x = css_computed_overflow_x(box->style);
+ overflow_y = css_computed_overflow_y(box->style);
+ }
+
/* avoid trivial FP maths */
if (scale == 1.0) {
x = x_parent + box->x;
@@ -1946,49 +1954,64 @@ bool html_redraw_box(const html_content *html, struct box *box,
}
/* calculate rectangle covering this box and descendants */
- if (box->style && css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) {
+ if (box->style && overflow_x != CSS_OVERFLOW_VISIBLE) {
/* box contents clipped to box size */
r.x0 = x - border_left;
- r.y0 = y - border_top;
r.x1 = x + padding_width + border_right;
- r.y1 = y + padding_height + border_bottom;
} else {
/* box contents can hang out of the box; use descendant box */
if (scale == 1.0) {
r.x0 = x + box->descendant_x0;
- r.y0 = y + box->descendant_y0;
r.x1 = x + box->descendant_x1 + 1;
- r.y1 = y + box->descendant_y1 + 1;
} else {
r.x0 = x + box->descendant_x0 * scale;
- r.y0 = y + box->descendant_y0 * scale;
r.x1 = x + box->descendant_x1 * scale + 1;
- r.y1 = y + box->descendant_y1 * scale + 1;
}
if (!box->parent) {
/* root element */
int margin_left, margin_right;
- int margin_top, margin_bottom;
if (scale == 1.0) {
margin_left = box->margin[LEFT];
- margin_top = box->margin[TOP];
margin_right = box->margin[RIGHT];
- margin_bottom = box->margin[BOTTOM];
} else {
margin_left = box->margin[LEFT] * scale;
- margin_top = box->margin[TOP] * scale;
margin_right = box->margin[RIGHT] * scale;
- margin_bottom = box->margin[BOTTOM] * scale;
}
r.x0 = x - border_left - margin_left < r.x0 ?
x - border_left - margin_left : r.x0;
- r.y0 = y - border_top - margin_top < r.y0 ?
- y - border_top - margin_top : r.y0;
r.x1 = x + padding_width + border_right +
margin_right > r.x1 ?
x + padding_width + border_right +
margin_right : r.x1;
+ }
+ }
+
+ /* calculate rectangle covering this box and descendants */
+ if (box->style && overflow_y != CSS_OVERFLOW_VISIBLE) {
+ /* box contents clipped to box size */
+ r.y0 = y - border_top;
+ r.y1 = y + padding_height + border_bottom;
+ } else {
+ /* box contents can hang out of the box; use descendant box */
+ if (scale == 1.0) {
+ r.y0 = y + box->descendant_y0;
+ r.y1 = y + box->descendant_y1 + 1;
+ } else {
+ r.y0 = y + box->descendant_y0 * scale;
+ r.y1 = y + box->descendant_y1 * scale + 1;
+ }
+ if (!box->parent) {
+ /* root element */
+ int margin_top, margin_bottom;
+ if (scale == 1.0) {
+ margin_top = box->margin[TOP];
+ margin_bottom = box->margin[BOTTOM];
+ } else {
+ margin_top = box->margin[TOP] * scale;
+ margin_bottom = box->margin[BOTTOM] * scale;
+ }
+ r.y0 = y - border_top - margin_top < r.y0 ?
+ y - border_top - margin_top : r.y0;
r.y1 = y + padding_height + border_bottom +
margin_bottom > r.y1 ?
y + padding_height + border_bottom +
@@ -2308,24 +2331,38 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* clip to the padding edge for objects, or boxes with overflow hidden
* or scroll */
- if ((box->style && css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) || box->object ||
- box->flags & IFRAME) {
+ need_clip = false;
+ if (box->object || box->flags & IFRAME ||
+ (box->style && (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE))) {
r.x0 = x;
- r.y0 = y;
r.x1 = x + padding_width;
- r.y1 = y + padding_height;
if (r.x0 < clip->x0) r.x0 = clip->x0;
- if (r.y0 < clip->y0) r.y0 = clip->y0;
if (clip->x1 < r.x1) r.x1 = clip->x1;
+ if (r.x1 <= r.x0)
+ return ((!plot->group_end) || (plot->group_end()));
+ need_clip = true;
+ }
+
+ /* clip to the padding edge for objects, or boxes with overflow hidden
+ * or scroll */
+ if (box->object || box->flags & IFRAME ||
+ (box->style && (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE))) {
+ r.y0 = y;
+ r.y1 = y + padding_height;
+ if (r.y0 < clip->y0) r.y0 = clip->y0;
if (clip->y1 < r.y1) r.y1 = clip->y1;
- if (r.x1 <= r.x0 || r.y1 <= r.y0)
+ if (r.y1 <= r.y0)
return ((!plot->group_end) || (plot->group_end()));
- if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
- box->type == BOX_TABLE_CELL || box->object) {
- if (!plot->clip(&r))
- return false;
- }
+ need_clip = true;
+ }
+
+ if (need_clip && (box->type == BOX_BLOCK ||
+ box->type == BOX_INLINE_BLOCK ||
+ box->type == BOX_TABLE_CELL || box->object)) {
+ if (!plot->clip(&r))
+ return false;
}
/* text decoration */
@@ -2440,12 +2477,12 @@ bool html_redraw_box(const html_content *html, struct box *box,
/* scrollbars */
if (((box->style && box->type != BOX_BR &&
box->type != BOX_TABLE && box->type != BOX_INLINE &&
- (css_computed_overflow(box->style) ==
- CSS_OVERFLOW_SCROLL ||
- css_computed_overflow(box->style) ==
- CSS_OVERFLOW_AUTO)) || (box->object &&
- content_get_type(box->object) == CONTENT_HTML)) &&
- box->parent != NULL) {
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO ||
+ overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO)) ||
+ (box->object && content_get_type(box->object) ==
+ CONTENT_HTML)) && box->parent != NULL) {
has_x_scroll = box_hscrollbar_present(box);
has_y_scroll = box_vscrollbar_present(box);
diff --git a/render/layout.c b/render/layout.c
index 7de0490..891fc42 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -281,6 +281,9 @@ bool layout_block_context(struct box *block, int viewport_height,
* then the while loop will visit each box marked with *, setting box
* to each in the order shown. */
while (box) {
+ enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE;
+ enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE;
+
assert(box->type == BOX_BLOCK || box->type == BOX_TABLE ||
box->type == BOX_INLINE_CONTAINER);
@@ -321,6 +324,12 @@ bool layout_block_context(struct box *block, int viewport_height,
y = layout_clear(block->float_children,
css_computed_clear(box->style));
+ /* Find box's overflow properties */
+ if (box->style) {
+ overflow_x = css_computed_overflow_x(box->style);
+ overflow_y = css_computed_overflow_y(box->style);
+ }
+
/* Blocks establishing a block formatting context get minimum
* left and right margins to avoid any floats. */
lm = rm = 0;
@@ -329,8 +338,8 @@ bool layout_block_context(struct box *block, int viewport_height,
if (!box->object && !(box->flags & IFRAME) &&
!(box->flags & REPLACE_DIM) &&
box->style &&
- css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) {
+ (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE)) {
/* box establishes new block formatting context
* so available width may be diminished due to
* floats. */
@@ -437,8 +446,8 @@ bool layout_block_context(struct box *block, int viewport_height,
/* Unless the box has an overflow style of visible, the box
* establishes a new block context. */
if (box->type == BOX_BLOCK && box->style &&
- css_computed_overflow(box->style) !=
- CSS_OVERFLOW_VISIBLE) {
+ (overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE)) {
layout_block_context(box, viewport_height, content);
@@ -922,7 +931,7 @@ struct box* layout_next_margin_block(struct box *box, struct box *block,
box->border[TOP].width ||
box->padding[TOP] ||
(box->style &&
- css_computed_overflow(box->style) !=
+ css_computed_overflow_y(box->style) !=
CSS_OVERFLOW_VISIBLE) ||
(box->type == BOX_INLINE_CONTAINER &&
box != box->parent->children)) {
@@ -935,7 +944,7 @@ struct box* layout_next_margin_block(struct box *box, struct box *block,
/* Find next box */
if (box->type == BOX_BLOCK && !box->object && box->children &&
box->style &&
- css_computed_overflow(box->style) ==
+ css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_VISIBLE) {
/* Down into children. */
box = box->children;
@@ -1286,32 +1295,42 @@ bool layout_apply_minmax_height(struct box *box, struct box *container)
void layout_block_add_scrollbar(struct box *box, int which)
{
- enum css_overflow_e overflow;
+ enum css_overflow_e overflow_x, overflow_y;
assert(box->type == BOX_BLOCK && (which == RIGHT || which == BOTTOM));
if (box->style == NULL)
return;
- overflow = css_computed_overflow(box->style);
+ overflow_x = css_computed_overflow_x(box->style);
+ overflow_y = css_computed_overflow_y(box->style);
+
+ if (which == BOTTOM &&
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO ||
+ (box->object &&
+ content_get_type(box->object) == CONTENT_HTML))) {
+ /* make space for scrollbar, unless height is AUTO */
+ if (box->height != AUTO &&
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ box_hscrollbar_present(box))) {
+ box->padding[BOTTOM] += SCROLLBAR_WIDTH;
+ }
- if (overflow == CSS_OVERFLOW_SCROLL || overflow == CSS_OVERFLOW_AUTO ||
- (box->object && content_get_type(box->object) ==
- CONTENT_HTML)) {
- /* make space for scrollbars, unless height/width are AUTO */
+ } else if (which == RIGHT &&
+ (overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO ||
+ (box->object &&
+ content_get_type(box->object) == CONTENT_HTML))) {
+ /* make space for scrollbars, unless width is AUTO */
enum css_height_e htype;
css_fixed height = 0;
css_unit hunit = CSS_UNIT_PX;
htype = css_computed_height(box->style, &height, &hunit);
- if (which == BOTTOM && box->height != AUTO &&
- (overflow == CSS_OVERFLOW_SCROLL ||
- box_hscrollbar_present(box))) {
- box->padding[BOTTOM] += SCROLLBAR_WIDTH;
- }
if (which == RIGHT && box->width != AUTO &&
htype == CSS_HEIGHT_SET &&
- (overflow == CSS_OVERFLOW_SCROLL ||
+ (overflow_y == CSS_OVERFLOW_SCROLL ||
box_vscrollbar_present(box))) {
box->width -= SCROLLBAR_WIDTH;
box->padding[RIGHT] += SCROLLBAR_WIDTH;
@@ -1458,9 +1477,15 @@ void layout_float_find_dimensions(int available_width,
int *margin = box->margin;
int *padding = box->padding;
struct box_border *border = box->border;
- int scrollbar_width =
- (css_computed_overflow(style) == CSS_OVERFLOW_SCROLL ||
- css_computed_overflow(style) == CSS_OVERFLOW_AUTO) ?
+ enum css_overflow_e overflow_x = css_computed_overflow_x(style);
+ enum css_overflow_e overflow_y = css_computed_overflow_y(style);
+ int scrollbar_width_x =
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO) ?
+ SCROLLBAR_WIDTH : 0;
+ int scrollbar_width_y =
+ (overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO) ?
SCROLLBAR_WIDTH : 0;
layout_find_dimensions(available_width, -1, box, style, &width, &height,
@@ -1473,8 +1498,8 @@ void layout_float_find_dimensions(int available_width,
margin[RIGHT] = 0;
if (box->gadget == NULL) {
- padding[RIGHT] += scrollbar_width;
- padding[BOTTOM] += scrollbar_width;
+ padding[RIGHT] += scrollbar_width_y;
+ padding[BOTTOM] += scrollbar_width_x;
}
if (box->object && !(box->flags & REPLACE_DIM) &&
@@ -1555,7 +1580,7 @@ void layout_float_find_dimensions(int available_width,
} else {
if (max_width >= 0 && width > max_width) width = max_width;
if (min_width > 0 && width < min_width) width = min_width;
- width -= scrollbar_width;
+ width -= scrollbar_width_y;
}
box->width = width;
@@ -3490,18 +3515,28 @@ bool layout_table(struct box *table, int available_width,
row_group = row_group->next) {
for (row = row_group->children; row; row = row->next) {
for (c = row->children; c; c = c->next) {
+ enum css_overflow_e overflow_x;
+ enum css_overflow_e overflow_y;
+
assert(c->style);
table_used_border_for_cell(c);
layout_find_dimensions(available_width, -1,
c, c->style, 0, 0, 0, 0, 0, 0,
0, c->padding, c->border);
- if (css_computed_overflow(c->style) ==
- CSS_OVERFLOW_SCROLL ||
- css_computed_overflow(c->style) ==
+
+ overflow_x = css_computed_overflow_x(c->style);
+ overflow_y = css_computed_overflow_y(c->style);
+
+ if (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x ==
CSS_OVERFLOW_AUTO) {
- c->padding[RIGHT] += SCROLLBAR_WIDTH;
c->padding[BOTTOM] += SCROLLBAR_WIDTH;
}
+ if (overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y ==
+ CSS_OVERFLOW_AUTO) {
+ c->padding[RIGHT] += SCROLLBAR_WIDTH;
+ }
}
}
}
@@ -5024,7 +5059,7 @@ static void layout_get_box_bbox(struct box *box, int *desc_x0, int *desc_y0,
/* To stop the top of text getting clipped when css line-height is
* reduced, we increase the top of the descendant bbox. */
if (box->type == BOX_BLOCK && box->style != NULL &&
- css_computed_overflow(box->style) ==
+ css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_VISIBLE &&
box->object == NULL) {
css_fixed font_size = 0;
@@ -5060,22 +5095,47 @@ static void layout_update_descendant_bbox(struct box *box, struct box *child,
bool html_object = (child->object &&
content_get_type(child->object) == CONTENT_HTML);
+ enum css_overflow_e overflow_x = CSS_OVERFLOW_VISIBLE;
+ enum css_overflow_e overflow_y = CSS_OVERFLOW_VISIBLE;
+
+ if (child->style != NULL) {
+ overflow_x = css_computed_overflow_x(child->style);
+ overflow_y = css_computed_overflow_y(child->style);
+ }
+
+ if (html_object == true ||
+ overflow_x != CSS_OVERFLOW_VISIBLE ||
+ overflow_y != CSS_OVERFLOW_VISIBLE)
+ layout_get_box_bbox(child, &child_desc_x0, &child_desc_y0,
+ &child_desc_x1, &child_desc_y1);
+
if (child->style == NULL ||
- (child->style && css_computed_overflow(child->style) ==
- CSS_OVERFLOW_VISIBLE && html_object == false)) {
+ (child->style &&
+ overflow_x == CSS_OVERFLOW_VISIBLE &&
+ html_object == false)) {
/* get child's descendant bbox relative to box */
child_desc_x0 = child_x + child->descendant_x0;
- child_desc_y0 = child_y + child->descendant_y0;
child_desc_x1 = child_x + child->descendant_x1;
+ } else {
+ /* child's descendants don't matter; use child's border edge */
+ /* get the bbox relative to box */
+ child_desc_x0 += child_x;
+ child_desc_x1 += child_x;
+ }
+
+ if (child->style == NULL ||
+ (child->style &&
+ overflow_y == CSS_OVERFLOW_VISIBLE &&
+ html_object == false)) {
+ /* get child's descendant bbox relative to box */
+ child_desc_y0 = child_y + child->descendant_y0;
child_desc_y1 = child_y + child->descendant_y1;
} else {
/* child's descendants don't matter; use child's border edge */
layout_get_box_bbox(child, &child_desc_x0, &child_desc_y0,
&child_desc_x1, &child_desc_y1);
/* get the bbox relative to box */
- child_desc_x0 += child_x;
child_desc_y0 += child_y;
- child_desc_x1 += child_x;
child_desc_y1 += child_y;
}
@@ -5159,7 +5219,9 @@ void layout_calculate_descendant_bboxes(struct box *box)
layout_calculate_descendant_bboxes(child);
- if (box->style && css_computed_overflow(box->style) ==
+ if (box->style && css_computed_overflow_x(box->style) ==
+ CSS_OVERFLOW_HIDDEN &&
+ css_computed_overflow_y(box->style) ==
CSS_OVERFLOW_HIDDEN)
continue;
--
NetSurf Browser
9 years
libcss: branch master updated. release/0.3.0-1-gc6d7f24
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libcss.git/shortlog/c6d7f24987a90bc61e408c...
...commit http://git.netsurf-browser.org/libcss.git/commit/c6d7f24987a90bc61e408c42...
...tree http://git.netsurf-browser.org/libcss.git/tree/c6d7f24987a90bc61e408c4249...
The branch, master has been updated
via c6d7f24987a90bc61e408c4249a6a212276b4174 (commit)
from 89a4d061a46490d5fad3792a565a1a0114c400e0 (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=c6d7f24987a90bc61e40...
commit c6d7f24987a90bc61e408c4249a6a212276b4174
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
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.
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(a)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.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 <jmb(a)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(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 <jmb(a)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_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 <jmb(a)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;
-----------------------------------------------------------------------
Summary of changes:
docs/API-ABI-Changes | 21 +++
docs/Bytecode | 11 ++-
include/libcss/computed.h | 9 +-
include/libcss/properties.h | 3 +-
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 => overflow_x.c} | 20 ++--
src/select/properties/{overflow.c => overflow_y.c} | 20 ++--
src/select/properties/properties.h | 3 +-
src/select/propget.h | 37 ++++--
src/select/propset.h | 38 +++++--
test/data/parse/properties.dat | 46 ++++++-
test/data/parse2/INDEX | 3 +-
test/data/parse2/overflow.dat | 97 +++++++++++++++
test/data/select/tests1.dat | 129 +++++++++++++-------
test/dump.h | 6 +-
test/dump_computed.h | 39 +++++-
26 files changed, 515 insertions(+), 121 deletions(-)
create mode 100644 src/parse/properties/overflow.c
copy src/select/properties/{overflow.c => overflow_x.c} (67%)
rename src/select/properties/{overflow.c => overflow_y.c} (67%)
create mode 100644 test/data/parse2/overflow.dat
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(a)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
similarity index 67%
copy from src/select/properties/overflow.c
copy to 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.c b/src/select/properties/overflow_y.c
similarity index 67%
rename from src/select/properties/overflow.c
rename to src/select/properties/overflow_y.c
index 7d7d0a9..13213b5 100644
--- a/src/select/properties/overflow.c
+++ b/src/select/properties/overflow_y.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_y(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_y(state->computed, value);
}
return CSS_OK;
}
-css_error css__set_overflow_from_hint(const css_hint *hint,
+css_error css__set_overflow_y_from_hint(const css_hint *hint,
css_computed_style *style)
{
- return set_overflow(style, hint->status);
+ return set_overflow_y(style, hint->status);
}
-css_error css__initial_overflow(css_select_state *state)
+css_error css__initial_overflow_y(css_select_state *state)
{
- return set_overflow(state->computed, CSS_OVERFLOW_VISIBLE);
+ return set_overflow_y(state->computed, CSS_OVERFLOW_VISIBLE);
}
-css_error css__compose_overflow(const css_computed_style *parent,
+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(child);
+ uint8_t type = get_overflow_y(child);
if (type == CSS_OVERFLOW_INHERIT) {
- type = get_overflow(parent);
+ type = get_overflow_y(parent);
}
- return set_overflow(result, type);
+ 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;
--
Cascading Style Sheets library
9 years
netsurf: branch master updated. release/3.1-236-g576e93e
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/576e93e1f33614003dd87...
...commit http://git.netsurf-browser.org/netsurf.git/commit/576e93e1f33614003dd876b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/576e93e1f33614003dd876b93...
The branch, master has been updated
via 576e93e1f33614003dd876b93f2f5bbf8228eeed (commit)
via 91f3eb5c2ffcaf3f3b09ba24069f08a7a953ee0c (commit)
from ea01d6b3fc6ea73de24789797fb3fde5e3a26693 (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/netsurf.git/commit/?id=576e93e1f33614003dd...
commit 576e93e1f33614003dd876b93f2f5bbf8228eeed
Merge: 91f3eb5 ea01d6b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=91f3eb5c2ffcaf3f3b0...
commit 91f3eb5c2ffcaf3f3b09ba24069f08a7a953ee0c
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Scope reduce a variable.
diff --git a/riscos/url_complete.c b/riscos/url_complete.c
index 889d1da..b15de0f 100644
--- a/riscos/url_complete.c
+++ b/riscos/url_complete.c
@@ -96,7 +96,6 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
wimp_window_state state;
char *match_url;
const char *url;
- int i;
int old_selection;
int height;
os_error *error;
@@ -144,6 +143,7 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
(strcmp(match_url, url_complete_matched_string))) {
/* memorize the current matches */
+ int i;
int lines = MAXIMUM_VISIBLE_LINES;
if (lines > url_complete_matches_available)
lines = url_complete_matches_available;
-----------------------------------------------------------------------
Summary of changes:
riscos/url_complete.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/riscos/url_complete.c b/riscos/url_complete.c
index 889d1da..b15de0f 100644
--- a/riscos/url_complete.c
+++ b/riscos/url_complete.c
@@ -96,7 +96,6 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
wimp_window_state state;
char *match_url;
const char *url;
- int i;
int old_selection;
int height;
os_error *error;
@@ -144,6 +143,7 @@ bool ro_gui_url_complete_keypress(struct toolbar *toolbar, uint32_t key)
(strcmp(match_url, url_complete_matched_string))) {
/* memorize the current matches */
+ int i;
int lines = MAXIMUM_VISIBLE_LINES;
if (lines > url_complete_matches_available)
lines = url_complete_matches_available;
--
NetSurf Browser
9 years
netsurf: branch master updated. release/3.1-234-gea01d6b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/ea01d6b3fc6ea73de2478...
...commit http://git.netsurf-browser.org/netsurf.git/commit/ea01d6b3fc6ea73de247897...
...tree http://git.netsurf-browser.org/netsurf.git/tree/ea01d6b3fc6ea73de24789797...
The branch, master has been updated
via ea01d6b3fc6ea73de24789797fb3fde5e3a26693 (commit)
via a98b946ca2e6982be3c12eeffdfbc0656a71e5cb (commit)
via 3457d3adc7b94bb9e8715a35a0e5a8377db88856 (commit)
from c7ba173a6405eca736ee7032330c00f9939e7c37 (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/netsurf.git/commit/?id=ea01d6b3fc6ea73de24...
commit ea01d6b3fc6ea73de24789797fb3fde5e3a26693
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Double the stack as it still runs out on occasion
diff --git a/amiga/gui.c b/amiga/gui.c
index 11f874b..1501a5f 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -180,7 +180,7 @@ bool cli_force = false;
static char *current_user;
static char *current_user_dir;
-static const __attribute__((used)) char *stack_cookie = "\0$STACK:131072\0";
+static const __attribute__((used)) char *stack_cookie = "\0$STACK:262144\0";
const char * const versvn;
const char * const verdate;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a98b946ca2e6982be3c...
commit a98b946ca2e6982be3c12eeffdfbc0656a71e5cb
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Confidently remove the debug
diff --git a/amiga/font.c b/amiga/font.c
index 8fc87d7..7af7056 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -341,10 +341,6 @@ bool nsfont_split(const plot_font_style_t *fstyle,
if ((x < tx) && (*char_offset != 0)) {
/* Reached available width, and a space was found;
* split there. */
- LOG(("Split %u chars at %ipx: "
- "Split at char %i (%ipx) - %.*s",
- length, x, *char_offset, *actual_x,
- *char_offset, string));
free(utf16_str);
return true;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3457d3adc7b94bb9e87...
commit 3457d3adc7b94bb9e8715a35a0e5a8377db88856
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Sometimes (but not always) the UTF-16 conversion inserts a BOM. Skip it.
diff --git a/amiga/font.c b/amiga/font.c
index 93bee3c..8fc87d7 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -311,6 +311,8 @@ bool nsfont_split(const plot_font_style_t *fstyle,
*char_offset = 0;
*actual_x = 0;
+ if (*utf16 == 0xFEFF) utf16++;
+
while (utf8_pos < length) {
if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
utf16next = utf16 + 1;
-----------------------------------------------------------------------
Summary of changes:
amiga/font.c | 6 ++----
amiga/gui.c | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/amiga/font.c b/amiga/font.c
index 93bee3c..7af7056 100755
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -311,6 +311,8 @@ bool nsfont_split(const plot_font_style_t *fstyle,
*char_offset = 0;
*actual_x = 0;
+ if (*utf16 == 0xFEFF) utf16++;
+
while (utf8_pos < length) {
if ((*utf16 < 0xD800) || (0xDBFF < *utf16))
utf16next = utf16 + 1;
@@ -339,10 +341,6 @@ bool nsfont_split(const plot_font_style_t *fstyle,
if ((x < tx) && (*char_offset != 0)) {
/* Reached available width, and a space was found;
* split there. */
- LOG(("Split %u chars at %ipx: "
- "Split at char %i (%ipx) - %.*s",
- length, x, *char_offset, *actual_x,
- *char_offset, string));
free(utf16_str);
return true;
}
diff --git a/amiga/gui.c b/amiga/gui.c
index 11f874b..1501a5f 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -180,7 +180,7 @@ bool cli_force = false;
static char *current_user;
static char *current_user_dir;
-static const __attribute__((used)) char *stack_cookie = "\0$STACK:131072\0";
+static const __attribute__((used)) char *stack_cookie = "\0$STACK:262144\0";
const char * const versvn;
const char * const verdate;
--
NetSurf Browser
9 years