diff options
author | Sebastian Geerken <devnull@localhost> | 2013-09-20 09:41:44 +0200 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2013-09-20 09:41:44 +0200 |
commit | c2eb8db9a1a7f98d228dc4402f234525621b4e8e (patch) | |
tree | 0c8fe553f0ef95ffd887add47d34ce8420b74184 /src | |
parent | f815ca9e7f27a8fc4a8230413ecac8ad2b2e0621 (diff) |
First attempt to integrate 'background-image'.
Diffstat (limited to 'src')
-rw-r--r-- | src/cssparser.cc | 3 | ||||
-rw-r--r-- | src/styleengine.cc | 26 |
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; |