[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:
parent
faef35e6e9
commit
6560a2ae5f
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
124
css/ruleset.c
124
css/ruleset.c
|
@ -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);
|
||||
|
@ -129,62 +130,63 @@ struct css_property_entry {
|
|||
|
||||
/** Table of property parsers. MUST be sorted by property name. */
|
||||
static const struct css_property_entry css_property_table[] = {
|
||||
{ "background", parse_background },
|
||||
{ "background-attachment", parse_background_attachment },
|
||||
{ "background-color", parse_background_color },
|
||||
{ "background-image", parse_background_image },
|
||||
{ "background-position", parse_background_position },
|
||||
{ "background-repeat", parse_background_repeat },
|
||||
{ "border", parse_border },
|
||||
{ "border-bottom", parse_border_bottom },
|
||||
{ "border-bottom-color", parse_border_bottom_color },
|
||||
{ "border-bottom-style", parse_border_bottom_style },
|
||||
{ "border-bottom-width", parse_border_bottom_width },
|
||||
{ "border-color", parse_border_color },
|
||||
{ "border-left", parse_border_left },
|
||||
{ "border-left-color", parse_border_left_color },
|
||||
{ "border-left-style", parse_border_left_style },
|
||||
{ "border-left-width", parse_border_left_width },
|
||||
{ "border-right", parse_border_right },
|
||||
{ "border-right-color", parse_border_right_color },
|
||||
{ "border-right-style", parse_border_right_style },
|
||||
{ "border-right-width", parse_border_right_width },
|
||||
{ "border-style", parse_border_style },
|
||||
{ "border-top", parse_border_top },
|
||||
{ "border-top-color", parse_border_top_color },
|
||||
{ "border-top-style", parse_border_top_style },
|
||||
{ "border-top-width", parse_border_top_width },
|
||||
{ "border-width", parse_border_width },
|
||||
{ "clear", parse_clear },
|
||||
{ "color", parse_color },
|
||||
{ "cursor", parse_cursor },
|
||||
{ "display", parse_display },
|
||||
{ "float", parse_float },
|
||||
{ "font", parse_font },
|
||||
{ "font-family", parse_font_family },
|
||||
{ "font-size", parse_font_size },
|
||||
{ "font-style", parse_font_style },
|
||||
{ "font-variant", parse_font_variant },
|
||||
{ "font-weight", parse_font_weight },
|
||||
{ "height", parse_height },
|
||||
{ "line-height", parse_line_height },
|
||||
{ "margin", parse_margin },
|
||||
{ "margin-bottom", parse_margin_bottom },
|
||||
{ "margin-left", parse_margin_left },
|
||||
{ "margin-right", parse_margin_right },
|
||||
{ "margin-top", parse_margin_top },
|
||||
{ "padding", parse_padding },
|
||||
{ "padding-bottom", parse_padding_bottom },
|
||||
{ "padding-left", parse_padding_left },
|
||||
{ "padding-right", parse_padding_right },
|
||||
{ "padding-top", parse_padding_top },
|
||||
{ "text-align", parse_text_align },
|
||||
{ "text-decoration", parse_text_decoration },
|
||||
{ "text-indent", parse_text_indent },
|
||||
{ "text-transform", parse_text_transform },
|
||||
{ "visibility", parse_visibility },
|
||||
{ "white-space", parse_white_space },
|
||||
{ "width", parse_width },
|
||||
{ "background", parse_background },
|
||||
{ "background-attachment", parse_background_attachment },
|
||||
{ "background-color", parse_background_color },
|
||||
{ "background-image", parse_background_image },
|
||||
{ "background-position", parse_background_position },
|
||||
{ "background-repeat", parse_background_repeat },
|
||||
{ "border", parse_border },
|
||||
{ "border-bottom", parse_border_bottom },
|
||||
{ "border-bottom-color", parse_border_bottom_color },
|
||||
{ "border-bottom-style", parse_border_bottom_style },
|
||||
{ "border-bottom-width", parse_border_bottom_width },
|
||||
{ "border-color", parse_border_color },
|
||||
{ "border-left", parse_border_left },
|
||||
{ "border-left-color", parse_border_left_color },
|
||||
{ "border-left-style", parse_border_left_style },
|
||||
{ "border-left-width", parse_border_left_width },
|
||||
{ "border-right", parse_border_right },
|
||||
{ "border-right-color", parse_border_right_color },
|
||||
{ "border-right-style", parse_border_right_style },
|
||||
{ "border-right-width", parse_border_right_width },
|
||||
{ "border-style", parse_border_style },
|
||||
{ "border-top", parse_border_top },
|
||||
{ "border-top-color", parse_border_top_color },
|
||||
{ "border-top-style", parse_border_top_style },
|
||||
{ "border-top-width", parse_border_top_width },
|
||||
{ "border-width", parse_border_width },
|
||||
{ "clear", parse_clear },
|
||||
{ "color", parse_color },
|
||||
{ "cursor", parse_cursor },
|
||||
{ "display", parse_display },
|
||||
{ "float", parse_float },
|
||||
{ "font", parse_font },
|
||||
{ "font-family", parse_font_family },
|
||||
{ "font-size", parse_font_size },
|
||||
{ "font-style", parse_font_style },
|
||||
{ "font-variant", parse_font_variant },
|
||||
{ "font-weight", parse_font_weight },
|
||||
{ "height", parse_height },
|
||||
{ "line-height", parse_line_height },
|
||||
{ "margin", parse_margin },
|
||||
{ "margin-bottom", parse_margin_bottom },
|
||||
{ "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 },
|
||||
{ "padding-right", parse_padding_right },
|
||||
{ "padding-top", parse_padding_top },
|
||||
{ "text-align", parse_text_align },
|
||||
{ "text-decoration", parse_text_decoration },
|
||||
{ "text-indent", parse_text_indent },
|
||||
{ "text-transform", parse_text_transform },
|
||||
{ "visibility", parse_visibility },
|
||||
{ "white-space", parse_white_space },
|
||||
{ "width", parse_width },
|
||||
};
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue