changeset 912:91b4b4e04280

add type to CSS properties
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Fri, 06 Feb 2009 19:00:51 +0100
parents 3b75d0050afb
children 6269693c183b
files src/css.cc src/css.hh src/cssparser.cc src/cssparser.hh src/html.cc src/table.cc
diffstat 6 files changed, 137 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.cc	Fri Feb 06 18:23:54 2009 +0100
+++ b/src/css.cc	Fri Feb 06 19:00:51 2009 +0100
@@ -30,7 +30,8 @@
          getRef (i)->free ();
 }
 
-void CssPropertyList::set (CssPropertyName name, CssPropertyValue value) {
+void CssPropertyList::set (CssPropertyName name, CssValueType type,
+                           CssPropertyValue value) {
    for (int i = 0; i < size (); i++)
       if (getRef (i)->name == name) {
          if (ownerOfStrings)
@@ -41,12 +42,15 @@
 
    increase ();
    getRef (size () - 1)->name = name;
+   getRef (size () - 1)->type = type;
    getRef (size () - 1)->value = value;
 }
 
 void CssPropertyList::apply (CssPropertyList *props) {
    for (int i = 0; i < size (); i++)
-      props->set ((CssPropertyName) getRef (i)->name, getRef (i)->value);
+      props->set ((CssPropertyName) getRef (i)->name,
+                  (CssValueType) getRef (i)->type,
+                  getRef (i)->value);
 }
 
 void CssPropertyList::print () {
--- a/src/css.hh	Fri Feb 06 18:23:54 2009 +0100
+++ b/src/css.hh	Fri Feb 06 19:00:51 2009 +0100
@@ -14,6 +14,33 @@
    CSS_PRIMARY_LAST,
 } CssPrimaryOrder;
 
+typedef enum {
+   CSS_TYPE_INTEGER,            /* This type is only used internally, for x-*
+                                   properties. */
+   CSS_TYPE_ENUM,               /* Value is i, if represented by
+                                   enum_symbols[i]. */
+   CSS_TYPE_MULTI_ENUM,         /* For all enum_symbols[i], 1 << i are
+                                   combined. */
+   CSS_TYPE_LENGTH_PERCENTAGE,  /* <length> or <percentage>. Represented by
+                                   CssLength. */
+   CSS_TYPE_LENGTH,             /* <length>, represented as CssLength.
+                                   Note: In some cases, CSS_TYPE_LENGTH is used
+                                   instead of CSS_TYPE_LENGTH_PERCENTAGE,
+                                   only because Dw cannot handle percentages
+                                   in this particular case (e.g.
+                                   'margin-*-width'). */
+   CSS_TYPE_COLOR,              /* Represented as integer. */
+   CSS_TYPE_FONT_WEIGHT,        /* this very special and only used by
+                                   'font-weight' */
+   CSS_TYPE_STRING,             /* <string> */
+   CSS_TYPE_SYMBOL,             /* Symbols, which are directly copied (as
+                                   opposed to CSS_TYPE_ENUM and 
+                                   CSS_TYPE_MULTI_ENUM). Used for
+                                   'font-family'. */
+   CSS_TYPE_UNUSED              /* Not yet used. Will itself get unused some
+                                   day. */
+} CssValueType;
+
 /*
  * Lengths are represented as int in the following way:
  * 
@@ -195,16 +222,17 @@
       };
       ~CssPropertyList ();
 
-      void set (CssPropertyName name, CssPropertyValue value);
-      inline void set (CssPropertyName name, char *value) {
+      void set (CssPropertyName name, CssValueType type,
+                CssPropertyValue value);
+      inline void set (CssPropertyName name, CssValueType type, char *value) {
          CssPropertyValue v;
          v.strVal = value;
-         set (name, v);
+         set (name, type, v);
       };
-      inline void set (CssPropertyName name, int value) {
+      inline void set (CssPropertyName name, CssValueType type, int value) {
          CssPropertyValue v;
          v.intVal = value;
-         set (name, v);
+         set (name, type, v);
       };
       void apply (CssPropertyList *props);
       void print ();
--- a/src/cssparser.cc	Fri Feb 06 18:23:54 2009 +0100
+++ b/src/cssparser.cc	Fri Feb 06 19:00:51 2009 +0100
@@ -870,9 +870,9 @@
                 Css_parse_value(parser, prop, type, &val)) {
                weight = Css_parse_weight(parser);
                if (weight && importantProps)
-                  importantProps->set(prop, val);
+                  importantProps->set(prop, type, val);
                else
-                  props->set(prop, val);
+                  props->set(prop, type, val);
             }
          }
       } else {
@@ -916,10 +916,10 @@
                               if (weight && importantProps)
                                  importantProps->
                                      set(Css_shorthand_info[sh_index].
-                                         properties[i], val);
+                                         properties[i], type, val);
                               else
                                  props->set(Css_shorthand_info[sh_index].
-                                            properties[i], val);
+                                            properties[i], type, val);
                            }
                         }
                   } while (found);
@@ -947,11 +947,13 @@
                         if (weight && importantProps)
                            importantProps->set(Css_shorthand_info[sh_index]
                                                .properties[i],
+                                               type,
                                                dir_vals[dir_set[n - 1]
                                                         [i]]);
                         else
                            props->set(Css_shorthand_info[sh_index]
                                       .properties[i],
+                                      type,
                                       dir_vals[dir_set[n - 1][i]]);
                   } else
                      MSG_CSS("no values for shorthand property '%s'\n",
@@ -977,10 +979,10 @@
                                  if (weight && importantProps)
                                     importantProps->
                                        set(Css_shorthand_info[sh_index].
-                                          properties[j * 3 + i], val);
+                                          properties[j * 3 + i], type, val);
                                  else
                                     props->set(Css_shorthand_info[sh_index].
-                                       properties[j * 3 + i], val);
+                                       properties[j * 3 + i], type, val);
                            }
                         }
                   } while (found);
--- a/src/cssparser.hh	Fri Feb 06 18:23:54 2009 +0100
+++ b/src/cssparser.hh	Fri Feb 06 19:00:51 2009 +0100
@@ -9,32 +9,6 @@
    (CSS_PROPERTY_LAST - CSS_NUM_INTERNAL_PROPERTIES)
 
 
-typedef enum {
-   CSS_TYPE_INTEGER,            /* This type is only used internally, for x-*
-                                   properties. */
-   CSS_TYPE_ENUM,               /* Value is i, if represented by
-                                   enum_symbols[i]. */
-   CSS_TYPE_MULTI_ENUM,         /* For all enum_symbols[i], 1 << i are
-                                   combined. */
-   CSS_TYPE_LENGTH_PERCENTAGE,  /* <length> or <percentage>. Represented by
-                                   CssLength. */
-   CSS_TYPE_LENGTH,             /* <length>, represented as CssLength.
-                                   Note: In some cases, CSS_TYPE_LENGTH is used
-                                   instead of CSS_TYPE_LENGTH_PERCENTAGE,
-                                   only because Dw cannot handle percentages
-                                   in this particular case (e.g.
-                                   'margin-*-width'). */
-   CSS_TYPE_COLOR,              /* Represented as integer. */
-   CSS_TYPE_FONT_WEIGHT,        /* this very special and only used by
-                                   'font-weight' */
-   CSS_TYPE_STRING,             /* <string> */
-   CSS_TYPE_SYMBOL,             /* Symbols, which are directly copied (as
-                                   opposed to CSS_TYPE_ENUM and 
-                                   CSS_TYPE_MULTI_ENUM). Used for
-                                   'font-family'. */
-   CSS_TYPE_UNUSED              /* Not yet used. Will itself get unused some
-                                   day. */
-} CssValueType;
 
 typedef enum {
    CSS_ORIGIN_USER_AGENT,
--- a/src/html.cc	Fri Feb 06 18:23:54 2009 +0100
+++ b/src/html.cc	Fri Feb 06 19:00:51 2009 +0100
@@ -340,7 +340,7 @@
             style_attrs.textAlignChar = '.';
       }
 #endif
-      props->set (CSS_PROPERTY_TEXT_ALIGN, textAlignType);
+      props->set (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, textAlignType);
    }
 }
 
