aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-10-03 02:22:31 +0000
committercorvid <corvid@lavabit.com>2009-10-03 02:22:31 +0000
commit74c690bc83186311a0567b5d35edd30961104ed4 (patch)
tree237cccf6a1b46b8499bb085bd92619e967f1749a /src
parent21979bd9dc1bc58ee8537d92d172ba4b23745a46 (diff)
some tooltips
Diffstat (limited to 'src')
-rw-r--r--src/html.cc29
-rw-r--r--src/styleengine.cc4
2 files changed, 21 insertions, 12 deletions
diff --git a/src/html.cc b/src/html.cc
index b2a3c543..6450caa3 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -1944,13 +1944,17 @@ static void Html_tag_open_font(DilloHtml *html, const char *tag, int tagsize)
*/
static void Html_tag_open_abbr(DilloHtml *html, const char *tag, int tagsize)
{
-// DwTooltip *tooltip;
-// const char *attrbuf;
-//
-// if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) {
-// tooltip = a_Dw_tooltip_new_no_ref(attrbuf);
-// HTML_SET_TOP_ATTR(html, x_tooltip, tooltip);
-// }
+ const char *attrbuf;
+
+ if (prefs.show_tooltip &&
+ (attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) {
+ CssPropertyList props;
+ char *tooltip_str = dStrdup(attrbuf);
+
+ props.set (PROPERTY_X_TOOLTIP, CSS_TYPE_STRING, tooltip_str);
+ html->styleEngine->setNonCssHints (&props);
+ dFree(tooltip_str);
+ }
}
/*
@@ -1984,11 +1988,13 @@ DilloImage *a_Html_image_new(DilloHtml *html, const char *tag,
int space, border, w = 0, h = 0;
bool load_now;
CssPropertyList props;
+ char *tooltip_str = NULL;
-// if (prefs.show_tooltip &&
-// (attrbuf = a_Html_get_attr(html, tag, tagsize, "title")))
-// style_attrs->x_tooltip = a_Dw_tooltip_new_no_ref(attrbuf);
-
+ if (prefs.show_tooltip &&
+ (attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) {
+ tooltip_str = dStrdup(attrbuf);
+ props.set (PROPERTY_X_TOOLTIP, CSS_TYPE_STRING, tooltip_str);
+ }
alt_ptr = a_Html_get_attr_wdef(html, tag, tagsize, "alt", NULL);
if ((!alt_ptr || !*alt_ptr) && !prefs.load_images) {
dFree(alt_ptr);
@@ -2104,6 +2110,7 @@ DilloImage *a_Html_image_new(DilloHtml *html, const char *tag,
if (load_now)
Html_load_image(html->bw, url, Image);
+ dFree(tooltip_str);
dFree(width_ptr);
dFree(height_ptr);
dFree(alt_ptr);
diff --git a/src/styleengine.cc b/src/styleengine.cc
index a54fdeb3..d97aba5c 100644
--- a/src/styleengine.cc
+++ b/src/styleengine.cc
@@ -438,7 +438,9 @@ void StyleEngine::apply (StyleAttrs *attrs, CssPropertyList *props) {
case PROPERTY_X_IMG:
attrs->x_img = p->value.intVal;
break;
-
+ case PROPERTY_X_TOOLTIP:
+ attrs->x_tooltip = Tooltip::create(layout, p->value.strVal);
+ break;
default:
break;
}