Hi Tim, On Fri, Dec 11, 2009 at 10:53:17PM +0100, Tim Nieradzik wrote:
I've just started work on support for the "float" property but I'm already running into difficulties when trying to add the detection for its values.
Every website gets screwed up after applying my patch. Any ideas?
The problem is that you added more CSS_PROPERTY_* values. The CSS_PROPERTY_* values need to correspond with the CssPropertyInfo in cssparser.cc. By inserting CSS_PROPERTY_* values all properties after CSS_PROPERTY_FLOAT_LEFT will no longer match. But you don't need to add CSS_PROPERTY_* values anyway. There is one CSS_PROPERTY_* value for each CSS property (http://www.w3.org/TR/CSS2/). For floats there is only one property "float" for which there is already CSS_PROPERTY_FLOAT in css.hh. It can have the values you correctly defined in Css_float_enum_vals. So your patch looks good, just leave out the change in css.hh. But that was the easy part... The real problem is what to do with those values. We need a way to render floating elements in dw/* Johannes
--Tim
diff --git a/src/css.hh b/src/css.hh index 79ba302..815c14a 100644 --- a/src/css.hh +++ b/src/css.hh @@ -166,7 +166,9 @@ typedef enum { CSS_PROPERTY_DIRECTION, CSS_PROPERTY_DISPLAY, CSS_PROPERTY_EMPTY_CELLS, - CSS_PROPERTY_FLOAT, + CSS_PROPERTY_FLOAT_LEFT, + CSS_PROPERTY_FLOAT_RIGHT, + CSS_PROPERTY_FLOAT_NONE, CSS_PROPERTY_FONT_FAMILY, CSS_PROPERTY_FONT_SIZE, CSS_PROPERTY_FONT_SIZE_ADJUST, diff --git a/src/cssparser.cc b/src/cssparser.cc index 5f5bde0..4b6c2ad 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -101,6 +101,10 @@ static const char *const Css_text_decoration_enum_vals[] = { "underline", "overline", "line-through", "blink", NULL };
+static const char *const Css_float_enum_vals[] = { + "left", "right", "none", NULL +}; + static const char *const Css_vertical_align_vals[] = { "top", "bottom", "middle", "baseline", "sub", "super", NULL }; @@ -145,7 +149,7 @@ const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = { {"direction", {CSS_TYPE_UNUSED}, NULL}, {"display", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_display_enum_vals}, {"empty-cells", {CSS_TYPE_UNUSED}, NULL}, - {"float", {CSS_TYPE_UNUSED}, NULL}, + {"float", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_float_enum_vals}, {"font-family", {CSS_TYPE_SYMBOL, CSS_TYPE_UNUSED}, NULL}, {"font-size", {CSS_TYPE_ENUM, CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_UNUSED}, Css_font_size_enum_vals},
_______________________________________________ Dillo-dev mailing list Dillo-dev@dillo.org http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev