changeset 1039:4ed33b76809c

wrap long lines in src/ css code
author corvid <corvid@lavabit.com>
date Sun, 19 Apr 2009 10:25:22 +0200
parents 4d38b02bc704
children 52e3049ba0fc 6d6bfabeb1b4
files src/css.cc src/cssparser.cc src/cssparser.hh src/styleengine.cc src/styleengine.hh src/table.cc src/web.cc
diffstat 7 files changed, 48 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.cc	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/css.cc	Sun Apr 19 10:25:22 2009 +0200
@@ -21,7 +21,7 @@
 
 void CssProperty::print () {
    fprintf (stderr, "%s - %d\n",
-            CssParser::propertyNameString((CssPropertyName) name), value.intVal);
+            CssParser::propertyNameString((CssPropertyName)name),value.intVal);
 }
 
 CssPropertyList::~CssPropertyList () {
@@ -363,7 +363,8 @@
       }
 
       if (minSpecIndex >= 0) {
-         ruleList[minSpecIndex]->get (index[minSpecIndex])->apply (props, docTree, node);
+         ruleList[minSpecIndex]->get (index[minSpecIndex])->apply
+                                                        (props, docTree, node);
          index[minSpecIndex]++;
       } else {
          break;
@@ -482,7 +483,8 @@
      "th {font-weight: bolder; text-align: center}"
      "code, tt, pre, samp, kbd {font-family: monospace}";
 
-   CssParser::parse (NULL, NULL, this, cssBuf, strlen (cssBuf), CSS_ORIGIN_USER_AGENT);
+   CssParser::parse (NULL, NULL, this, cssBuf, strlen (cssBuf),
+                     CSS_ORIGIN_USER_AGENT);
 }
 
 void CssContext::buildUserStyle () {
@@ -490,7 +492,7 @@
    char *filename = dStrconcat(dGethomedir(), "/.dillo/style.css", NULL);
 
    if ((style = a_Misc_file2dstr(filename))) {
-      CssParser::parse (NULL, NULL, this, style->str, style->len, CSS_ORIGIN_USER);
+      CssParser::parse (NULL,NULL,this,style->str, style->len,CSS_ORIGIN_USER);
       dStr_free (style, 1);
    }
    dFree (filename);
--- a/src/cssparser.cc	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/cssparser.cc	Sun Apr 19 10:25:22 2009 +0200
@@ -66,7 +66,8 @@
 };
 
 static const char *const Css_font_size_enum_vals[] = {
-   "large", "larger", "medium", "small", "smaller", "xx-large", "xx-small", "x-large", "x-small", NULL
+   "large", "larger", "medium", "small", "smaller", "xx-large", "xx-small",
+   "x-large", "x-small", NULL
 };
 
 static const char *const Css_font_style_enum_vals[] = {
@@ -108,18 +109,22 @@
    {"background-position", {CSS_TYPE_UNUSED}, NULL},
    {"background-repeat", {CSS_TYPE_UNUSED}, NULL},
    {"border-bottom-color", {CSS_TYPE_COLOR, CSS_TYPE_UNUSED}, NULL},
-   {"border-bottom-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_border_style_enum_vals},
+   {"border-bottom-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_border_style_enum_vals},
    {"border-bottom-width", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"border-collapse", {CSS_TYPE_UNUSED}, NULL},
    {"border-left-color", {CSS_TYPE_COLOR, CSS_TYPE_UNUSED}, NULL},
-   {"border-left-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_border_style_enum_vals},
+   {"border-left-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_border_style_enum_vals},
    {"border-left-width", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"border-right-color", {CSS_TYPE_COLOR, CSS_TYPE_UNUSED}, NULL},
-   {"border-right-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_border_style_enum_vals},
+   {"border-right-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_border_style_enum_vals},
    {"border-right-width", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"border-spacing", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"border-top-color", {CSS_TYPE_COLOR, CSS_TYPE_UNUSED}, NULL},
-   {"border-top-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_border_style_enum_vals},
+   {"border-top-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_border_style_enum_vals},
    {"border-top-width", {CSS_TYPE_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"bottom", {CSS_TYPE_UNUSED}, NULL},
    {"caption-side", {CSS_TYPE_UNUSED}, NULL},
@@ -135,19 +140,22 @@
    {"empty-cells", {CSS_TYPE_UNUSED}, NULL},
    {"float", {CSS_TYPE_UNUSED}, NULL},
    {"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},
+   {"font-size", {CSS_TYPE_ENUM, CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_UNUSED},
+    Css_font_size_enum_vals},
    {"font-size-adjust", {CSS_TYPE_UNUSED}, NULL},
    {"font-stretch", {CSS_TYPE_UNUSED}, NULL},
    {"font-style", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_font_style_enum_vals},
    {"font-variant", {CSS_TYPE_UNUSED}, NULL},
-   {"font-weight", {CSS_TYPE_ENUM, CSS_TYPE_FONT_WEIGHT, CSS_TYPE_UNUSED}, Css_font_weight_enum_vals},
+   {"font-weight", {CSS_TYPE_ENUM, CSS_TYPE_FONT_WEIGHT, CSS_TYPE_UNUSED},
+    Css_font_weight_enum_vals},
    {"height", {CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_UNUSED}, NULL},
    {"left", {CSS_TYPE_UNUSED}, NULL},
    {"letter-spacing", {CSS_TYPE_UNUSED}, NULL},
    {"line-height", {CSS_TYPE_UNUSED}, NULL},
    {"list-style-image", {CSS_TYPE_UNUSED}, NULL},
    {"list-style-position", {CSS_TYPE_UNUSED}, NULL},
-   {"list-style-type", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_list_style_type_enum_vals},
+   {"list-style-type", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED},
+    Css_list_style_type_enum_vals},
    {"margin-bottom", {CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"margin-left", {CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_UNUSED}, NULL},
    {"margin-right", {CSS_TYPE_SIGNED_LENGTH, CSS_TYPE_UNUSED}, NULL},
@@ -170,13 +178,14 @@
    {"quotes", {CSS_TYPE_UNUSED}, NULL},
    {"right", {CSS_TYPE_UNUSED}, NULL},
    {"text-align", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_text_align_enum_vals},
-   {"text-decoration", {CSS_TYPE_MULTI_ENUM, CSS_TYPE_UNUSED}, Css_text_decoration_enum_vals},
+   {"text-decoration", {CSS_TYPE_MULTI_ENUM, CSS_TYPE_UNUSED},
+    Css_text_decoration_enum_vals},
    {"text-indent", {CSS_TYPE_UNUSED}, NULL},
    {"text-shadow", {CSS_TYPE_UNUSED}, NULL},
    {"text-transform", {CSS_TYPE_UNUSED}, NULL},
    {"top", {CSS_TYPE_UNUSED}, NULL},
    {"unicode-bidi", {CSS_TYPE_UNUSED}, NULL},
-   {"vertical-align", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_vertical_align_vals},
+   {"vertical-align",{CSS_TYPE_ENUM, CSS_TYPE_UNUSED},Css_vertical_align_vals},
    {"visibility", {CSS_TYPE_UNUSED}, NULL},
    {"white-space", {CSS_TYPE_ENUM, CSS_TYPE_UNUSED}, Css_white_space_vals},
    {"width", {CSS_TYPE_LENGTH_PERCENTAGE, CSS_TYPE_UNUSED}, NULL},
@@ -1261,7 +1270,8 @@
 
       if (urlStr) {
          MSG("CssParser::parseImport(): @import %s\n", urlStr);
-         DilloUrl *url = a_Html_url_new (html, urlStr, a_Url_str(baseUrl), baseUrl ? 1 : 0);
+         DilloUrl *url = a_Html_url_new (html, urlStr, a_Url_str(baseUrl),
+                                         baseUrl ? 1 : 0);
          a_Html_load_stylesheet(html, url);
          a_Url_free(url);
          dFree (urlStr);
--- a/src/cssparser.hh	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/cssparser.hh	Sun Apr 19 10:25:22 2009 +0200
@@ -7,8 +7,8 @@
 class CssParser {
    private:
       typedef enum {
-         CSS_TK_DECINT, CSS_TK_FLOAT, CSS_TK_COLOR, CSS_TK_SYMBOL, CSS_TK_STRING,
-         CSS_TK_CHAR, CSS_TK_END
+         CSS_TK_DECINT, CSS_TK_FLOAT, CSS_TK_COLOR, CSS_TK_SYMBOL,
+         CSS_TK_STRING, CSS_TK_CHAR, CSS_TK_END
       } CssTokenType;
 
       static const int maxStrLen = 256;
@@ -41,9 +41,10 @@
       void parseRuleset();
 
    public:
-      static CssPropertyList *parseDeclarationBlock(const char *buf, int buflen);
-      static void parse(DilloHtml *html, DilloUrl *url, CssContext *context, const char *buf, int buflen,
-                        CssOrigin origin);
+      static CssPropertyList *parseDeclarationBlock(const char *buf,
+                                                    int buflen);
+      static void parse(DilloHtml *html, DilloUrl *url, CssContext *context,
+                        const char *buf, int buflen, CssOrigin origin);
       static const char *propertyNameString(CssPropertyName name);
 };
 
--- a/src/styleengine.cc	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/styleengine.cc	Sun Apr 19 10:25:22 2009 +0200
@@ -357,7 +357,7 @@
             break;
          case CSS_PROPERTY_MARGIN_BOTTOM:
             computeValue (&attrs->margin.bottom, p->value.intVal, attrs->font);
-            if (attrs->margin.bottom < 0) // \todo fix negative margins in dw/* 
+            if (attrs->margin.bottom < 0) // \todo fix negative margins in dw/*
                attrs->margin.bottom = 0;
             break;
          case CSS_PROPERTY_MARGIN_LEFT:
@@ -563,9 +563,10 @@
    return stack->getRef (stack->size () - 1)->wordStyle;
 }
 
-void StyleEngine::parse (DilloHtml *html, DilloUrl *url, const char *buf, int buflen, CssOrigin origin) {
+void StyleEngine::parse (DilloHtml *html, DilloUrl *url, const char *buf,
+                         int buflen, CssOrigin origin) {
    if (importDepth > 10) { // avoid looping with recursive @import directives
-      MSG_WARN("Maximum depth of CSS @import reached - ignoring stylesheet.\n");
+      MSG_WARN("Maximum depth of CSS @import reached--ignoring stylesheet.\n");
       return;
    }
 
--- a/src/styleengine.hh	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/styleengine.hh	Sun Apr 19 10:25:22 2009 +0200
@@ -27,9 +27,10 @@
       dw::core::style::Style *style0 (CssPropertyList *nonCssHints = NULL);
       dw::core::style::Style *wordStyle0 (CssPropertyList *nonCssHints = NULL);
       void apply (dw::core::style::StyleAttrs *attrs, CssPropertyList *props);
-      bool computeValue (int *dest, CssLength value, dw::core::style::Font *font);
-      bool computeValue (int *dest, CssLength value, dw::core::style::Font *font,
-                         int percentageBase);
+      bool computeValue (int *dest, CssLength value,
+                         dw::core::style::Font *font);
+      bool computeValue (int *dest, CssLength value,
+                         dw::core::style::Font *font, int percentageBase);
       bool computeLength (dw::core::style::Length *dest, CssLength value,
                           dw::core::style::Font *font);
 
@@ -49,7 +50,8 @@
             return NULL;
       };
 
-      void parse (DilloHtml *html, DilloUrl *url, const char *buf, int buflen, CssOrigin origin);
+      void parse (DilloHtml *html, DilloUrl *url, const char *buf, int buflen,
+                  CssOrigin origin);
       void startElement (int tag);
       void startElement (const char *tagname);
       void setId (const char *id);
@@ -72,7 +74,7 @@
       };
 
       inline dw::core::style::Style *wordStyle () {
-         dw::core::style::Style *s = stack->getRef (stack->size () - 1)->wordStyle;
+         dw::core::style::Style *s = stack->getRef(stack->size()-1)->wordStyle;
          if (s)
             return s;
          else
--- a/src/table.cc	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/table.cc	Sun Apr 19 10:25:22 2009 +0200
@@ -270,9 +270,9 @@
          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, CSS_TYPE_ENUM, WHITE_SPACE_NOWRAP);
+         props->set(CSS_PROPERTY_WHITE_SPACE,CSS_TYPE_ENUM,WHITE_SPACE_NOWRAP);
       else
-         props->set (CSS_PROPERTY_WHITE_SPACE, CSS_TYPE_ENUM, 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);
 
@@ -287,7 +287,7 @@
       if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "bgcolor"))) {
          bgcolor = a_Html_color_parse(html, attrbuf, -1);
          if (bgcolor != -1)
-            props->set (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR, bgcolor);
+            props->set (CSS_PROPERTY_BACKGROUND_COLOR, CSS_TYPE_COLOR,bgcolor);
       }
 
       html->styleEngine->setNonCssHints (props);
--- a/src/web.cc	Sat Apr 18 21:17:10 2009 -0400
+++ b/src/web.cc	Sun Apr 19 10:25:22 2009 +0200
@@ -68,7 +68,7 @@
       /* Set a style for the widget */
       StyleEngine styleEngine (layout);
       styleEngine.startElement ("body");
-      Web->bgColor = styleEngine.backgroundStyle ()->backgroundColor->getColor ();
+      Web->bgColor= styleEngine.backgroundStyle()->backgroundColor->getColor();
 
       dw = (Widget*) a_Mime_set_viewer(Type, Web, Call, Data);
       if (dw == NULL)