summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-04-19 10:25:22 +0200
committercorvid <corvid@lavabit.com>2009-04-19 10:25:22 +0200
commit8ab9de15c7e52f8ab201412649f946b1922b1944 (patch)
treee068a7748c272e3493af5f19f7f38fc5b751e66c /src
parentb358beb5b91f6ef1bf067a2c3f0268f8b44af368 (diff)
wrap long lines in src/ css code
Diffstat (limited to 'src')
-rw-r--r--src/css.cc10
-rw-r--r--src/cssparser.cc32
-rw-r--r--src/cssparser.hh11
-rw-r--r--src/styleengine.cc7
-rw-r--r--src/styleengine.hh12
-rw-r--r--src/table.cc6
-rw-r--r--src/web.cc2
7 files changed, 48 insertions, 32 deletions
diff --git a/src/css.cc b/src/css.cc
index 048d67b6..781d5573 100644
--- a/src/css.cc
+++ b/src/css.cc
@@ -21,7 +21,7 @@ using namespace dw::core::style;
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 @@ void CssStyleSheet::apply (CssPropertyList *props,
}
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 @@ void CssContext::buildUserAgentStyle () {
"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 @@ void CssContext::buildUserStyle () {
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);
diff --git a/src/cssparser.cc b/src/cssparser.cc
index 4c361f03..fd6dea86 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -66,7 +66,8 @@ static const char *const Css_display_enum_vals[DISPLAY_LAST + 1] = {
};
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 @@ const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = {
{"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 @@ const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = {
{"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 @@ const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = {
{"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 @@ void CssParser::parseImport(DilloHtml *html, DilloUrl *baseUrl) {
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);
diff --git a/src/cssparser.hh b/src/cssparser.hh
index 8011a342..36d80834 100644
--- a/src/cssparser.hh
+++ b/src/cssparser.hh
@@ -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 @@ class CssParser {
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);
};
diff --git a/src/styleengine.cc b/src/styleengine.cc
index 63dac1ec..a7593c18 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -357,7 +357,7 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) {
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 @@ Style * StyleEngine::wordStyle0 (CssPropertyList *nonCssProperties) {
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;
}
diff --git a/src/styleengine.hh b/src/styleengine.hh
index 24ac1d56..f340e058 100644
--- a/src/styleengine.hh
+++ b/src/styleengine.hh
@@ -27,9 +27,10 @@ class StyleEngine : public Doctree {
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 @@ class StyleEngine : public Doctree {
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 @@ class StyleEngine : public Doctree {
};
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
diff --git a/src/table.cc b/src/table.cc
index 5964d88e..e026fa57 100644
--- a/src/table.cc
+++ b/src/table.cc
@@ -270,9 +270,9 @@ static void Html_tag_open_table_cell(DilloHtml *html,
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 @@ static void Html_tag_open_table_cell(DilloHtml *html,
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);
diff --git a/src/web.cc b/src/web.cc
index 39988991..d40a61ea 100644
--- a/src/web.cc
+++ b/src/web.cc
@@ -68,7 +68,7 @@ int a_Web_dispatch_by_type (const char *Type, DilloWeb *Web,
/* 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)