@@ -364,7 +364,7 @@
       else
          valign = VALIGN_MIDDLE;
 
-      props->set (CSS_PROPERTY_VERTICAL_ALIGN, valign);
+      props->set (CSS_PROPERTY_VERTICAL_ALIGN, CSS_TYPE_ENUM, valign);
       return true;
    } else
       return false;
@@ -1700,12 +1700,12 @@
       if (color == 0xffffff && !prefs.allow_white_bg)
          color = prefs.bg_color;
       S_TOP(html)->current_bg_color = color;
-      props.set (CSS_PROPERTY_BACKGROUND_COLOR, color);
+      props.set (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, color);
    }
 
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "text"))) {
       color = a_Html_color_parse(html, attrbuf, prefs.text_color);
-      props.set (CSS_PROPERTY_COLOR, color);
+      props.set (CSS_PROPERTY_COLOR, CSS_TYPE_COLOR, color);
    }
 
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "link")))
@@ -1790,7 +1790,7 @@
       html->styleEngine->setPseudoLink ();
    }
 
-   props.set (PROPERTY_X_LINK, Html_set_new_link(html, &url));
+   props.set (PROPERTY_X_LINK, CSS_TYPE_INTEGER, Html_set_new_link(html, &url));
    html->styleEngine->setNonCssHints (&props);
 
    textblock->addParbreak (5, html->styleEngine->wordStyle ());
@@ -1888,12 +1888,12 @@
          color = a_Html_color_parse(html, attrbuf, -1);
       }
       if (color != -1)
-         props.set (CSS_PROPERTY_COLOR, color);
+         props.set (CSS_PROPERTY_COLOR, CSS_TYPE_COLOR, color);
    }
 
 // \todo reenable font face handling when font selection is implemented
 //   if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "face")))
-//      props.set (CSS_PROPERTY_FONT_FAMILY, attrbuf);
+//      props.set (CSS_PROPERTY_FONT_FAMILY, CSS_TYPE_SYMBOL, attrbuf);
 
    html->styleEngine->setNonCssHints (&props);
 }
@@ -1978,9 +1978,9 @@
       MSG("a_Html_add_new_image: suspicious image size request %dx%d\n", w, h);
    } else {
       if (CSS_LENGTH_TYPE(l_w) != CSS_LENGTH_TYPE_AUTO)
-         props.set (CSS_PROPERTY_WIDTH, l_w);
+         props.set (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, l_w);
       if (CSS_LENGTH_TYPE(l_h) != CSS_LENGTH_TYPE_AUTO)
-         props.set (CSS_PROPERTY_HEIGHT, l_h);
+         props.set (CSS_PROPERTY_HEIGHT, CSS_TYPE_LENGTH_PERCENTAGE, l_h);
    }
 
    /* TODO: we should scale the image respecting its ratio.
@@ -1995,8 +1995,8 @@
       space = strtol(attrbuf, NULL, 10);
       if (space > 0) {
          space = CSS_CREATE_LENGTH(space, CSS_LENGTH_TYPE_PX);
-         props.set (CSS_PROPERTY_MARGIN_LEFT, space);
-         props.set (CSS_PROPERTY_MARGIN_RIGHT, space);
+         props.set (CSS_PROPERTY_MARGIN_LEFT, CSS_TYPE_LENGTH_PERCENTAGE, space);
+         props.set (CSS_PROPERTY_MARGIN_RIGHT, CSS_TYPE_LENGTH_PERCENTAGE, space);
       }
    }
 
@@ -2005,8 +2005,8 @@
       space = strtol(attrbuf, NULL, 10);
       if (space > 0) {
          space = CSS_CREATE_LENGTH(space, CSS_LENGTH_TYPE_PX);
-         props.set (CSS_PROPERTY_MARGIN_TOP, space);
-         props.set (CSS_PROPERTY_MARGIN_BOTTOM, space);
+         props.set (CSS_PROPERTY_MARGIN_TOP, CSS_TYPE_LENGTH_PERCENTAGE, space);
+         props.set (CSS_PROPERTY_MARGIN_BOTTOM, CSS_TYPE_LENGTH_PERCENTAGE, space);
       }
    }
 
@@ -2015,22 +2015,29 @@
       border = strtol(attrbuf, NULL, 10);
       if (border >= 0) {
          border = CSS_CREATE_LENGTH(border, CSS_LENGTH_TYPE_PX);
-         props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, border);
-         props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, border);
-         props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, border);
-         props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, border);
-
-         props.set (CSS_PROPERTY_BORDER_TOP_STYLE, BORDER_SOLID);
-         props.set (CSS_PROPERTY_BORDER_BOTTOM_STYLE,
+         props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                    border);
+         props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                    border);
+         props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                    border);
+         props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                    border);
+
+         props.set (CSS_PROPERTY_BORDER_TOP_STYLE, CSS_TYPE_ENUM,
                     BORDER_SOLID);
-         props.set (CSS_PROPERTY_BORDER_LEFT_STYLE, BORDER_SOLID);
-         props.set (CSS_PROPERTY_BORDER_RIGHT_STYLE,BORDER_SOLID);
+         props.set (CSS_PROPERTY_BORDER_BOTTOM_STYLE, CSS_TYPE_ENUM,
+                    BORDER_SOLID);
+         props.set (CSS_PROPERTY_BORDER_LEFT_STYLE, CSS_TYPE_ENUM,
+                    BORDER_SOLID);
+         props.set (CSS_PROPERTY_BORDER_RIGHT_STYLE, CSS_TYPE_ENUM,
+                    BORDER_SOLID);
       }
    }
 
    /* x_img is an index to a list of {url,image} pairs.
     * We know Html_add_new_linkimage() will use size() as its next index */
-   props.set (PROPERTY_X_IMG, html->images->size());
+   props.set (PROPERTY_X_IMG, CSS_TYPE_INTEGER, html->images->size());
 
    html->styleEngine->setNonCssHints(&props);
 
@@ -2294,7 +2301,8 @@
          html->styleEngine->setPseudoLink ();
       }
    
-      props.set(PROPERTY_X_LINK, Html_set_new_link(html, &url));
+      props.set(PROPERTY_X_LINK, CSS_TYPE_INTEGER,
+                Html_set_new_link(html, &url));
       html->styleEngine->setNonCssHints (&props);
 
       DW2TB(html->dw)->addText("[OBJECT]", html->styleEngine->wordStyle ());
@@ -2368,14 +2376,15 @@
          html->InVisitedLink = true;
          html->styleEngine->setPseudoVisited ();
          if (html->visited_color != -1)
-            props.set (CSS_PROPERTY_COLOR, html->visited_color);
+            props.set (CSS_PROPERTY_COLOR, CSS_TYPE_COLOR, html->visited_color);
       } else {
          html->styleEngine->setPseudoLink ();
          if (html->link_color != -1)
-            props.set (CSS_PROPERTY_COLOR, html->link_color);
+            props.set (CSS_PROPERTY_COLOR, CSS_TYPE_COLOR, html->link_color);
       }
 
-      props.set (PROPERTY_X_LINK, Html_set_new_link(html, &url));
+      props.set (PROPERTY_X_LINK, CSS_TYPE_INTEGER,
+                 Html_set_new_link(html, &url));
 
       html->styleEngine->setNonCssHints (&props);
    }
@@ -2456,7 +2465,7 @@
          /* invalid value */
          list_style_type = LIST_STYLE_TYPE_DISC;
 
-      props.set(CSS_PROPERTY_LIST_STYLE_TYPE, list_style_type);
+      props.set(CSS_PROPERTY_LIST_STYLE_TYPE, CSS_TYPE_ENUM, list_style_type);
       html->styleEngine->setNonCssHints (&props);
    } 
 
@@ -2515,7 +2524,7 @@
       else if (*attrbuf == 'I')
          listStyleType = LIST_STYLE_TYPE_UPPER_ROMAN;
 
-      props.set (CSS_PROPERTY_LIST_STYLE_TYPE, listStyleType);
+      props.set (CSS_PROPERTY_LIST_STYLE_TYPE, CSS_TYPE_ENUM, listStyleType);
       html->styleEngine->setNonCssHints (&props);
    }
 
@@ -2609,7 +2618,7 @@
   
    width_ptr = a_Html_get_attr_wdef(html, tag, tagsize, "width", NULL);
    if (width_ptr) {
-      props.set (CSS_PROPERTY_WIDTH, 
+      props.set (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
          a_Html_parse_length (html, width_ptr));
       dFree(width_ptr);
    }
@@ -2621,10 +2630,10 @@
   
    /* TODO: evaluate attribute */
    if (a_Html_get_attr(html, tag, tagsize, "noshade")) {
-      props.set (CSS_PROPERTY_BORDER_TOP_STYLE, BORDER_SOLID);
-      props.set (CSS_PROPERTY_BORDER_BOTTOM_STYLE, BORDER_SOLID);
-      props.set (CSS_PROPERTY_BORDER_LEFT_STYLE, BORDER_SOLID);
-      props.set (CSS_PROPERTY_BORDER_RIGHT_STYLE, BORDER_SOLID);
+      props.set (CSS_PROPERTY_BORDER_TOP_STYLE, CSS_TYPE_ENUM, BORDER_SOLID);
+      props.set (CSS_PROPERTY_BORDER_BOTTOM_STYLE, CSS_TYPE_ENUM, BORDER_SOLID);
+      props.set (CSS_PROPERTY_BORDER_LEFT_STYLE, CSS_TYPE_ENUM, BORDER_SOLID);
+      props.set (CSS_PROPERTY_BORDER_RIGHT_STYLE, CSS_TYPE_ENUM, BORDER_SOLID);
 
       if (size <= 0)
          size = 1;
@@ -2633,10 +2642,14 @@
    if (size > 0) { 
       CssLength size_top = CSS_CREATE_LENGTH ((size+1)/2, CSS_LENGTH_TYPE_PX);
       CssLength size_bottom = CSS_CREATE_LENGTH (size / 2, CSS_LENGTH_TYPE_PX);
-      props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, size_top);
-      props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, size_top);
-      props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, size_bottom);
-      props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, size_bottom);
+      props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                 size_top);
+      props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, 
+                 size_top);
+      props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE, 
+                 size_bottom);
+      props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                 size_bottom);
    }
 
    DW2TB(html->dw)->addParbreak (5, html->styleEngine->wordStyle ());
--- a/src/table.cc	Fri Feb 06 18:23:54 2009 +0100
+++ b/src/table.cc	Fri Feb 06 19:00:51 2009 +0100
@@ -60,28 +60,33 @@
 
    if (border != -1) {
       cssLength = CSS_CREATE_LENGTH (border, CSS_LENGTH_TYPE_PX);
-      props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, cssLength);
-      props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, cssLength);
-      props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, cssLength);
-      props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, cssLength);
+      props.set (CSS_PROPERTY_BORDER_TOP_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                 cssLength);
+      props.set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                 cssLength);
+      props.set (CSS_PROPERTY_BORDER_LEFT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                 cssLength);
+      props.set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
+                 cssLength);
    }
 
    if (cellspacing != -1) {
       cssLength = CSS_CREATE_LENGTH (cellspacing, CSS_LENGTH_TYPE_PX);
-      props.set (CSS_PROPERTY_BORDER_SPACING, cssLength);
+      props.set (CSS_PROPERTY_BORDER_SPACING, CSS_TYPE_LENGTH_PERCENTAGE,
+                 cssLength);
    }
 
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "width")))
-      props.set (CSS_PROPERTY_WIDTH,
+      props.set (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
          a_Html_parse_length (html, attrbuf));
 
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "align"))) {
       if (dStrcasecmp (attrbuf, "left") == 0)
-         props.set (CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_LEFT);
+         props.set (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, TEXT_ALIGN_LEFT);
       else if (dStrcasecmp (attrbuf, "right") == 0)
-         props.set (CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_RIGHT);
+         props.set (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, TEXT_ALIGN_RIGHT);
       else if (dStrcasecmp (attrbuf, "center") == 0)
-         props.set (CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_CENTER);
+         props.set (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, TEXT_ALIGN_CENTER);
    }
 
    if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) {
@@ -90,7 +95,7 @@
          if (bgcolor == 0xffffff && !prefs.allow_white_bg)
             bgcolor = prefs.bg_color;
          S_TOP(html)->current_bg_color = bgcolor;
-         props.set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor);
+         props.set (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor);
       }
    }
 
