aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-12-14 21:58:05 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2008-12-14 21:58:05 +0100
commitbdd5c393602dd2f49fb71e33f5e643175a000727 (patch)
tree3aba48c63c685b969e454cbe947f82bbc5adef6e
parentc320585dddc168f79fe502dfa504fcec188b2329 (diff)
convert Html_tag_open_img()
-rw-r--r--src/css.cc2
-rw-r--r--src/form.cc3
-rw-r--r--src/html.cc40
-rw-r--r--src/html_common.hh1
4 files changed, 17 insertions, 29 deletions
diff --git a/src/css.cc b/src/css.cc
index 1da6e5a8..9bee25a4 100644
--- a/src/css.cc
+++ b/src/css.cc
@@ -267,6 +267,8 @@ void CssContext::buildUserAgentStyle () {
":visited {color: green; text-decoration: underline; cursor: pointer; } "
"h1, h2, h3, h4, h5, h6, b, strong {font-weight: bolder; } "
"i, em, cite, address {font-style: italic; } "
+ "img {border-style: solid } "
+ "img:link, img:visited {border-width: 1px } "
"frameset, ul, ol, dir {margin-left: 40px} "
"h1 {font-size: 2em; margin-top: .67em; margin-bottom: 0em;} "
"h2 {font-size: 1.5em; margin-top: .75em; margin-bottom: 0em;} "
diff --git a/src/form.cc b/src/form.cc
index b1f54c02..c222566e 100644
--- a/src/form.cc
+++ b/src/form.cc
@@ -1914,8 +1914,7 @@ static Embed *Html_input_image(DilloHtml *html, const char *tag, int tagsize)
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, &style_attrs,
- false))) {
+ if ((Image = a_Html_add_new_image(html, tag, tagsize, url, false))) {
Style *style = Style::create (HT2LT(html), &style_attrs);
IM2DW(Image)->setStyle (style);
ResourceFactory *factory = HT2LT(html)->getResourceFactory();
diff --git a/src/html.cc b/src/html.cc
index 4cb05756..a9c5a324 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -1979,7 +1979,6 @@ static void Html_tag_open_tt(DilloHtml *html, const char *tag, int tagsize)
*/
DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag,
int tagsize, DilloUrl *url,
- dw::core::style::StyleAttrs *style_attrs,
bool add)
{
const int MAX_W = 6000, MAX_H = 6000;
@@ -1988,7 +1987,7 @@ DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag,
char *width_ptr, *height_ptr, *alt_ptr;
const char *attrbuf;
Length l_w, l_h;
- int space, w = 0, h = 0;
+ int space, border, w = 0, h = 0;
bool load_now;
CssPropertyList props;
@@ -2052,6 +2051,18 @@ DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag,
}
}
+ /* Border */
+ if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "border"))) {
+ border = strtol(attrbuf, NULL, 10);
+ if (border >= 0) {
+ border = CSS_CREATE_LENGTH(border, CSS_LENGTH_TYPE_PX);
+ props.set (CssProperty::CSS_PROPERTY_BORDER_TOP_WIDTH, border);
+ props.set (CssProperty::CSS_PROPERTY_BORDER_BOTTOM_WIDTH, border);
+ props.set (CssProperty::CSS_PROPERTY_BORDER_LEFT_WIDTH, border);
+ props.set (CssProperty::CSS_PROPERTY_BORDER_RIGHT_WIDTH, border);
+ }
+ }
+
/* x_img is an index to a list of {url,image} pairs.
* We know Html_add_new_linkimage() will use size() as its next index */
props.set (CssProperty::PROPERTY_X_IMG, html->images->size());
@@ -2105,9 +2116,7 @@ static void Html_tag_open_img(DilloHtml *html, const char *tag, int tagsize)
DilloImage *Image;
DilloUrl *url, *usemap_url;
Textblock *textblock;
- StyleAttrs style_attrs;
const char *attrbuf;
- int border;
/* This avoids loading images. Useful for viewing suspicious HTML email. */
if (URL_FLAGS(html->base_url) & URL_SpamSafe)
@@ -2124,28 +2133,7 @@ static void Html_tag_open_img(DilloHtml *html, const char *tag, int tagsize)
/* TODO: usemap URLs outside of the document are not used. */
usemap_url = a_Html_url_new(html, attrbuf, NULL, 0);
- /* Set the style attributes for this image */
- style_attrs = *html->styleEngine->style ();
- if (html->styleEngine->style ()->x_link != -1 ||
- usemap_url != NULL) {
- /* Images within links */
- border = 1;
- if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "border")))
- border = strtol (attrbuf, NULL, 10);
-
- if (html->styleEngine->style ()->x_link != -1) {
- /* In this case we can use the text color */
- style_attrs.setBorderColor (
- Color::create (HT2LT(html), style_attrs.color->getColor()));
- } else {
- style_attrs.setBorderColor (
- Color::create (HT2LT(html), html->link_color));
- }
- style_attrs.setBorderStyle (BORDER_SOLID);
- style_attrs.borderWidth.setVal (border);
- }
-
- Image = a_Html_add_new_image(html, tag, tagsize, url, &style_attrs, true);
+ Image = a_Html_add_new_image(html, tag, tagsize, url, true);
/* Image maps */
if (a_Html_get_attr(html, tag, tagsize, "ismap")) {
diff --git a/src/html_common.hh b/src/html_common.hh
index 3468ba89..7f6bddb4 100644
--- a/src/html_common.hh
+++ b/src/html_common.hh
@@ -258,7 +258,6 @@ DilloUrl *a_Html_url_new(DilloHtml *html,
DilloImage *a_Html_add_new_image(DilloHtml *html, const char *tag,
int tagsize, DilloUrl *url,
- dw::core::style::StyleAttrs *style_attrs,
bool add);
char *a_Html_parse_entities(DilloHtml *html, const char *token, int toksize);