Support for title attribute in tooltips

Rob S <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
You are all likely to cringe in horror when you see what I have been
up to today.  I basically wanted to add hover/tooltip functionality
for elements which contain the title attribute.  I think I achieved
that with the following code:

diff -r 49c3e24bf746 dpi/downloads.cc
--- a/dpi/downloads.cc	Fri Jul 29 20:19:08 2011 -0400
+++ b/dpi/downloads.cc	Sat Jul 30 18:58:38 2011 -0400
@@ -516,7 +516,7 @@

    // FSM to remove wget's "dot-progress" (i.e. "^ " || "^[0-9]+K")
    q = log_text + log_len;
-   for (p = esc_str; (p - esc_str) < esc_len; ++p) {
+   for (p = esc_str; (size_t)(p - esc_str) < esc_len; ++p) {
       switch (log_state) {
       case ST_newline:
          if (*p == ' ') {
diff -r 49c3e24bf746 src/html.cc
--- a/src/html.cc	Fri Jul 29 20:19:08 2011 -0400
+++ b/src/html.cc	Sat Jul 30 18:58:38 2011 -0400
@@ -1788,7 +1788,6 @@
             html->styleEngine->backgroundStyle()->backgroundColor->getColor());
    }

-
    S_TOP(html)->parse_mode = DILLO_HTML_PARSE_MODE_BODY;
 }

@@ -3455,6 +3454,13 @@
          html->styleEngine->setStyle (attrbuf);
    }

+   if (prefs.show_tooltip &&
+       (attrbuf = a_Html_get_attr(html, tag, tagsize, "title"))) {
+
+      html->styleEngine->setNonCssHint (PROPERTY_X_TOOLTIP, CSS_TYPE_STRING,
+                                        attrbuf);
+   }
+
 }

 /*

The real ugliness is here:
http://www3.sympatico.ca/rsquared/lib/dillo/title.html  :P

I am not done yet, and I have some ideas of some other little things I
can do.  But first I want to check with you fellows if you think this
is on the right track.  I hate to do a bunch of code that works, but
doesn't "work" for the rest of you for whatever reason.

Regards,

Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.