changeset 1473:87a7d28d4c7d

fix CSS_SHORTHAND_DIRECTIONS case in CssParser * Don't modify type parameter in tokenMatchesProperty() if there is no match. * Use correct type for each of the values parsed in a CSS_SHORTHAND_DIRECTIONS-style declaration.
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Sat, 19 Dec 2009 18:59:21 +0100
parents 6ed936726b50
children f61d3ba42b88
files src/cssparser.cc
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/cssparser.cc	Fri Dec 18 22:23:30 2009 +0100
+++ b/src/cssparser.cc	Sat Dec 19 18:59:21 2009 +0100
@@ -626,9 +626,10 @@
 }
 
 
-bool CssParser::tokenMatchesProperty(CssPropertyName prop, CssValueType * type)
+bool CssParser::tokenMatchesProperty(CssPropertyName prop, CssValueType *type)
 {
    int i, err = 1;
+   CssValueType savedType = *type;
 
    for (int j = 0; Css_property_info[prop].type[j] != CSS_TYPE_UNUSED; j++) {
       *type = Css_property_info[prop].type[j];
@@ -706,7 +707,7 @@
       }
    }
 
-   *type = CSS_TYPE_UNUSED;
+   *type = savedType;
    return false;
 }
 
@@ -1010,6 +1011,7 @@
 
    CssPropertyName prop;
    CssPropertyValue val, dir_vals[4];
+   CssValueType  dir_types[4];
    bool found, weight;
    int sh_index, i, j, n;
    int dir_set[4][4] = {
@@ -1095,6 +1097,7 @@
                          parseValue(Css_shorthand_info[sh_index]
                                     .properties[0], type, &val)) {
                         dir_vals[n] = val;
+                        dir_types[n] = type;
                         n++;
                      } else
                         break;
@@ -1106,13 +1109,12 @@
                         if (weight && importantProps)
                            importantProps->set(Css_shorthand_info[sh_index]
                                                .properties[i],
-                                               type,
-                                               dir_vals[dir_set[n - 1]
-                                                        [i]]);
+                                               dir_types[dir_set[n - 1][i]],
+                                               dir_vals[dir_set[n - 1][i]]);
                         else
                            props->set(Css_shorthand_info[sh_index]
                                       .properties[i],
-                                      type,
+                                      dir_types[dir_set[n - 1][i]],
                                       dir_vals[dir_set[n - 1][i]]);
                   } else
                      MSG_CSS("no values for shorthand property '%s'\n",