diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-02-05 19:23:33 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-02-05 19:23:33 +0100 |
commit | 1326c5a9c7d5a7449c85c26cc286936f15cde3c1 (patch) | |
tree | 1cdf1c2276bd20bcdbd5abc08b2c63b152854e7e /src | |
parent | 4eb1e41793ec65d83bb41f58388edee610e3db8e (diff) |
move CssProperty::Name and CssProperty::Value out of CssProperty class
Diffstat (limited to 'src')
-rw-r--r-- | src/css.cc | 4 | ||||
-rw-r--r-- | src/css.hh | 229 | ||||
-rw-r--r-- | src/cssparser.cc | 202 | ||||
-rw-r--r-- | src/cssparser.hh | 4 | ||||
-rw-r--r-- | src/html.cc | 74 | ||||
-rw-r--r-- | src/styleengine.cc | 92 | ||||
-rw-r--r-- | src/table.cc | 50 |
7 files changed, 328 insertions, 327 deletions
@@ -30,7 +30,7 @@ CssPropertyList::~CssPropertyList () { getRef (i)->free (); } -void CssPropertyList::set (CssProperty::Name name, CssProperty::Value value) { +void CssPropertyList::set (CssPropertyName name, CssPropertyValue value) { for (int i = 0; i < size (); i++) if (getRef (i)->name == name) { if (ownerOfStrings) @@ -46,7 +46,7 @@ void CssPropertyList::set (CssProperty::Name name, CssProperty::Value value) { void CssPropertyList::apply (CssPropertyList *props) { for (int i = 0; i < size (); i++) - props->set ((CssProperty::Name) getRef (i)->name, getRef (i)->value); + props->set ((CssPropertyName) getRef (i)->name, getRef (i)->value); } void CssPropertyList::print () { @@ -45,126 +45,127 @@ enum { #define CSS_LENGTH_VALUE(l) ( ( (float)((l) & ~7) ) / (1 << 19) ) #define CSS_LENGTH_TYPE(l) ((l) & 7) +typedef enum { + CSS_PROPERTY_BACKGROUND_ATTACHMENT, + CSS_PROPERTY_BACKGROUND_COLOR, + CSS_PROPERTY_BACKGROUND_IMAGE, + CSS_PROPERTY_BACKGROUND_POSITION, + CSS_PROPERTY_BACKGROUND_REPEAT, + CSS_PROPERTY_BORDER_BOTTOM_COLOR, + CSS_PROPERTY_BORDER_BOTTOM_STYLE, + CSS_PROPERTY_BORDER_BOTTOM_WIDTH, + CSS_PROPERTY_BORDER_COLLAPSE, + CSS_PROPERTY_BORDER_LEFT_COLOR, + CSS_PROPERTY_BORDER_LEFT_STYLE, + CSS_PROPERTY_BORDER_LEFT_WIDTH, + CSS_PROPERTY_BORDER_RIGHT_COLOR, + CSS_PROPERTY_BORDER_RIGHT_STYLE, + CSS_PROPERTY_BORDER_RIGHT_WIDTH, + CSS_PROPERTY_BORDER_SPACING, + CSS_PROPERTY_BORDER_TOP_COLOR, + CSS_PROPERTY_BORDER_TOP_STYLE, + CSS_PROPERTY_BORDER_TOP_WIDTH, + CSS_PROPERTY_BOTTOM, + CSS_PROPERTY_CAPTION_SIDE, + CSS_PROPERTY_CLEAR, + CSS_PROPERTY_CLIP, + CSS_PROPERTY_COLOR, + CSS_PROPERTY_CONTENT, + CSS_PROPERTY_COUNTER_INCREMENT, + CSS_PROPERTY_COUNTER_RESET, + CSS_PROPERTY_CURSOR, + CSS_PROPERTY_DIRECTION, + CSS_PROPERTY_DISPLAY, + CSS_PROPERTY_EMPTY_CELLS, + CSS_PROPERTY_FLOAT, + CSS_PROPERTY_FONT_FAMILY, + CSS_PROPERTY_FONT_SIZE, + CSS_PROPERTY_FONT_SIZE_ADJUST, + CSS_PROPERTY_FONT_STRETCH, + CSS_PROPERTY_FONT_STYLE, + CSS_PROPERTY_FONT_VARIANT, + CSS_PROPERTY_FONT_WEIGHT, + CSS_PROPERTY_HEIGHT, + CSS_PROPERTY_LEFT, + CSS_PROPERTY_LETTER_SPACING, + CSS_PROPERTY_LINE_HEIGHT, + CSS_PROPERTY_LIST_STYLE_IMAGE, + CSS_PROPERTY_LIST_STYLE_POSITION, + CSS_PROPERTY_LIST_STYLE_TYPE, + CSS_PROPERTY_MARGIN_BOTTOM, + CSS_PROPERTY_MARGIN_LEFT, + CSS_PROPERTY_MARGIN_RIGHT, + CSS_PROPERTY_MARGIN_TOP, + CSS_PROPERTY_MARKER_OFFSET, + CSS_PROPERTY_MARKS, + CSS_PROPERTY_MAX_HEIGHT, + CSS_PROPERTY_MAX_WIDTH, + CSS_PROPERTY_MIN_HEIGHT, + CSS_PROPERTY_MIN_WIDTH, + CSS_PROPERTY_OUTLINE_COLOR, + CSS_PROPERTY_OUTLINE_STYLE, + CSS_PROPERTY_OUTLINE_WIDTH, + CSS_PROPERTY_OVERFLOW, + CSS_PROPERTY_PADDING_BOTTOM, + CSS_PROPERTY_PADDING_LEFT, + CSS_PROPERTY_PADDING_RIGHT, + CSS_PROPERTY_PADDING_TOP, + CSS_PROPERTY_POSITION, + CSS_PROPERTY_QUOTES, + CSS_PROPERTY_RIGHT, + CSS_PROPERTY_TEXT_ALIGN, + CSS_PROPERTY_TEXT_DECORATION, + CSS_PROPERTY_TEXT_INDENT, + CSS_PROPERTY_TEXT_SHADOW, + CSS_PROPERTY_TEXT_TRANSFORM, + CSS_PROPERTY_TOP, + CSS_PROPERTY_UNICODE_BIDI, + CSS_PROPERTY_VERTICAL_ALIGN, + CSS_PROPERTY_VISIBILITY, + CSS_PROPERTY_WHITE_SPACE, + CSS_PROPERTY_WIDTH, + CSS_PROPERTY_WORD_SPACING, + CSS_PROPERTY_Z_INDEX, + CSS_PROPERTY_X_LINK, + CSS_PROPERTY_X_COLSPAN, + CSS_PROPERTY_X_ROWSPAN, + PROPERTY_X_LINK, + PROPERTY_X_IMG, + PROPERTY_X_TOOLTIP, + CSS_PROPERTY_LAST +} CssPropertyName; + +typedef union { + int intVal; + char *strVal; +} CssPropertyValue; + +typedef enum { + CSS_FONT_WEIGHT_LIGHTER = -1, + CSS_FONT_WEIGHT_BOLDER = -2, + CSS_FONT_WEIGHT_STEP = 300, + /* Some special font weights. */ + CSS_FONT_WEIGHT_LIGHT = 100, + CSS_FONT_WEIGHT_NORMAL = 400, + CSS_FONT_WEIGHT_BOLD = 700, + CSS_FONT_WEIGHT_MIN = 100, + CSS_FONT_WEIGHT_MAX = 900, +} CssFontWeightExtensions; + /** * \brief This class holds a CSS property and value pair. */ class CssProperty { public: - typedef union { - int intVal; - char *strVal; - } Value; - - typedef enum { - CSS_PROPERTY_BACKGROUND_ATTACHMENT, - CSS_PROPERTY_BACKGROUND_COLOR, - CSS_PROPERTY_BACKGROUND_IMAGE, - CSS_PROPERTY_BACKGROUND_POSITION, - CSS_PROPERTY_BACKGROUND_REPEAT, - CSS_PROPERTY_BORDER_BOTTOM_COLOR, - CSS_PROPERTY_BORDER_BOTTOM_STYLE, - CSS_PROPERTY_BORDER_BOTTOM_WIDTH, - CSS_PROPERTY_BORDER_COLLAPSE, - CSS_PROPERTY_BORDER_LEFT_COLOR, - CSS_PROPERTY_BORDER_LEFT_STYLE, - CSS_PROPERTY_BORDER_LEFT_WIDTH, - CSS_PROPERTY_BORDER_RIGHT_COLOR, - CSS_PROPERTY_BORDER_RIGHT_STYLE, - CSS_PROPERTY_BORDER_RIGHT_WIDTH, - CSS_PROPERTY_BORDER_SPACING, - CSS_PROPERTY_BORDER_TOP_COLOR, - CSS_PROPERTY_BORDER_TOP_STYLE, - CSS_PROPERTY_BORDER_TOP_WIDTH, - CSS_PROPERTY_BOTTOM, - CSS_PROPERTY_CAPTION_SIDE, - CSS_PROPERTY_CLEAR, - CSS_PROPERTY_CLIP, - CSS_PROPERTY_COLOR, - CSS_PROPERTY_CONTENT, - CSS_PROPERTY_COUNTER_INCREMENT, - CSS_PROPERTY_COUNTER_RESET, - CSS_PROPERTY_CURSOR, - CSS_PROPERTY_DIRECTION, - CSS_PROPERTY_DISPLAY, - CSS_PROPERTY_EMPTY_CELLS, - CSS_PROPERTY_FLOAT, - CSS_PROPERTY_FONT_FAMILY, - CSS_PROPERTY_FONT_SIZE, - CSS_PROPERTY_FONT_SIZE_ADJUST, - CSS_PROPERTY_FONT_STRETCH, - CSS_PROPERTY_FONT_STYLE, - CSS_PROPERTY_FONT_VARIANT, - CSS_PROPERTY_FONT_WEIGHT, - CSS_PROPERTY_HEIGHT, - CSS_PROPERTY_LEFT, - CSS_PROPERTY_LETTER_SPACING, - CSS_PROPERTY_LINE_HEIGHT, - CSS_PROPERTY_LIST_STYLE_IMAGE, - CSS_PROPERTY_LIST_STYLE_POSITION, - CSS_PROPERTY_LIST_STYLE_TYPE, - CSS_PROPERTY_MARGIN_BOTTOM, - CSS_PROPERTY_MARGIN_LEFT, - CSS_PROPERTY_MARGIN_RIGHT, - CSS_PROPERTY_MARGIN_TOP, - CSS_PROPERTY_MARKER_OFFSET, - CSS_PROPERTY_MARKS, - CSS_PROPERTY_MAX_HEIGHT, - CSS_PROPERTY_MAX_WIDTH, - CSS_PROPERTY_MIN_HEIGHT, - CSS_PROPERTY_MIN_WIDTH, - CSS_PROPERTY_OUTLINE_COLOR, - CSS_PROPERTY_OUTLINE_STYLE, - CSS_PROPERTY_OUTLINE_WIDTH, - CSS_PROPERTY_OVERFLOW, - CSS_PROPERTY_PADDING_BOTTOM, - CSS_PROPERTY_PADDING_LEFT, - CSS_PROPERTY_PADDING_RIGHT, - CSS_PROPERTY_PADDING_TOP, - CSS_PROPERTY_POSITION, - CSS_PROPERTY_QUOTES, - CSS_PROPERTY_RIGHT, - CSS_PROPERTY_TEXT_ALIGN, - CSS_PROPERTY_TEXT_DECORATION, - CSS_PROPERTY_TEXT_INDENT, - CSS_PROPERTY_TEXT_SHADOW, - CSS_PROPERTY_TEXT_TRANSFORM, - CSS_PROPERTY_TOP, - CSS_PROPERTY_UNICODE_BIDI, - CSS_PROPERTY_VERTICAL_ALIGN, - CSS_PROPERTY_VISIBILITY, - CSS_PROPERTY_WHITE_SPACE, - CSS_PROPERTY_WIDTH, - CSS_PROPERTY_WORD_SPACING, - CSS_PROPERTY_Z_INDEX, - CSS_PROPERTY_X_LINK, - CSS_PROPERTY_X_COLSPAN, - CSS_PROPERTY_X_ROWSPAN, - PROPERTY_X_LINK, - PROPERTY_X_IMG, - PROPERTY_X_TOOLTIP, - CSS_PROPERTY_LAST - } Name; - - typedef enum { - CSS_FONT_WEIGHT_LIGHTER = -1, - CSS_FONT_WEIGHT_BOLDER = -2, - CSS_FONT_WEIGHT_STEP = 300, - /* Some special font weights. */ - CSS_FONT_WEIGHT_LIGHT = 100, - CSS_FONT_WEIGHT_NORMAL = 400, - CSS_FONT_WEIGHT_BOLD = 700, - CSS_FONT_WEIGHT_MIN = 100, - CSS_FONT_WEIGHT_MAX = 900, - } FontWeightExtensions; short name; short type; - Value value; + CssPropertyValue value; inline void free () { switch (name) { - case CssProperty::CSS_PROPERTY_CONTENT: - case CssProperty::CSS_PROPERTY_FONT_FAMILY: + case CSS_PROPERTY_CONTENT: + case CSS_PROPERTY_FONT_FAMILY: dFree (value.strVal); break; default: @@ -194,14 +195,14 @@ class CssPropertyList : public lout::misc::SimpleVector <CssProperty> { }; ~CssPropertyList (); - void set (CssProperty::Name name, CssProperty::Value value); - inline void set (CssProperty::Name name, char *value) { - CssProperty::Value v; + void set (CssPropertyName name, CssPropertyValue value); + inline void set (CssPropertyName name, char *value) { + CssPropertyValue v; v.strVal = value; set (name, v); }; - inline void set (CssProperty::Name name, int value) { - CssProperty::Value v; + inline void set (CssPropertyName name, int value) { + CssPropertyValue v; v.intVal = value; set (name, v); }; diff --git a/src/cssparser.cc b/src/cssparser.cc index 09b0c530..25c14b7d 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -84,7 +84,7 @@ static const char *const Css_white_space_vals[] = { "normal", "pre", "nowrap", NULL }; -const CssPropertyInfo Css_property_info[CssProperty::CSS_PROPERTY_LAST] = { +const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = { {"background-attachment", CSS_TYPE_UNUSED, NULL}, {"background-color", CSS_TYPE_COLOR, NULL}, {"background-image", CSS_TYPE_UNUSED, NULL}, @@ -183,124 +183,124 @@ typedef struct { CSS_SHORTHAND_BORDER, /* special, used for 'border' */ CSS_SHORTHAND_FONT, /* special, used for 'font' */ } type; - const CssProperty::Name * properties;/* CSS_SHORTHAND_MULTIPLE: - * must be terminated by -1 - * CSS_SHORTHAND_DIRECTIONS: - * must have length 4 - * CSS_SHORTHAND_BORDERS: - * must have length 12 - * CSS_SHORTHAND_FONT: - * unused */ + const CssPropertyName * properties;/* CSS_SHORTHAND_MULTIPLE: + * must be terminated by -1 + * CSS_SHORTHAND_DIRECTIONS: + * must have length 4 + * CSS_SHORTHAND_BORDERS: + * must have length 12 + * CSS_SHORTHAND_FONT: + * unused */ } CssShorthandInfo; -const CssProperty::Name Css_background_properties[] = { - CssProperty::CSS_PROPERTY_BACKGROUND_COLOR, - CssProperty::CSS_PROPERTY_BACKGROUND_IMAGE, - CssProperty::CSS_PROPERTY_BACKGROUND_REPEAT, - CssProperty::CSS_PROPERTY_BACKGROUND_ATTACHMENT, - CssProperty::CSS_PROPERTY_BACKGROUND_POSITION, - (CssProperty::Name) - 1 +const CssPropertyName Css_background_properties[] = { + CSS_PROPERTY_BACKGROUND_COLOR, + CSS_PROPERTY_BACKGROUND_IMAGE, + CSS_PROPERTY_BACKGROUND_REPEAT, + CSS_PROPERTY_BACKGROUND_ATTACHMENT, + CSS_PROPERTY_BACKGROUND_POSITION, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_border_bottom_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_COLOR, - (CssProperty::Name) - 1 +const CssPropertyName Css_border_bottom_properties[] = { + CSS_PROPERTY_BORDER_BOTTOM_WIDTH, + CSS_PROPERTY_BORDER_BOTTOM_STYLE, + CSS_PROPERTY_BORDER_BOTTOM_COLOR, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_border_color_properties[4] = { - CssProperty::CSS_PROPERTY_BORDER_TOP_COLOR, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_COLOR, - CssProperty::CSS_PROPERTY_BORDER_LEFT_COLOR, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_COLOR +const CssPropertyName Css_border_color_properties[4] = { + CSS_PROPERTY_BORDER_TOP_COLOR, + CSS_PROPERTY_BORDER_BOTTOM_COLOR, + CSS_PROPERTY_BORDER_LEFT_COLOR, + CSS_PROPERTY_BORDER_RIGHT_COLOR }; -const CssProperty::Name Css_border_left_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_LEFT_STYLE, - CssProperty::CSS_PROPERTY_BORDER_LEFT_COLOR, - (CssProperty::Name) - 1 +const CssPropertyName Css_border_left_properties[] = { + CSS_PROPERTY_BORDER_LEFT_WIDTH, + CSS_PROPERTY_BORDER_LEFT_STYLE, + CSS_PROPERTY_BORDER_LEFT_COLOR, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_border_right_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_STYLE, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_COLOR, - (CssProperty::Name) - 1 +const CssPropertyName Css_border_right_properties[] = { + CSS_PROPERTY_BORDER_RIGHT_WIDTH, + CSS_PROPERTY_BORDER_RIGHT_STYLE, + CSS_PROPERTY_BORDER_RIGHT_COLOR, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_border_style_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_TOP_STYLE, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE, - CssProperty::CSS_PROPERTY_BORDER_LEFT_STYLE, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_STYLE +const CssPropertyName Css_border_style_properties[] = { + CSS_PROPERTY_BORDER_TOP_STYLE, + CSS_PROPERTY_BORDER_BOTTOM_STYLE, + CSS_PROPERTY_BORDER_LEFT_STYLE, + CSS_PROPERTY_BORDER_RIGHT_STYLE }; -const CssProperty::Name Css_border_top_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_TOP_STYLE, - CssProperty::CSS_PROPERTY_BORDER_TOP_COLOR, - (CssProperty::Name) - 1 +const CssPropertyName Css_border_top_properties[] = { + CSS_PROPERTY_BORDER_TOP_WIDTH, + CSS_PROPERTY_BORDER_TOP_STYLE, + CSS_PROPERTY_BORDER_TOP_COLOR, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_border_width_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH +const CssPropertyName Css_border_width_properties[] = { + CSS_PROPERTY_BORDER_TOP_WIDTH, + CSS_PROPERTY_BORDER_BOTTOM_WIDTH, + CSS_PROPERTY_BORDER_LEFT_WIDTH, + CSS_PROPERTY_BORDER_RIGHT_WIDTH }; -const CssProperty::Name Css_list_style_properties[] = { - CssProperty::CSS_PROPERTY_LIST_STYLE_TYPE, - CssProperty::CSS_PROPERTY_LIST_STYLE_POSITION, - CssProperty::CSS_PROPERTY_LIST_STYLE_IMAGE, - (CssProperty::Name) - 1 +const CssPropertyName Css_list_style_properties[] = { + CSS_PROPERTY_LIST_STYLE_TYPE, + CSS_PROPERTY_LIST_STYLE_POSITION, + CSS_PROPERTY_LIST_STYLE_IMAGE, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_margin_properties[] = { - CssProperty::CSS_PROPERTY_MARGIN_TOP, - CssProperty::CSS_PROPERTY_MARGIN_BOTTOM, - CssProperty::CSS_PROPERTY_MARGIN_LEFT, - CssProperty::CSS_PROPERTY_MARGIN_RIGHT +const CssPropertyName Css_margin_properties[] = { + CSS_PROPERTY_MARGIN_TOP, + CSS_PROPERTY_MARGIN_BOTTOM, + CSS_PROPERTY_MARGIN_LEFT, + CSS_PROPERTY_MARGIN_RIGHT }; -const CssProperty::Name Css_outline_properties[] = { - CssProperty::CSS_PROPERTY_OUTLINE_COLOR, - CssProperty::CSS_PROPERTY_OUTLINE_STYLE, - CssProperty::CSS_PROPERTY_OUTLINE_WIDTH, - (CssProperty::Name) - 1 +const CssPropertyName Css_outline_properties[] = { + CSS_PROPERTY_OUTLINE_COLOR, + CSS_PROPERTY_OUTLINE_STYLE, + CSS_PROPERTY_OUTLINE_WIDTH, + (CssPropertyName) - 1 }; -const CssProperty::Name Css_padding_properties[] = { - CssProperty::CSS_PROPERTY_PADDING_TOP, - CssProperty::CSS_PROPERTY_PADDING_BOTTOM, - CssProperty::CSS_PROPERTY_PADDING_LEFT, - CssProperty::CSS_PROPERTY_PADDING_RIGHT +const CssPropertyName Css_padding_properties[] = { + CSS_PROPERTY_PADDING_TOP, + CSS_PROPERTY_PADDING_BOTTOM, + CSS_PROPERTY_PADDING_LEFT, + CSS_PROPERTY_PADDING_RIGHT }; -const CssProperty::Name Css_border_properties[] = { - CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_TOP_STYLE, - CssProperty::CSS_PROPERTY_BORDER_TOP_COLOR, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE, - CssProperty::CSS_PROPERTY_BORDER_BOTTOM_COLOR, - CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_LEFT_STYLE, - CssProperty::CSS_PROPERTY_BORDER_LEFT_COLOR, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_STYLE, - CssProperty::CSS_PROPERTY_BORDER_RIGHT_COLOR +const CssPropertyName Css_border_properties[] = { + CSS_PROPERTY_BORDER_TOP_WIDTH, + CSS_PROPERTY_BORDER_TOP_STYLE, + CSS_PROPERTY_BORDER_TOP_COLOR, + CSS_PROPERTY_BORDER_BOTTOM_WIDTH, + CSS_PROPERTY_BORDER_BOTTOM_STYLE, + CSS_PROPERTY_BORDER_BOTTOM_COLOR, + CSS_PROPERTY_BORDER_LEFT_WIDTH, + CSS_PROPERTY_BORDER_LEFT_STYLE, + CSS_PROPERTY_BORDER_LEFT_COLOR, + CSS_PROPERTY_BORDER_RIGHT_WIDTH, + CSS_PROPERTY_BORDER_RIGHT_STYLE, + CSS_PROPERTY_BORDER_RIGHT_COLOR }; -const CssProperty::Name Css_font_properties[] = { - CssProperty::CSS_PROPERTY_FONT_SIZE, - CssProperty::CSS_PROPERTY_FONT_STYLE, - CssProperty::CSS_PROPERTY_FONT_VARIANT, - CssProperty::CSS_PROPERTY_FONT_WEIGHT, - CssProperty::CSS_PROPERTY_FONT_FAMILY, - (CssProperty::Name) - 1 +const CssPropertyName Css_font_properties[] = { + CSS_PROPERTY_FONT_SIZE, + CSS_PROPERTY_FONT_STYLE, + CSS_PROPERTY_FONT_VARIANT, + CSS_PROPERTY_FONT_WEIGHT, + CSS_PROPERTY_FONT_FAMILY, + (CssPropertyName) - 1 }; static const CssShorthandInfo Css_shorthand_info[] = { @@ -545,7 +545,7 @@ static void Css_next_token(CssParser * parser) static bool Css_token_matches_property(CssParser * parser, - CssProperty::Name prop) + CssPropertyName prop) { int i, err = 1; @@ -615,8 +615,8 @@ static bool Css_token_matches_property(CssParser * parser, } static bool Css_parse_value(CssParser * parser, - CssProperty::Name prop, - CssProperty::Value * val) + CssPropertyName prop, + CssPropertyValue * val) { int i, lentype; bool found, ret = false; @@ -755,13 +755,13 @@ static bool Css_parse_value(CssParser * parser, ival = 0; } else if (parser->ttype == CSS_TK_SYMBOL) { if (dStrcasecmp(parser->tval, "normal") == 0) - ival = CssProperty::CSS_FONT_WEIGHT_NORMAL; + ival = CSS_FONT_WEIGHT_NORMAL; if (dStrcasecmp(parser->tval, "bold") == 0) - ival = CssProperty::CSS_FONT_WEIGHT_BOLD; + ival = CSS_FONT_WEIGHT_BOLD; if (dStrcasecmp(parser->tval, "bolder") == 0) - ival = CssProperty::CSS_FONT_WEIGHT_BOLDER; + ival = CSS_FONT_WEIGHT_BOLDER; if (dStrcasecmp(parser->tval, "lighter") == 0) - ival = CssProperty::CSS_FONT_WEIGHT_LIGHTER; + ival = CSS_FONT_WEIGHT_LIGHTER; } if (ival != 0) { @@ -824,8 +824,8 @@ static void Css_parse_declaration(CssParser * parser, CssPropertyInfo pi, *pip; CssShorthandInfo si, *sip; - CssProperty::Name prop; - CssProperty::Value val, dir_vals[4]; + CssPropertyName prop; + CssPropertyValue val, dir_vals[4]; bool found, weight; int sh_index, i, j, n; int dir_set[4][4] = { @@ -843,7 +843,7 @@ static void Css_parse_declaration(CssParser * parser, sizeof(CssPropertyInfo), Css_property_info_cmp); if (pip) { - prop = (CssProperty::Name) (pip - Css_property_info); + prop = (CssPropertyName) (pip - Css_property_info); Css_next_token(parser); if (parser->ttype == CSS_TK_CHAR && parser->tval[0] == ':') { Css_next_token(parser); diff --git a/src/cssparser.hh b/src/cssparser.hh index f88a780e..b10595fb 100644 --- a/src/cssparser.hh +++ b/src/cssparser.hh @@ -6,7 +6,7 @@ /* The last three ones are never parsed. */ #define CSS_NUM_INTERNAL_PROPERTIES 3 #define CSS_NUM_PARSED_PROPERTIES \ - (CssProperty::CSS_PROPERTY_LAST - CSS_NUM_INTERNAL_PROPERTIES) + (CSS_PROPERTY_LAST - CSS_NUM_INTERNAL_PROPERTIES) typedef enum { @@ -55,6 +55,6 @@ void a_Css_parse (CssContext *context, CssPropertyList *a_Css_parse_declaration(const char *buf, int buflen); -extern const CssPropertyInfo Css_property_info[CssProperty::CSS_PROPERTY_LAST]; +extern const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST]; #endif // __CSS_H__ diff --git a/src/html.cc b/src/html.cc index dc9fc617..6542f5bc 100644 --- a/src/html.cc +++ b/src/html.cc @@ -340,7 +340,7 @@ void a_Html_tag_set_align_attr(DilloHtml *html, style_attrs.textAlignChar = '.'; } #endif - props->set (CssProperty::CSS_PROPERTY_TEXT_ALIGN, textAlignType); + props->set (CSS_PROPERTY_TEXT_ALIGN, textAlignType); } } @@ -364,7 +364,7 @@ bool a_Html_tag_set_valign_attr(DilloHtml *html, const char *tag, else valign = VALIGN_MIDDLE; - props->set (CssProperty::CSS_PROPERTY_VERTICAL_ALIGN, valign); + props->set (CSS_PROPERTY_VERTICAL_ALIGN, valign); return true; } else return false; @@ -1700,12 +1700,12 @@ static void Html_tag_open_body(DilloHtml *html, const char *tag, int tagsize) if (color == 0xffffff && !prefs.allow_white_bg) color = prefs.bg_color; S_TOP(html)->current_bg_color = color; - props.set (CssProperty::CSS_PROPERTY_BACKGROUND_COLOR, color); + props.set (CSS_PROPERTY_BACKGROUND_COLOR, color); } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "text"))) { color = a_Html_color_parse(html, attrbuf, prefs.text_color); - props.set (CssProperty::CSS_PROPERTY_COLOR, color); + props.set (CSS_PROPERTY_COLOR, color); } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "link"))) @@ -1790,7 +1790,7 @@ static void Html_tag_open_frame (DilloHtml *html, const char *tag, int tagsize) html->styleEngine->setPseudoLink (); } - props.set (CssProperty::PROPERTY_X_LINK, Html_set_new_link(html, &url)); + props.set (PROPERTY_X_LINK, Html_set_new_link(html, &url)); html->styleEngine->setNonCssHints (&props); textblock->addParbreak (5, html->styleEngine->wordStyle ()); @@ -1888,12 +1888,12 @@ static void Html_tag_open_font(DilloHtml *html, const char *tag, int tagsize) color = a_Html_color_parse(html, attrbuf, -1); } if (color != -1) - props.set (CssProperty::CSS_PROPERTY_COLOR, color); + props.set (CSS_PROPERTY_COLOR, color); } // \todo reenable font face handling when font selection is implemented // if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "face"))) -// props.set (CssProperty::CSS_PROPERTY_FONT_FAMILY, attrbuf); +// props.set (CSS_PROPERTY_FONT_FAMILY, attrbuf); html->styleEngine->setNonCssHints (&props); } @@ -1978,9 +1978,9 @@ DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag, 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 (CssProperty::CSS_PROPERTY_WIDTH, l_w); + props.set (CSS_PROPERTY_WIDTH, l_w); if (CSS_LENGTH_TYPE(l_h) != CSS_LENGTH_TYPE_AUTO) - props.set (CssProperty::CSS_PROPERTY_HEIGHT, l_h); + props.set (CSS_PROPERTY_HEIGHT, l_h); } /* TODO: we should scale the image respecting its ratio. @@ -1995,8 +1995,8 @@ DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag, space = strtol(attrbuf, NULL, 10); if (space > 0) { space = CSS_CREATE_LENGTH(space, CSS_LENGTH_TYPE_PX); - props.set (CssProperty::CSS_PROPERTY_MARGIN_LEFT, space); - props.set (CssProperty::CSS_PROPERTY_MARGIN_RIGHT, space); + props.set (CSS_PROPERTY_MARGIN_LEFT, space); + props.set (CSS_PROPERTY_MARGIN_RIGHT, space); } } @@ -2005,8 +2005,8 @@ DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag, space = strtol(attrbuf, NULL, 10); if (space > 0) { space = CSS_CREATE_LENGTH(space, CSS_LENGTH_TYPE_PX); - props.set (CssProperty::CSS_PROPERTY_MARGIN_TOP, space); - props.set (CssProperty::CSS_PROPERTY_MARGIN_BOTTOM, space); + props.set (CSS_PROPERTY_MARGIN_TOP, space); + props.set (CSS_PROPERTY_MARGIN_BOTTOM, space); } } @@ -2015,22 +2015,22 @@ DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag, border = strtol(attrbuf, NULL, 10); if (border >= 0) { border = CSS_CREATE_LENGTH(border, CSS_LENGTH_TYPE_PX); - props.set (CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, border); - props.set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, border); - props.set (CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, border); - props.set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, border); + 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 (CssProperty::CSS_PROPERTY_BORDER_TOP_STYLE, BORDER_SOLID); - props.set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE, + props.set (CSS_PROPERTY_BORDER_TOP_STYLE, BORDER_SOLID); + props.set (CSS_PROPERTY_BORDER_BOTTOM_STYLE, BORDER_SOLID); - props.set (CssProperty::CSS_PROPERTY_BORDER_LEFT_STYLE, BORDER_SOLID); - props.set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_STYLE,BORDER_SOLID); + props.set (CSS_PROPERTY_BORDER_LEFT_STYLE, BORDER_SOLID); + props.set (CSS_PROPERTY_BORDER_RIGHT_STYLE,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 (CssProperty::PROPERTY_X_IMG, html->images->size()); + props.set (PROPERTY_X_IMG, html->images->size()); html->styleEngine->setNonCssHints(&props); @@ -2294,7 +2294,7 @@ static void Html_tag_open_object(DilloHtml *html, const char *tag, int tagsize) html->styleEngine->setPseudoLink (); } - props.set(CssProperty::PROPERTY_X_LINK, Html_set_new_link(html, &url)); + props.set(PROPERTY_X_LINK, Html_set_new_link(html, &url)); html->styleEngine->setNonCssHints (&props); DW2TB(html->dw)->addText("[OBJECT]", html->styleEngine->wordStyle ()); @@ -2368,14 +2368,14 @@ static void Html_tag_open_a(DilloHtml *html, const char *tag, int tagsize) html->InVisitedLink = true; html->styleEngine->setPseudoVisited (); if (html->visited_color != -1) - props.set (CssProperty::CSS_PROPERTY_COLOR, html->visited_color); + props.set (CSS_PROPERTY_COLOR, html->visited_color); } else { html->styleEngine->setPseudoLink (); if (html->link_color != -1) - props.set (CssProperty::CSS_PROPERTY_COLOR, html->link_color); + props.set (CSS_PROPERTY_COLOR, html->link_color); } - props.set (CssProperty::PROPERTY_X_LINK, Html_set_new_link(html, &url)); + props.set (PROPERTY_X_LINK, Html_set_new_link(html, &url)); html->styleEngine->setNonCssHints (&props); } @@ -2456,7 +2456,7 @@ static void Html_tag_open_ul(DilloHtml *html, const char *tag, int tagsize) /* invalid value */ list_style_type = LIST_STYLE_TYPE_DISC; - props.set(CssProperty::CSS_PROPERTY_LIST_STYLE_TYPE, list_style_type); + props.set(CSS_PROPERTY_LIST_STYLE_TYPE, list_style_type); html->styleEngine->setNonCssHints (&props); } @@ -2515,7 +2515,7 @@ static void Html_tag_open_ol(DilloHtml *html, const char *tag, int tagsize) else if (*attrbuf == 'I') listStyleType = LIST_STYLE_TYPE_UPPER_ROMAN; - props.set (CssProperty::CSS_PROPERTY_LIST_STYLE_TYPE, listStyleType); + props.set (CSS_PROPERTY_LIST_STYLE_TYPE, listStyleType); html->styleEngine->setNonCssHints (&props); } @@ -2609,7 +2609,7 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) width_ptr = a_Html_get_attr_wdef(html, tag, tagsize, "width", NULL); if (width_ptr) { - props.set (CssProperty::CSS_PROPERTY_WIDTH, + props.set (CSS_PROPERTY_WIDTH, a_Html_parse_length (html, width_ptr)); dFree(width_ptr); } @@ -2621,10 +2621,10 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) /* TODO: evaluate attribute */ if (a_Html_get_attr(html, tag, tagsize, "noshade")) { - props.set (CssProperty::CSS_PROPERTY_BORDER_TOP_STYLE, BORDER_SOLID); - props.set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE, BORDER_SOLID); - props.set (CssProperty::CSS_PROPERTY_BORDER_LEFT_STYLE, BORDER_SOLID); - props.set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_STYLE, BORDER_SOLID); + 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); if (size <= 0) size = 1; @@ -2633,10 +2633,10 @@ static void Html_tag_open_hr(DilloHtml *html, const char *tag, int tagsize) 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 (CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, size_top); - props.set (CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, size_top); - props.set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, size_bottom); - props.set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, size_bottom); + 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); } DW2TB(html->dw)->addParbreak (5, html->styleEngine->wordStyle ()); diff --git a/src/styleengine.cc b/src/styleengine.cc index b48b6e2e..264406bb 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -32,7 +32,7 @@ StyleEngine::StyleEngine (dw::core::Layout *layout) { /* Create a dummy font, attribute, and tag for the bottom of the stack. */ font_attrs.name = prefs.font_sans_serif; font_attrs.size = (int) (14 * prefs.font_factor + 0.5); - font_attrs.weight = CssProperty::CSS_FONT_WEIGHT_NORMAL; + font_attrs.weight = CSS_FONT_WEIGHT_NORMAL; font_attrs.style = FONT_STYLE_NORMAL; style_attrs.initValues (); @@ -169,7 +169,7 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { CssProperty *p = props->getRef (i); switch (p->name) { - case CssProperty::CSS_PROPERTY_FONT_FAMILY: + case CSS_PROPERTY_FONT_FAMILY: // \todo handle comma separated lists of font names if (strcmp (p->value.strVal, "serif") == 0) fontAttrs.name = prefs.font_serif; @@ -184,30 +184,30 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { else fontAttrs.name = p->value.strVal; break; - case CssProperty::CSS_PROPERTY_FONT_SIZE: + case CSS_PROPERTY_FONT_SIZE: parentFont = stack->get (stack->size () - 2).style->font; computeValue (&fontAttrs.size, p->value.intVal, parentFont, parentFont->size); break; - case CssProperty::CSS_PROPERTY_FONT_STYLE: + case CSS_PROPERTY_FONT_STYLE: fontAttrs.style = (FontStyle) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_FONT_WEIGHT: + case CSS_PROPERTY_FONT_WEIGHT: switch (p->value.intVal) { - case CssProperty::CSS_FONT_WEIGHT_LIGHTER: - fontAttrs.weight -= CssProperty::CSS_FONT_WEIGHT_STEP; + case CSS_FONT_WEIGHT_LIGHTER: + fontAttrs.weight -= CSS_FONT_WEIGHT_STEP; break; - case CssProperty::CSS_FONT_WEIGHT_BOLDER: - fontAttrs.weight += CssProperty::CSS_FONT_WEIGHT_STEP; + case CSS_FONT_WEIGHT_BOLDER: + fontAttrs.weight += CSS_FONT_WEIGHT_STEP; break; default: fontAttrs.weight = p->value.intVal; break; } - if (fontAttrs.weight < CssProperty::CSS_FONT_WEIGHT_MIN) - fontAttrs.weight = CssProperty::CSS_FONT_WEIGHT_MIN; - if (fontAttrs.weight > CssProperty::CSS_FONT_WEIGHT_MAX) - fontAttrs.weight = CssProperty::CSS_FONT_WEIGHT_MAX; + if (fontAttrs.weight < CSS_FONT_WEIGHT_MIN) + fontAttrs.weight = CSS_FONT_WEIGHT_MIN; + if (fontAttrs.weight > CSS_FONT_WEIGHT_MAX) + fontAttrs.weight = CSS_FONT_WEIGHT_MAX; break; default: break; @@ -221,109 +221,109 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) { switch (p->name) { /* \todo missing cases */ - case CssProperty::CSS_PROPERTY_BACKGROUND_COLOR: + case CSS_PROPERTY_BACKGROUND_COLOR: attrs->backgroundColor = Color::create (layout, p->value.intVal); break; - case CssProperty::CSS_PROPERTY_BORDER_TOP_COLOR: + case CSS_PROPERTY_BORDER_TOP_COLOR: attrs->borderColor.top = Color::create (layout, p->value.intVal); break; - case CssProperty::CSS_PROPERTY_BORDER_BOTTOM_COLOR: + case CSS_PROPERTY_BORDER_BOTTOM_COLOR: attrs->borderColor.bottom = Color::create (layout, p->value.intVal); break; - case CssProperty::CSS_PROPERTY_BORDER_LEFT_COLOR: + case CSS_PROPERTY_BORDER_LEFT_COLOR: attrs->borderColor.left = Color::create (layout, p->value.intVal); break; - case CssProperty::CSS_PROPERTY_BORDER_RIGHT_COLOR: + case CSS_PROPERTY_BORDER_RIGHT_COLOR: attrs->borderColor.right = Color::create (layout, p->value.intVal); break; - case CssProperty::CSS_PROPERTY_BORDER_BOTTOM_STYLE: + case CSS_PROPERTY_BORDER_BOTTOM_STYLE: attrs->borderStyle.bottom = (BorderStyle) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_BORDER_LEFT_STYLE: + case CSS_PROPERTY_BORDER_LEFT_STYLE: attrs->borderStyle.left = (BorderStyle) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_BORDER_RIGHT_STYLE: + case CSS_PROPERTY_BORDER_RIGHT_STYLE: attrs->borderStyle.right = (BorderStyle) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_BORDER_TOP_STYLE: + case CSS_PROPERTY_BORDER_TOP_STYLE: attrs->borderStyle.top = (BorderStyle) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH: + case CSS_PROPERTY_BORDER_BOTTOM_WIDTH: computeValue (&attrs->borderWidth.bottom, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH: + case CSS_PROPERTY_BORDER_LEFT_WIDTH: computeValue (&attrs->borderWidth.left, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH: + case CSS_PROPERTY_BORDER_RIGHT_WIDTH: computeValue (&attrs->borderWidth.right, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH: + case CSS_PROPERTY_BORDER_TOP_WIDTH: computeValue (&attrs->borderWidth.top, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_BORDER_SPACING: + case CSS_PROPERTY_BORDER_SPACING: computeValue (&attrs->hBorderSpacing, p->value.intVal, attrs->font); computeValue (&attrs->vBorderSpacing, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_COLOR: + case CSS_PROPERTY_COLOR: attrs->color = Color::create (layout, p->value.intVal); break; - case CssProperty::CSS_PROPERTY_CURSOR: + case CSS_PROPERTY_CURSOR: attrs->cursor = (Cursor) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_LIST_STYLE_TYPE: + case CSS_PROPERTY_LIST_STYLE_TYPE: attrs->listStyleType = (ListStyleType) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_MARGIN_BOTTOM: + case CSS_PROPERTY_MARGIN_BOTTOM: computeValue (&attrs->margin.bottom, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_MARGIN_LEFT: + case CSS_PROPERTY_MARGIN_LEFT: computeValue (&attrs->margin.left, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_MARGIN_RIGHT: + case CSS_PROPERTY_MARGIN_RIGHT: computeValue (&attrs->margin.right, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_MARGIN_TOP: + case CSS_PROPERTY_MARGIN_TOP: computeValue (&attrs->margin.top, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_PADDING_TOP: + case CSS_PROPERTY_PADDING_TOP: computeValue (&attrs->padding.top, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_PADDING_BOTTOM: + case CSS_PROPERTY_PADDING_BOTTOM: computeValue (&attrs->padding.bottom, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_PADDING_LEFT: + case CSS_PROPERTY_PADDING_LEFT: computeValue (&attrs->padding.left, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_PADDING_RIGHT: + case CSS_PROPERTY_PADDING_RIGHT: computeValue (&attrs->padding.right, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_TEXT_ALIGN: + case CSS_PROPERTY_TEXT_ALIGN: attrs->textAlign = (TextAlignType) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_TEXT_DECORATION: + case CSS_PROPERTY_TEXT_DECORATION: attrs->textDecoration |= p->value.intVal; break; - case CssProperty::CSS_PROPERTY_VERTICAL_ALIGN: + case CSS_PROPERTY_VERTICAL_ALIGN: attrs->valign = (VAlignType) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_WHITE_SPACE: + case CSS_PROPERTY_WHITE_SPACE: attrs->whiteSpace = (WhiteSpace) p->value.intVal; break; - case CssProperty::CSS_PROPERTY_WIDTH: + case CSS_PROPERTY_WIDTH: computeLength (&attrs->width, p->value.intVal, attrs->font); break; - case CssProperty::CSS_PROPERTY_HEIGHT: + case CSS_PROPERTY_HEIGHT: computeLength (&attrs->height, p->value.intVal, attrs->font); break; - case CssProperty::PROPERTY_X_LINK: + case PROPERTY_X_LINK: attrs->x_link = p->value.intVal; break; - case CssProperty::PROPERTY_X_IMG: + case PROPERTY_X_IMG: attrs->x_img = p->value.intVal; break; diff --git a/src/table.cc b/src/table.cc index 1bae2a4b..63387778 100644 --- a/src/table.cc +++ b/src/table.cc @@ -60,28 +60,28 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) if (border != -1) { cssLength = CSS_CREATE_LENGTH (border, CSS_LENGTH_TYPE_PX); - props.set (CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, cssLength); - props.set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, cssLength); - props.set (CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, cssLength); - props.set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, cssLength); + 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); } if (cellspacing != -1) { cssLength = CSS_CREATE_LENGTH (cellspacing, CSS_LENGTH_TYPE_PX); - props.set (CssProperty::CSS_PROPERTY_BORDER_SPACING, cssLength); + props.set (CSS_PROPERTY_BORDER_SPACING, cssLength); } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "width"))) - props.set (CssProperty::CSS_PROPERTY_WIDTH, + props.set (CSS_PROPERTY_WIDTH, a_Html_parse_length (html, attrbuf)); if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "align"))) { if (dStrcasecmp (attrbuf, "left") == 0) - props.set (CssProperty::CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_LEFT); + props.set (CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_LEFT); else if (dStrcasecmp (attrbuf, "right") == 0) - props.set (CssProperty::CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_RIGHT); + props.set (CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_RIGHT); else if (dStrcasecmp (attrbuf, "center") == 0) - props.set (CssProperty::CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_CENTER); + props.set (CSS_PROPERTY_TEXT_ALIGN, TEXT_ALIGN_CENTER); } if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) { @@ -90,7 +90,7 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) if (bgcolor == 0xffffff && !prefs.allow_white_bg) bgcolor = prefs.bg_color; S_TOP(html)->current_bg_color = bgcolor; - props.set (CssProperty::CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); + props.set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); } } @@ -100,18 +100,18 @@ void Html_tag_open_table(DilloHtml *html, const char *tag, int tagsize) table_cell_props = new CssPropertyList (); if (border > 0) { cssLength = CSS_CREATE_LENGTH (1, CSS_LENGTH_TYPE_PX); - table_cell_props->set (CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, cssLength); - table_cell_props->set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, cssLength); - table_cell_props->set (CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, cssLength); - table_cell_props->set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, cssLength); + 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); } if (cellpadding != -1) { cssLength = CSS_CREATE_LENGTH (cellpadding, CSS_LENGTH_TYPE_PX); - table_cell_props->set (CssProperty::CSS_PROPERTY_PADDING_TOP, cssLength); - table_cell_props->set (CssProperty::CSS_PROPERTY_PADDING_BOTTOM, cssLength); - table_cell_props->set (CssProperty::CSS_PROPERTY_PADDING_LEFT, cssLength); - table_cell_props->set (CssProperty::CSS_PROPERTY_PADDING_RIGHT, cssLength); + 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); } if (S_TOP(html)->table_cell_props) @@ -154,7 +154,7 @@ void Html_tag_open_tr(DilloHtml *html, const char *tag, int tagsize) if (bgcolor != -1) { if (bgcolor == 0xffffff && !prefs.allow_white_bg) bgcolor = prefs.bg_color; - props.set (CssProperty::CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); + props.set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); S_TOP(html)->current_bg_color = bgcolor; } } @@ -172,7 +172,7 @@ void Html_tag_open_tr(DilloHtml *html, const char *tag, int tagsize) table_cell_props = new CssPropertyList (*S_TOP(html)->table_cell_props); if (bgcolor != -1) { - table_cell_props->set (CssProperty::CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); + table_cell_props->set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); new_style = true; } if (a_Html_tag_set_valign_attr (html, tag, tagsize, table_cell_props)) @@ -261,17 +261,17 @@ static void Html_tag_open_table_cell(DilloHtml *html, /* text style */ if (!S_TOP(html)->cell_text_align_set) { - props->set (CssProperty::CSS_PROPERTY_TEXT_ALIGN, text_align); + props->set (CSS_PROPERTY_TEXT_ALIGN, text_align); } if (a_Html_get_attr(html, tag, tagsize, "nowrap")) - props->set (CssProperty::CSS_PROPERTY_WHITE_SPACE, WHITE_SPACE_NOWRAP); + props->set (CSS_PROPERTY_WHITE_SPACE, WHITE_SPACE_NOWRAP); else - props->set (CssProperty::CSS_PROPERTY_WHITE_SPACE, WHITE_SPACE_NORMAL); + props->set (CSS_PROPERTY_WHITE_SPACE, 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 (CssProperty::CSS_PROPERTY_WIDTH, + props->set (CSS_PROPERTY_WIDTH, a_Html_parse_length (html, attrbuf)); } @@ -284,7 +284,7 @@ static void Html_tag_open_table_cell(DilloHtml *html, if (bgcolor == 0xffffff && !prefs.allow_white_bg) bgcolor = prefs.bg_color; - props->set (CssProperty::CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); + props->set (CSS_PROPERTY_BACKGROUND_COLOR, bgcolor); S_TOP(html)->current_bg_color = bgcolor; } } |