diff src/gtkimhtml.c @ 10457:0c020a10d5da

[gaim-migrate @ 11725] Richard Laager writes: This patch fixes a bug with the CSS handling in gtkimhtml involving whitespace handling. Basically, it would accept things like: "color: #FFFFFF" but not "color:#FFFFFF" or "color: #FFFFFF" (more than one space). Really only the case without spaces is of concern to me. However, I followed the coding techniques of the rest of that section of code so it will end up accepting multiple spaces as beneficial side effect. When questioned as to why he needed this, he responded: I wrote a plug-in to parse XML message histories from the official MSN client. The styles saved in that file had no whitespace. Initially I wrote a workaround in the plug-in, but I wanted to fix the problem at the source. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 30 Dec 2004 19:50:49 +0000
parents 2e01c503aa4f
children 748aa3c6de36
line wrap: on
line diff
--- a/src/gtkimhtml.c	Thu Dec 30 19:32:08 2004 +0000
+++ b/src/gtkimhtml.c	Thu Dec 30 19:50:49 2004 +0000
@@ -1851,6 +1851,9 @@
 
 	if (!g_ascii_strncasecmp (t, opt, strlen (opt))) {
 		t += strlen (opt);
+		while (*t && (*t == ' ')) t++;
+		if (!*t)
+			return NULL;
 	} else {
 		return NULL;
 	}
@@ -2383,12 +2386,12 @@
 
 						if (!style) break;
 
-						color = gtk_imhtml_get_css_opt (style, "color: ");
-						background = gtk_imhtml_get_css_opt (style, "background: ");
+						color = gtk_imhtml_get_css_opt (style, "color:");
+						background = gtk_imhtml_get_css_opt (style, "background:");
 						family = gtk_imhtml_get_css_opt (style,
-							"font-family: ");
-						size = gtk_imhtml_get_css_opt (style, "font-size: ");
-						textdec = gtk_imhtml_get_css_opt (style, "text-decoration: ");
+							"font-family:");
+						size = gtk_imhtml_get_css_opt (style, "font-size:");
+						textdec = gtk_imhtml_get_css_opt (style, "text-decoration:");
 
 						if (!(color || family || size || background || textdec)) {
 							g_free(style);