[bug]: <pre> element respects color but not background-color
<html> <head> <style type="text/css"> pre { background-color:#222; color:#fff; } </style> </head> <body> <pre>Blah, blah, blah</pre> </body> </html> Dillo renders the above as white text on the default background, which is almost illegible. Firefox renders it white on black, as intended. If you apply the style to the body element instead of the pre element then Dillo renders it correctly. The pre element respects the color style parameter but not the background-color. This bug is visible at http://jeffkreeftmeijer.com/2010/the-mighty-reflog-and-the-amazing-bisect/ Regards, Jeremy Henty
The problem is that Html_tag_open_pre() does not call html->styleEngine->inheritBackgroundColor() before calling HT2TB(html)->addParbreak(). But several other Html_tag_open_*() functions have the same problem, eg. Html_tag_open_{dt,dl}(). Should we fix them one by one or is there a better way? Also, I wonder if more of the Html_tag_open_*() functions should call html->styleEngine->setNonCssHints(), but I don't understand the CSS engine well enough to be sure. Regards, Jeremy Henty
Hi Jeremy, On Sun, Sep 05, 2010 at 12:52:02PM +0100, Jeremy Henty wrote:
The problem is that Html_tag_open_pre() does not call html->styleEngine->inheritBackgroundColor() before calling HT2TB(html)->addParbreak(). But several other Html_tag_open_*() functions have the same problem, eg. Html_tag_open_{dt,dl}(). Should we fix them one by one or is there a better way?
Correct. All Html_tag_open_*() functions that don't add a widget (e.g. a textblock or an image) must call html->styleEngine->inheritBackgroundColor() to make background-color work. Unfortunately this is just a hack that doesn't solve all problems. E.g. <pre style="border: 1px solid black">foo</pre> will still not work. For now, I would just add inheritBackgroundColor() where necessary.
Also, I wonder if more of the Html_tag_open_*() functions should call html->styleEngine->setNonCssHints(), but I don't understand the CSS engine well enough to be sure.
setNonCssHints() in contrast is not a hack :-) It is used to pass style information from (deprecated) non-CSS HTML attributes like bgColor, align and so on to StyleEngine. This style information from HTML attributes has to be handled specially as described in http://www.w3.org/TR/CSS2/cascade.html#preshint So for all HTML-attributes that we want to support and that change the style there should be a corresponding setNonCssHints() call. Regards, Johannes
Johannes Hofmann wrote:
Correct. All Html_tag_open_*() functions that don't add a widget (e.g. a textblock or an image) must call html->styleEngine->inheritBackgroundColor() to make background-color work. Unfortunately this is just a hack that doesn't solve all problems. E.g. <pre style="border: 1px solid black">foo</pre> will still not work. For now, I would just add inheritBackgroundColor() where necessary.
OK, patch attached. Please review carefully - I am not familiar with the Dillo CSS implementation so this is really a request for comments. (Although it does fix the page that first highlighted the problem.) And thanks for the explanation of the CSS workings! Regards, Jeremy Henty
On Mon, Sep 06, 2010 at 07:18:52AM +0100, Jeremy Henty wrote:
Johannes Hofmann wrote:
Correct. All Html_tag_open_*() functions that don't add a widget (e.g. a textblock or an image) must call html->styleEngine->inheritBackgroundColor() to make background-color work. Unfortunately this is just a hack that doesn't solve all problems. E.g. <pre style="border: 1px solid black">foo</pre> will still not work. For now, I would just add inheritBackgroundColor() where necessary.
OK, patch attached. Please review carefully - I am not familiar with the Dillo CSS implementation so this is really a request for comments. (Although it does fix the page that first highlighted the problem.)
Thanks! I commited a slightly modified version. Cheers, Johannes
participants (2)
-
Johannes.Hofmann@gmx.de
-
onepoint@starurchin.org