changeset 1756:cc7c9180ae95

imported patch border-collapse-parsing
author Jorge Arellano Cid <jcid@dillo.org>
date Thu, 21 Oct 2010 11:22:29 -0300
parents 4eabd51a5d96
children c75d0b8f71fc
files dw/style.cc dw/style.hh src/cssparser.cc src/styleengine.cc
diffstat 4 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/dw/style.cc	Sun Oct 17 22:14:11 2010 +0200
+++ b/dw/style.cc	Thu Oct 21 11:22:29 2010 -0300
@@ -49,6 +49,7 @@
    margin.setVal (0);
    borderWidth.setVal (0);
    padding.setVal (0);
+   borderCollapse = BORDER_MODEL_SEPARATE;
    setBorderColor (NULL);
    setBorderStyle (BORDER_NONE);
    hBorderSpacing = 0;
@@ -123,6 +124,7 @@
        margin.equals (&otherAttrs->margin) &&
        borderWidth.equals (&otherAttrs->borderWidth) &&
        padding.equals (&otherAttrs->padding) &&
+       borderCollapse == otherAttrs->borderCollapse &&
        borderColor.top == otherAttrs->borderColor.top &&
        borderColor.right == otherAttrs->borderColor.right &&
        borderColor.bottom == otherAttrs->borderColor.bottom &&
@@ -158,6 +160,7 @@
       margin.hashValue () +
       borderWidth.hashValue () +
       padding.hashValue () +
+      borderCollapse +
       (intptr_t) borderColor.top +
       (intptr_t) borderColor.right +
       (intptr_t) borderColor.bottom  +
@@ -246,6 +249,7 @@
    margin = attrs->margin;
    borderWidth = attrs->borderWidth;
    padding = attrs->padding;
+   borderCollapse = attrs->borderCollapse;
    borderColor = attrs->borderColor;
    borderStyle = attrs->borderStyle;
    display = attrs->display;
--- a/dw/style.hh	Sun Oct 17 22:14:11 2010 +0200
+++ b/dw/style.hh	Thu Oct 21 11:22:29 2010 -0300
@@ -193,7 +193,7 @@
 namespace style {
 
 enum Cursor {
-   CURSOR_COSSHAIR,
+   CURSOR_CROSSHAIR,
    CURSOR_DEFAULT,
    CURSOR_POINTER,
    CURSOR_MOVE,
@@ -210,6 +210,11 @@
    CURSOR_HELP
 };
 
+enum BorderCollapse {
+   BORDER_MODEL_SEPARATE,
+   BORDER_MODEL_COLLAPSE
+};
+
 enum BorderStyle {
    BORDER_NONE,
    BORDER_HIDDEN,
@@ -435,6 +440,7 @@
    Length width, height, lineHeight;
 
    Box margin, borderWidth, padding;
+   BorderCollapse borderCollapse;
    struct { Color *top, *right, *bottom, *left; } borderColor;
    struct { BorderStyle top, right, bottom, left; } borderStyle;
 
--- a/src/cssparser.cc	Sun Oct 17 22:14:11 2010 +0200
+++ b/src/cssparser.cc	Thu Oct 21 11:22:29 2010 -0300
@@ -47,6 +47,10 @@
    const char *const *enum_symbols;
 } CssPropertyInfo;
 
+static const char *const Css_border_collapse_enum_vals[] = {
+   "separate", "collapse", NULL
+};
+
 static const char *const Css_border_style_enum_vals[] = {
    "none", "hidden", "dotted", "dashed", "solid", "double", "groove",
    "ridge", "inset", "outset", NULL
@@ -137,7 +141,8 @@
     Css_border_style_enum_vals},
    {"border-bottom-width", {CSS_TYPE_ENUM, CSS_TYPE_LENGTH, CSS_TYPE_UNUSED},
     Css_border_width_enum_vals},
-   {"border-collapse", {CSS_TYPE_UNUSED}, NULL},
+   {"border-collapse", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_border_collapse_enum_vals},
    {"border-left-color", {CSS_TYPE_COLOR, CSS_TYPE_UNUSED}, NULL},
    {"border-left-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
     Css_border_style_enum_vals},
--- a/src/styleengine.cc	Sun Oct 17 22:14:11 2010 +0200
+++ b/src/styleengine.cc	Thu Oct 21 11:22:29 2010 -0300
@@ -434,6 +434,9 @@
                //attrs->backgroundColor = Color::create(layout, 0xdcd1ba);
                attrs->backgroundColor = Color::create(layout, 0xe0e0a3);
             break;
+         case CSS_PROPERTY_BORDER_COLLAPSE:
+            attrs->borderCollapse = (BorderCollapse) p->value.intVal;
+            break;
          case CSS_PROPERTY_BORDER_TOP_COLOR:
             attrs->borderColor.top =
               Color::create (layout, p->value.intVal);