aboutsummaryrefslogtreecommitdiff
path: root/src/form.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2012-01-30 22:21:42 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2012-01-30 22:21:42 +0100
commit356f0d5a01f1ad7162152866a249d0891c51d647 (patch)
treef7480f07a93e1c74d408f67200cd39ce8dc23c50 /src/form.cc
parent67a65b186409fe9e30d10403a00db9b0fa1e9388 (diff)
rework image handling code
Properly separate common image handling functions in CSS relevant attribute parsing (a_Html_image_attrs) and image creation (a_Html_image_new()). This should also bring the code back a bit to what we had before 8214199c2703.
Diffstat (limited to 'src/form.cc')
-rw-r--r--src/form.cc33
1 files changed, 12 insertions, 21 deletions
diff --git a/src/form.cc b/src/form.cc
index 2e1bde7d..8275c12b 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -1908,30 +1908,21 @@ DilloHtmlOption::~DilloHtmlOption ()
*/
static Embed *Html_input_image(DilloHtml *html, const char *tag, int tagsize)
{
- const char *attrbuf;
DilloImage *Image;
Embed *button = NULL;
- DilloUrl *url = NULL;
-
- if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "src")) &&
- (url = a_Html_url_new(html, attrbuf, NULL, 0))) {
-
- html->styleEngine->setPseudoLink ();
-
- /* create new image and add it to the button */
- a_Html_image_new(html, tag, tagsize);
- if ((Image = a_Html_image_add(html, url))) {
- IM2DW(Image)->setStyle (html->styleEngine->backgroundStyle ());
- ResourceFactory *factory = HT2LT(html)->getResourceFactory();
- ComplexButtonResource *complex_b_r =
- factory->createComplexButtonResource(IM2DW(Image), false);
- button = new Embed(complex_b_r);
- HT2TB(html)->addWidget (button, html->styleEngine->style ());
-// gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
- } else {
- a_Url_free(url);
- }
+ html->styleEngine->setPseudoLink ();
+
+ /* create new image and add it to the button */
+ a_Html_image_attrs(html, tag, tagsize);
+ if ((Image = a_Html_image_new(html, tag, tagsize))) {
+ IM2DW(Image)->setStyle (html->styleEngine->backgroundStyle ());
+ ResourceFactory *factory = HT2LT(html)->getResourceFactory();
+ ComplexButtonResource *complex_b_r =
+ factory->createComplexButtonResource(IM2DW(Image), false);
+ button = new Embed(complex_b_r);
+ HT2TB(html)->addWidget (button, html->styleEngine->style ());
+// gtk_widget_set_sensitive(widget, FALSE); /* Until end of FORM! */
}
if (!button)
MSG("Html_input_image: unable to create image submit.\n");