@@ -100,18 +105,26 @@
    table_cell_props = new CssPropertyList ();
    if (border > 0) {
       cssLength = CSS_CREATE_LENGTH (1, CSS_LENGTH_TYPE_PX);
-      table_cell_props->set (CSS_PROPERTY_BORDER_TOP_WIDTH, cssLength);
-      table_cell_props->set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH, cssLength);
-      table_cell_props->set (CSS_PROPERTY_BORDER_LEFT_WIDTH, cssLength);
-      table_cell_props->set (CSS_PROPERTY_BORDER_RIGHT_WIDTH, cssLength);
+      table_cell_props->set (CSS_PROPERTY_BORDER_TOP_WIDTH,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
+      table_cell_props->set (CSS_PROPERTY_BORDER_BOTTOM_WIDTH,
+                             CSS_TYPE_LENGTH_PERCENTAGE,  cssLength);
+      table_cell_props->set (CSS_PROPERTY_BORDER_LEFT_WIDTH,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
+      table_cell_props->set (CSS_PROPERTY_BORDER_RIGHT_WIDTH,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
    }
 
    if (cellpadding != -1) {
       cssLength = CSS_CREATE_LENGTH (cellpadding, CSS_LENGTH_TYPE_PX);
-      table_cell_props->set (CSS_PROPERTY_PADDING_TOP, cssLength);
-      table_cell_props->set (CSS_PROPERTY_PADDING_BOTTOM, cssLength);
-      table_cell_props->set (CSS_PROPERTY_PADDING_LEFT, cssLength);
-      table_cell_props->set (CSS_PROPERTY_PADDING_RIGHT, cssLength);
+      table_cell_props->set (CSS_PROPERTY_PADDING_TOP,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
+      table_cell_props->set (CSS_PROPERTY_PADDING_BOTTOM,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
+      table_cell_props->set (CSS_PROPERTY_PADDING_LEFT,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
+      table_cell_props->set (CSS_PROPERTY_PADDING_RIGHT,
+                             CSS_TYPE_LENGTH_PERCENTAGE, cssLength);
    }
 
    if (S_TOP(html)->table_cell_props)
@@ -154,7 +167,7 @@
          if (bgcolor != -1) {
             if (bgcolor == 0xffffff && !prefs.allow_white_bg)
                bgcolor = prefs.bg_color;
-            props.set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor);
+            props.set (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor);
             S_TOP(html)->current_bg_color = bgcolor;
          }
       }
@@ -172,7 +185,8 @@
 
       table_cell_props = new CssPropertyList (*S_TOP(html)->table_cell_props);
       if (bgcolor != -1) {
-         table_cell_props->set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor);
+         table_cell_props->set (CSS_PROPERTY_BACKGROUND_COLOR,
+                                CSS_TYPE_COLOR, bgcolor);
          new_style = true;
       }
       if (a_Html_tag_set_valign_attr (html, tag, tagsize, table_cell_props))
@@ -261,17 +275,17 @@
 
       /* text style */
       if (!S_TOP(html)->cell_text_align_set) {
-         props->set (CSS_PROPERTY_TEXT_ALIGN, text_align);
+         props->set (CSS_PROPERTY_TEXT_ALIGN, CSS_TYPE_ENUM, text_align);
       }
       if (a_Html_get_attr(html, tag, tagsize, "nowrap"))
-         props->set (CSS_PROPERTY_WHITE_SPACE, WHITE_SPACE_NOWRAP);
+         props->set (CSS_PROPERTY_WHITE_SPACE, CSS_TYPE_ENUM, WHITE_SPACE_NOWRAP);
       else
-         props->set (CSS_PROPERTY_WHITE_SPACE, WHITE_SPACE_NORMAL);
+         props->set (CSS_PROPERTY_WHITE_SPACE, CSS_TYPE_ENUM, WHITE_SPACE_NORMAL);
 
       a_Html_tag_set_align_attr (html, props, tag, tagsize);
 
       if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "width"))) {
-         props->set (CSS_PROPERTY_WIDTH,
+         props->set (CSS_PROPERTY_WIDTH, CSS_TYPE_LENGTH_PERCENTAGE,
             a_Html_parse_length (html, attrbuf));
       }
 
@@ -284,7 +298,7 @@
             if (bgcolor == 0xffffff && !prefs.allow_white_bg)
                bgcolor = prefs.bg_color;
 
-            props->set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor);
+            props->set (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor);
             S_TOP(html)->current_bg_color = bgcolor;
          }
       }