aboutsummaryrefslogtreecommitdiff
path: root/src/styleengine.cc
diff options
context:
space:
mode:
authorSebastian Geerken <devnull@localhost>2013-09-20 09:41:44 +0200
committerSebastian Geerken <devnull@localhost>2013-09-20 09:41:44 +0200
commitc2eb8db9a1a7f98d228dc4402f234525621b4e8e (patch)
tree0c8fe553f0ef95ffd887add47d34ce8420b74184 /src/styleengine.cc
parentf815ca9e7f27a8fc4a8230413ecac8ad2b2e0621 (diff)
First attempt to integrate 'background-image'.
Diffstat (limited to 'src/styleengine.cc')
-rw-r--r--src/styleengine.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/styleengine.cc b/src/styleengine.cc
index af5623c2..363e9b02 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -15,6 +15,8 @@
#include "misc.h"
#include "html_common.hh"
#include "styleengine.hh"
+#include "web.hh"
+#include "capi.h"
using namespace lout::misc;
using namespace dw::core::style;
@@ -450,6 +452,30 @@ void StyleEngine::apply (int i, StyleAttrs *attrs, CssPropertyList *props,
attrs->backgroundColor =
Color::create(layout, prefs.white_bg_replacement);
break;
+ case CSS_PROPERTY_BACKGROUND_IMAGE:
+ {
+ DilloUrl *imgUrl =
+ a_Url_new (p->value.strVal, a_Url_str (url));
+
+ attrs->backgroundImage = StyleImage::create();
+ DilloImage *image =
+ a_Image_new(layout,
+ (void*)attrs->backgroundImage
+ ->getMainImgRenderer(),
+ 0xffffff);
+
+ DilloWeb *web = a_Web_new(bw, imgUrl, url);
+ 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, url);
+ }
+ }
+ break;
case CSS_PROPERTY_BORDER_COLLAPSE:
attrs->borderCollapse = (BorderCollapse) p->value.intVal;
break;