diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-10-01 16:12:16 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2010-10-01 16:12:16 +0200 |
commit | 47a9e5206c2f6d7775198533a70cb40013b467f2 (patch) | |
tree | 4b02a821d99ac8aeb4750e4ad9ad1a2c2c25ef48 | |
parent | 43bba3831700cf45fab30c913e6af38a4e67d9ef (diff) |
rework border-width handling
The initial value of border-width-* is "medium" not 0
(see http://www.w3.org/TR/CSS2/box.html#border-width-properties).
Redo the border handling for tables to deal with this.
-rw-r--r-- | dw/style.cc | 4 | ||||
-rw-r--r-- | src/css.cc | 4 | ||||
-rw-r--r-- | src/styleengine.cc | 8 | ||||
-rw-r--r-- | src/table.cc | 16 |
4 files changed, 28 insertions, 4 deletions
diff --git a/dw/style.cc b/dw/style.cc index cc58ce28..f71543f7 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -47,7 +47,7 @@ void StyleAttrs::initValues () backgroundColor = NULL; width = height = lineHeight = LENGTH_AUTO; margin.setVal (0); - borderWidth.setVal (0); + borderWidth.setVal (2); padding.setVal (0); setBorderColor (NULL); setBorderStyle (BORDER_NONE); @@ -75,7 +75,7 @@ void StyleAttrs::resetValues () height = LENGTH_AUTO; margin.setVal (0); - borderWidth.setVal (0); + borderWidth.setVal (2); padding.setVal (0); setBorderColor (NULL); setBorderStyle (BORDER_NONE); @@ -589,8 +589,8 @@ void CssContext::buildUserAgentStyle () { "sub {vertical-align: sub}" "sup {vertical-align: super}" "s, strike, del {text-decoration: line-through}" - "table {border-style: outset; border-spacing: 1px}" - "td, th {border-style: inset; padding: 2px}" + "table {border-spacing: 1px}" + "td, th {padding: 2px}" "thead, tbody, tfoot {vertical-align: middle}" "th {font-weight: bolder; text-align: center}" "code, tt, pre, samp, kbd {font-family: monospace}" diff --git a/src/styleengine.cc b/src/styleengine.cc index b9f30054..f8b63652 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -508,6 +508,14 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { if (attrs->borderColor.right == NULL) attrs->borderColor.right = attrs->color; + if (attrs->borderStyle.top == BORDER_NONE) + attrs->borderWidth.top = 0; + if (attrs->borderStyle.bottom == BORDER_NONE) + attrs->borderWidth.bottom = 0; + if (attrs->borderStyle.left == BORDER_NONE) + attrs->borderWidth.left = 0; + if (attrs->borderStyle.right == BORDER_NONE) + attrs->borderWidth.right = 0; } /** diff --git a/src/table.cc b/src/table.cc index 43304206..eb6a806a 100644 --- a/src/table.cc +++ b/src/table.cc @@ -60,6 +60,14 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) cssLength); props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, cssLength); + props.set (CSS_PROPERTY_BORDER_TOP_STYLE, CSS_TYPE_ENUM, + BORDER_OUTSET); + props.set (CSS_PROPERTY_BORDER_BOTTOM_STYLE, CSS_TYPE_ENUM, + BORDER_OUTSET); + props.set (CSS_PROPERTY_BORDER_LEFT_STYLE, CSS_TYPE_ENUM, + BORDER_OUTSET); + props.set (CSS_PROPERTY_BORDER_RIGHT_STYLE, CSS_TYPE_ENUM, + BORDER_OUTSET); } if (cellspacing != -1) { @@ -103,6 +111,14 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) CSS_TYPE_LENGTH_PERCENTAGE, cssLength); table_cell_props->set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, cssLength); + table_cell_props->set (CSS_PROPERTY_BORDER_TOP_STYLE, + CSS_TYPE_ENUM, BORDER_INSET); + table_cell_props->set (CSS_PROPERTY_BORDER_BOTTOM_STYLE, + CSS_TYPE_ENUM, BORDER_INSET); + table_cell_props->set (CSS_PROPERTY_BORDER_LEFT_STYLE, + CSS_TYPE_ENUM, BORDER_INSET); + table_cell_props->set (CSS_PROPERTY_BORDER_RIGHT_STYLE, + CSS_TYPE_ENUM, BORDER_INSET); } if (cellpadding != -1) { |