[project @ 2004-07-16 20:22:31 by jmb]

Add overflow support.
Re-tabulate property table in ruleset.c

svn path=/import/netsurf/; revision=1087
This commit is contained in:
John Mark Bell 2004-07-16 20:22:31 +00:00
parent faef35e6e9
commit 6560a2ae5f
3 changed files with 79 additions and 56 deletions

View File

@ -133,6 +133,7 @@ const struct css_style css_base_style = {
{ CSS_MARGIN_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_MARGIN_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_MARGIN_LENGTH, { { 0, CSS_UNIT_PX } } } },
CSS_OVERFLOW_VISIBLE,
{ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
@ -178,6 +179,7 @@ const struct css_style css_empty_style = {
{ CSS_MARGIN_INHERIT, { { 0, CSS_UNIT_PX } } },
{ CSS_MARGIN_INHERIT, { { 0, CSS_UNIT_PX } } },
{ CSS_MARGIN_INHERIT, { { 0, CSS_UNIT_PX } } } },
CSS_OVERFLOW_INHERIT,
{ { CSS_PADDING_INHERIT, { { 0, CSS_UNIT_PX } } },
{ CSS_PADDING_INHERIT, { { 0, CSS_UNIT_PX } } },
{ CSS_PADDING_INHERIT, { { 0, CSS_UNIT_PX } } },
@ -224,6 +226,7 @@ const struct css_style css_blank_style = {
{ CSS_MARGIN_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_MARGIN_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_MARGIN_LENGTH, { { 0, CSS_UNIT_PX } } } },
CSS_OVERFLOW_VISIBLE,
{ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
{ CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
@ -1152,6 +1155,8 @@ void css_dump_style(const struct css_style * const style)
fprintf(stderr, "; ");
}
DUMP_KEYWORD(overflow, "overflow", css_overflow_name);
if (style->padding[0].padding != css_empty_style.padding[0].padding ||
style->padding[1].padding != css_empty_style.padding[1].padding ||
style->padding[2].padding != css_empty_style.padding[2].padding ||
@ -1394,6 +1399,8 @@ void css_cascade(struct css_style * const style,
style->height = apply->height;
if (apply->line_height.size != CSS_LINE_HEIGHT_INHERIT)
style->line_height = apply->line_height;
if (apply->overflow != CSS_OVERFLOW_INHERIT)
style->overflow = apply->overflow;
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
style->text_align = apply->text_align;
if (apply->text_indent.size != CSS_TEXT_INDENT_INHERIT)
@ -1517,6 +1524,8 @@ void css_merge(struct css_style * const style,
style->height = apply->height;
if (apply->line_height.size != CSS_LINE_HEIGHT_INHERIT)
style->line_height = apply->line_height;
if (apply->overflow != CSS_OVERFLOW_INHERIT)
style->overflow = apply->overflow;
if (apply->text_align != CSS_TEXT_ALIGN_INHERIT)
style->text_align = apply->text_align;
if (apply->text_decoration != CSS_TEXT_DECORATION_INHERIT)

View File

@ -154,6 +154,8 @@ struct css_style {
} value;
} margin[4]; /**< top, right, bottom, left */
css_overflow overflow;
struct {
enum { CSS_PADDING_INHERIT,
CSS_PADDING_LENGTH,

View File

@ -102,6 +102,7 @@ static void parse_margin_right(struct css_style * const s, const struct css_node
static void parse_margin_top(struct css_style * const s, const struct css_node * const v);
static void parse_margin_side(struct css_style * const s, const struct css_node * const v,
unsigned int i);
static void parse_overflow(struct css_style * const s, const struct css_node * const v);
static void parse_padding(struct css_style * const s, const struct css_node * const v);
static void parse_padding_bottom(struct css_style * const s, const struct css_node * const v);
static void parse_padding_left(struct css_style * const s, const struct css_node * const v);
@ -173,6 +174,7 @@ static const struct css_property_entry css_property_table[] = {
{ "margin-left", parse_margin_left },
{ "margin-right", parse_margin_right },
{ "margin-top", parse_margin_top },
{ "overflow", parse_overflow },
{ "padding", parse_padding },
{ "padding-bottom", parse_padding_bottom },
{ "padding-left", parse_padding_left },
@ -1565,6 +1567,16 @@ void parse_margin_side(struct css_style * const s, const struct css_node * const
}
}
void parse_overflow(struct css_style * const s, const struct css_node * const v)
{
css_overflow z;
if (v->type != CSS_NODE_IDENT || v->next != 0)
return;
z = css_overflow_parse(v->data, v->data_length);
if (z != CSS_OVERFLOW_UNKNOWN)
s->overflow = z;
}
void parse_padding(struct css_style * const s, const struct css_node * const v)
{
unsigned int count = 0;