summaryrefslogtreecommitdiff
path: root/css/css.c
diff options
context:
space:
mode:
Diffstat (limited to 'css/css.c')
-rw-r--r--css/css.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/css/css.c b/css/css.c
index 19e525e2b..ff5268c68 100644
--- a/css/css.c
+++ b/css/css.c
@@ -109,6 +109,7 @@ static void css_dump_selector(const struct css_selector *r);
/** Default style for a document. These are the 'Initial values' from the
* spec. */
const struct css_style css_base_style = {
+ { {CSS_CELLPADDING_VALUE, 1} },
CSS_BACKGROUND_ATTACHMENT_SCROLL,
0xffffff,
{ CSS_BACKGROUND_IMAGE_NONE, 0 },
@@ -165,10 +166,10 @@ const struct css_style css_base_style = {
{ CSS_BORDER_WIDTH_LENGTH, { 2, CSS_UNIT_PX } },
CSS_BORDER_STYLE_NONE },
CSS_OVERFLOW_VISIBLE,
- { { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } } },
+ { { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false }, },
CSS_PAGE_BREAK_AFTER_AUTO,
CSS_PAGE_BREAK_BEFORE_AUTO,
CSS_PAGE_BREAK_INSIDE_AUTO,
@@ -194,6 +195,7 @@ const struct css_style css_base_style = {
/** Style with no values set. */
const struct css_style css_empty_style = {
+ { { CSS_CELLPADDING_NOT_SET, 0 } },
CSS_BACKGROUND_ATTACHMENT_NOT_SET,
CSS_COLOR_NOT_SET,
{ CSS_BACKGROUND_IMAGE_NOT_SET, 0 },
@@ -250,10 +252,10 @@ const struct css_style css_empty_style = {
{ CSS_BORDER_WIDTH_NOT_SET, { 0, CSS_UNIT_PX } },
CSS_BORDER_STYLE_NOT_SET },
CSS_OVERFLOW_NOT_SET,
- { { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } } } },
+ { { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_NOT_SET, { { 0, CSS_UNIT_PX } }, false }, },
CSS_PAGE_BREAK_AFTER_NOT_SET,
CSS_PAGE_BREAK_BEFORE_NOT_SET,
CSS_PAGE_BREAK_INSIDE_NOT_SET,
@@ -280,6 +282,7 @@ const struct css_style css_empty_style = {
/** Default style for an element. These should be INHERIT if 'Inherited' is yes,
* and the 'Initial value' otherwise. */
const struct css_style css_blank_style = {
+ { { CSS_CELLPADDING_INHERIT, 0 } },
CSS_BACKGROUND_ATTACHMENT_SCROLL,
TRANSPARENT,
{ CSS_BACKGROUND_IMAGE_NONE, 0 },
@@ -336,10 +339,10 @@ const struct css_style css_blank_style = {
{ CSS_BORDER_WIDTH_LENGTH, { 2, CSS_UNIT_PX } },
CSS_BORDER_STYLE_NONE },
CSS_OVERFLOW_VISIBLE,
- { { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } },
- { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } } } },
+ { { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false },
+ { CSS_PADDING_LENGTH, { { 0, CSS_UNIT_PX } }, false }, },
CSS_PAGE_BREAK_AFTER_AUTO,
CSS_PAGE_BREAK_BEFORE_AUTO,
CSS_PAGE_BREAK_INSIDE_INHERIT,
@@ -2378,6 +2381,11 @@ void css_cascade(struct css_style * const style,
unsigned int i;
float f;
+ if (apply->html_style.cellpadding.type !=
+ CSS_CELLPADDING_INHERIT &&
+ apply->html_style.cellpadding.type !=
+ CSS_CELLPADDING_NOT_SET)
+ style->html_style.cellpadding = apply->html_style.cellpadding;
if (apply->background_attachment !=
CSS_BACKGROUND_ATTACHMENT_INHERIT &&
apply->background_attachment !=
@@ -2668,6 +2676,8 @@ void css_merge(struct css_style * const style,
{
unsigned int i;
+ if (apply->html_style.cellpadding.type != CSS_CELLPADDING_NOT_SET)
+ style->html_style.cellpadding = apply->html_style.cellpadding;
if (apply->background_attachment != CSS_BACKGROUND_ATTACHMENT_NOT_SET)
style->background_attachment = apply->background_attachment;
if (apply->background_color != CSS_COLOR_NOT_SET)