Re: background images and display:none
Johannes Hofmann <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Apr 04, 2014 at 05:37:52PM +0000, eocene wrote: > > I was checking what was causing the "IO_write, closing with pending data > not sent" messages with background images, and at least in the case that > I just dug into, it was due to display:none. Is this considered > expected behaviour, or a bug, or...? The simple case can be prevented with something like in attached patch. But even with this patch I see quite some of the messages you mention. So there must be something else going on too. Cheers, Johannes _______________________________________________ Dillo-dev mailing list [email protected] http://lists.dillo.org/cgi-bin/mailman/listinfo/dillo-dev
dillo_css_bg_display_none.diff
(text/x-diff, 3 KB)
diff -r 7c42f4a89168 src/styleengine.cc
--- a/src/styleengine.cc Fri Apr 04 07:39:15 2014 +0200
+++ b/src/styleengine.cc Fri Apr 04 20:23:42 2014 +0200
@@ -361,6 +361,7 @@
Font *parentFont = stack->get (i - 1).style->font;
char *c, *fontName;
int lineHeight;
+ DilloUrl *imgUrl = NULL;
/* Determine font first so it can be used to resolve relative lengths. */
for (int i = 0; i < props->size (); i++) {
@@ -528,35 +529,8 @@
Color::create(layout, prefs.white_bg_replacement);
break;
case CSS_PROPERTY_BACKGROUND_IMAGE:
- if (prefs.load_background_images)
- {
- // p->value.strVal should be absolute, so baseUrl is not needed
- DilloUrl *imgUrl = a_Url_new (p->value.strVal, NULL);
-
- attrs->backgroundImage = StyleImage::create();
- DilloImage *image =
- a_Image_new(layout,
- (void*)attrs->backgroundImage
- ->getMainImgRenderer(),
- 0xffffff);
-
- // we use the pageUrl as requester to prevent cross
- // domain requests as specified in domainrc
- DilloWeb *web = a_Web_new(bw, imgUrl, pageUrl);
- web->Image = image;
- a_Image_ref(image);
- web->flags |= WEB_Image;
-
- int clientKey;
- if ((clientKey = a_Capi_open_url(web, NULL, NULL)) != 0) {
- a_Bw_add_client(bw, clientKey, 0);
- a_Bw_add_url(bw, imgUrl);
- attrs->backgroundImage->connectDeletion
- (new StyleImageDeletionReceiver (clientKey));
- }
-
- a_Url_free (imgUrl);
- }
+ // p->value.strVal should be absolute, so baseUrl is not needed
+ imgUrl = a_Url_new (p->value.strVal, NULL);
break;
case CSS_PROPERTY_BACKGROUND_POSITION:
computeLength (&attrs->backgroundPositionX, p->value.posVal->posX,
@@ -734,6 +708,31 @@
}
}
+ if (imgUrl && prefs.load_background_images && attrs->display != DISPLAY_NONE)
+ {
+ attrs->backgroundImage = StyleImage::create();
+ DilloImage *image =
+ a_Image_new(layout,
+ (void*)attrs->backgroundImage
+ ->getMainImgRenderer(),
+ 0xffffff);
+
+ // we use the pageUrl as requester to prevent cross
+ // domain requests as specified in domainrc
+ DilloWeb *web = a_Web_new(bw, imgUrl, pageUrl);
+ web->Image = image;
+ a_Image_ref(image);
+ web->flags |= WEB_Image;
+
+ int clientKey;
+ if ((clientKey = a_Capi_open_url(web, NULL, NULL)) != 0) {
+ a_Bw_add_client(bw, clientKey, 0);
+ a_Bw_add_url(bw, imgUrl);
+ attrs->backgroundImage->connectDeletion
+ (new StyleImageDeletionReceiver (clientKey));
+ }
+ }
+ a_Url_free (imgUrl);
}
/**