aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cssparser.cc3
-rw-r--r--src/styleengine.cc26
2 files changed, 28 insertions, 1 deletions
diff --git a/src/cssparser.cc b/src/cssparser.cc
index eda45472..b60f49d1 100644
--- a/src/cssparser.cc
+++ b/src/cssparser.cc
@@ -141,7 +141,8 @@ static const char *const Css_word_spacing_enum_vals[] = {
const CssPropertyInfo Css_property_info[CSS_PROPERTY_LAST] = {
{"background-attachment", {CSS_TYPE_UNUSED}, NULL},
{"background-color", {CSS_TYPE_COLOR, CSS_TYPE_UNUSED}, NULL},
- {"background-image", {CSS_TYPE_UNUSED}, NULL},
+ /** todo 'background-image' os of type <uri>, which is not yet defined. */
+ {"background-image", {CSS_TYPE_STRING, CSS_TYPE_UNUSED}, NULL},
{"background-position", {CSS_TYPE_UNUSED}, NULL},
{"background-repeat", {CSS_TYPE_UNUSED}, NULL},
{"border-bottom-color", {CSS_TYPE_ENUM, CSS_TYPE_COLOR, CSS_TYPE_UNUSED},
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;