changeset 1710:18f974a1380c

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.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 01 Oct 2010 16:12:16 +0200
parents bb7a10e3e73a
children b27cf7eb15b6
files dw/style.cc src/css.cc src/styleengine.cc src/table.cc
diffstat 4 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dw/style.cc	Wed Sep 29 15:29:34 2010 -0400
+++ b/dw/style.cc	Fri Oct 01 16:12:16 2010 +0200
@@ -47,7 +47,7 @@
    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 @@
    height = LENGTH_AUTO;
 
    margin.setVal (0);
-   borderWidth.setVal (0);
+   borderWidth.setVal (2);
    padding.setVal (0);
    setBorderColor (NULL);
    setBorderStyle (BORDER_NONE);
--- a/src/css.cc	Wed Sep 29 15:29:34 2010 -0400
+++ b/src/css.cc	Fri Oct 01 16:12:16 2010 +0200
@@ -589,8 +589,8 @@
      "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}"
--- a/src/styleengine.cc	Wed Sep 29 15:29:34 2010 -0400
+++ b/src/styleengine.cc	Fri Oct 01 16:12:16 2010 +0200
@@ -508,6 +508,14 @@
    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;
 }
 
 /**
--- a/src/table.cc	Wed Sep 29 15:29:34 2010 -0400
+++ b/src/table.cc	Fri Oct 01 16:12:16 2010 +0200
@@ -60,6 +60,14 @@
                  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 @@
                              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) {