[Dillo-dev] CSS parser bug

2 views
Skip to first unread message

Sebastian Geerken

unread,
Jul 4, 2016, 2:23:44 PM7/4/16
to dill...@dillo.org
Hi!

The CSS parser seems to have a bug handling shorthand properties. This
example works well, both properties are handled correctly:

<body style="background: url(http://www.gnu.org/graphics/heckert_gnu.small.png) repeat-y">

Adding "transparent" (for "background-color"), however, causes the
other parts not to be parsed:

<body style="background: transparent url(http://www.gnu.org/graphics/heckert_gnu.small.png) repeat-y">

Not a regression, dillo 3.0.5 shows the same behaviour.

Sebastian

signature.asc

Johannes Hofmann

unread,
Jul 5, 2016, 4:55:54 PM7/5/16
to dill...@dillo.org
transparent seems to be the problem.

<body style="background: red url(http://www.gnu.org/graphics/heckert_gnu.small.png) repeat-y">

works here. Not sure yet what it would take to support transparent properly.

Cheers,
Johannes

_______________________________________________
Dillo-dev mailing list
Dill...@dillo.org
http://lists.dillo.org/cgi-bin/mailman/listinfo/dillo-dev

Sebastian Geerken

unread,
Jul 5, 2016, 5:11:27 PM7/5/16
to dill...@dillo.org
On Di, Jul 05, 2016, Johannes Hofmann wrote:
> On Mon, Jul 04, 2016 at 08:21:56PM +0200, Sebastian Geerken wrote:
> > The CSS parser seems to have a bug handling shorthand properties. This
> > example works well, both properties are handled correctly:
> >
> > <body style="background: url(http://www.gnu.org/graphics/heckert_gnu.small.png) repeat-y">
> >
> > Adding "transparent" (for "background-color"), however, causes the
> > other parts not to be parsed:
> >
> > <body style="background: transparent url(http://www.gnu.org/graphics/heckert_gnu.small.png) repeat-y">
> >
> > Not a regression, dillo 3.0.5 shows the same behaviour.
>
> transparent seems to be the problem.
>
> <body style="background: red url(http://www.gnu.org/graphics/heckert_gnu.small.png) repeat-y">
>
> works here. Not sure yet what it would take to support transparent properly.

Suggested by your hint, I successfully tried this hack of
CssParser::tokenMatchesProperty:

diff -r c449be1f747f src/cssparser.cc
--- a/src/cssparser.cc Mon Jul 04 14:04:49 2016 +0000
+++ b/src/cssparser.cc Tue Jul 05 23:06:31 2016 +0200
@@ -762,6 +762,7 @@
if ((ttype == CSS_TK_COLOR ||
ttype == CSS_TK_SYMBOL) &&
(dStrAsciiCasecmp(tval, "rgb") == 0 ||
+ dStrAsciiCasecmp(tval, "transparent") == 0 ||
a_Color_parse(tval, -1, &err) != -1))
return true;
break;

Of course, I get a warning "color is not in "#RRGGBB" format", but at
least "transparent" is /recognized/ as color at this point.

Sebastian

signature.asc
Reply all
Reply to author
Forward
0 new messages