changeset 769:eb3a3a0a6c24

Fix: inherit bgcolor from parent widget (images). Also cleanups.
author Jorge Arellano Cid <jcid@dillo.org>
date Wed, 14 Jan 2009 18:49:19 -0300
parents eeb44d8bf3a0
children e62191e6da9a
files src/form.cc src/html.cc src/image.cc src/image.hh
diffstat 4 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/form.cc	Wed Jan 14 18:49:04 2009 -0300
+++ b/src/form.cc	Wed Jan 14 18:49:19 2009 -0300
@@ -1947,8 +1947,6 @@
        (url = a_Html_url_new(html, attrbuf, NULL, 0))) {
       style_attrs = *html->styleEngine->style ();
       style_attrs.cursor = CURSOR_POINTER;
-      style_attrs.backgroundColor =
-        style::Color::create (HT2LT(html), S_TOP(html)->current_bg_color);
 
       /* create new image and add it to the button */
       if ((Image = a_Html_add_new_image(html, tag, tagsize, url, false))) {
--- a/src/html.cc	Wed Jan 14 18:49:04 2009 -0300
+++ b/src/html.cc	Wed Jan 14 18:49:19 2009 -0300
@@ -2034,10 +2034,13 @@
    html->styleEngine->setNonCssHints(&props);
 
    /* Add a new image widget to this page */
-   Image = a_Image_new(0, 0, alt_ptr, S_TOP(html)->current_bg_color);
-   if (add)
+   Image = a_Image_new(0, 0, alt_ptr, 0);
+   if (add) {
       DW2TB(html->dw)->addWidget((Widget*)Image->dw,
                                  html->styleEngine->style());
+   }
+   if (DW2TB(html->dw)->getBgColor())
+      Image->bg_color = DW2TB(html->dw)->getBgColor()->getColor();
 
    load_now = a_UIcmd_get_images_enabled(html->bw) ||
               (a_Capi_get_flags(url) & CAPI_IsCached);
--- a/src/image.cc	Wed Jan 14 18:49:04 2009 -0300
+++ b/src/image.cc	Wed Jan 14 18:49:19 2009 -0300
@@ -27,7 +27,7 @@
 using namespace dw::core;
 
 // Image to Object-Image macro
-#define OI(Image)  ((dw::Image*)(Image->dw))
+#define I2DW(Image)  ((dw::Image*)(Image->dw))
 
 
 /*
@@ -44,8 +44,6 @@
    Image->dw = (void*) new dw::Image(alt_text);
    Image->width = 0;
    Image->height = 0;
-   Image->cmap = NULL;
-   Image->in_type = DILLO_IMG_TYPE_NOTSET;
    Image->bg_color = bg_color;
    Image->ScanNumber = 0;
    Image->BitVec = NULL;
@@ -94,11 +92,10 @@
    _MSG("a_Image_set_parms: width=%d height=%d\n", width, height);
 
    bool resize = (Image->width != width || Image->height != height);
-   OI(Image)->setBuffer((Imgbuf*)v_imgbuf, resize);
+   I2DW(Image)->setBuffer((Imgbuf*)v_imgbuf, resize);
 
    if (!Image->BitVec)
       Image->BitVec = a_Bitvec_new(height);
-   Image->in_type = type;
    Image->width = width;
    Image->height = height;
    Image->State = IMG_SetParms;
@@ -110,7 +107,6 @@
 void a_Image_set_cmap(DilloImage *Image, const uchar_t *cmap)
 {
    _MSG("a_Image_set_cmap\n");
-   Image->cmap = cmap;
    Image->State = IMG_SetCmap;
 }
 
@@ -134,7 +130,7 @@
    dReturn_if_fail ( y < Image->height );
 
    /* Update the row in DwImage */
-   OI(Image)->drawRow(y);
+   I2DW(Image)->drawRow(y);
    a_Bitvec_set_bit(Image->BitVec, y);
    Image->State = IMG_Write;
 }
--- a/src/image.hh	Wed Jan 14 18:49:04 2009 -0300
+++ b/src/image.hh	Wed Jan 14 18:49:19 2009 -0300
@@ -38,10 +38,7 @@
    uint_t width;
    uint_t height;
 
-   const uchar_t *cmap;     /* Color map (only for indexed) */
-   DilloImgType in_type;    /* Image Type */
    int32_t bg_color;        /* Background color */
-
    bitvec_t *BitVec;        /* Bit vector for decoded rows */
    uint_t ScanNumber;       /* Current decoding scan */
    ImageState State;        /* Processing status */