Bug 49498 - focus issue with links that have tooltips
Summary: focus issue with links that have tooltips
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-13 14:43 PST by Hussam Al-Tayeb
Modified: 2010-11-23 12:40 PST (History)
2 users (show)

See Also:


Attachments
Patch to set the tooltip area (4.07 KB, patch)
2010-11-19 02:31 PST, Carlos Garcia Campos
mrobinson: review-
Details | Formatted Diff | Diff
Updated patch (3.11 KB, patch)
2010-11-22 00:25 PST, Carlos Garcia Campos
mrobinson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hussam Al-Tayeb 2010-11-13 14:43:51 PST
I found a bug in webkit gtk .If there are many images with links on the same horizontal line. If I hover over first one and it shows the title (tooltip)  then move the mouse horizontally to the next link right of it, the second tooltip will appear on first link. A workaround is moving the mouse vertically a bit then moving it to next link. I'm using 1.3.6 from git.
Comment 1 Hussam Al-Tayeb 2010-11-13 14:45:50 PST
This happens only when the links are directly adjacent. sometimes second link tooltiip doesn't show till I move the mouse around then back to second link
Comment 2 Hussam Al-Tayeb 2010-11-18 10:10:54 PST
To reproduce, open http://en.wikipedia.org/wiki/Webkit

1. Put mouse over "Discussion" first (not "Article").
2. Move the mouse horizontally (not vertically) over "Article". 
3. Watch tooltip over wrong link.
Comment 3 Carlos Garcia Campos 2010-11-19 02:29:23 PST
Yes, this is because tooltip position is not updated for the same widget unless an area of the widget is set for the tooltip.
Comment 4 Carlos Garcia Campos 2010-11-19 02:31:02 PST
Created attachment 74364 [details]
Patch to set the tooltip area

Set the area of the widget where the tooltip should be shown when a new tooltip is set. Since the widget is the same (the view), if the tooltip area is not set and a new tooltip is triggered while the previous one is still visible, the text of the tooltip is updated but its position doesn't change
Comment 5 Martin Robinson 2010-11-19 08:49:01 PST
Comment on attachment 74364 [details]
Patch to set the tooltip area

View in context: https://bugs.webkit.org/attachment.cgi?id=74364&action=review

Great! Just a couple suggestions.

> WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:526
> +    if (Node* node = hit.innerNonSharedNode())
> +        webkit_web_view_set_tooltip_area(m_webView, node->getRect());
> +    else
> +        webkit_web_view_set_tooltip_area(m_webView, IntRect());

I think it might be cleaner to simply have this code update the WebView private data structure.

> WebKit/gtk/webkit/webkitwebview.cpp:1645
> +                gtk_tooltip_set_tip_area(tooltip, NULL);

NULL should be 0 here.

> WebKit/gtk/webkit/webkitwebview.cpp:4756
> +void webkit_web_view_set_tooltip_area(WebKitWebView* webView, const IntRect& area)
> +{
> +#if GTK_CHECK_VERSION(2, 12, 0)
> +    WebKitWebViewPrivate* priv = webView->priv;
> +    priv->tooltipArea = area;
> +    // query-tooltip will be triggered by webkit_web_view_set_tooltip_text().
> +#else
> +    // TODO: Support older GTK+ versions
> +    // See http://bugs.webkit.org/show_bug.cgi?id=15793
> +    notImplemented();
> +#endif
> +}
> +
>  /**

I think the conditional logic is unnecessarily here. It's technically correct, but this method doesn't use any GTK+ API calls that don't exist in < 2.12.0. I prefer simply scrapping this and fiddling the private structure directly. Mainly this is because webkitwebview.cpp is bordering on 5000 lines.
Comment 6 Carlos Garcia Campos 2010-11-22 00:25:56 PST
Created attachment 74531 [details]
Updated patch
Comment 7 Martin Robinson 2010-11-23 12:35:51 PST
Comment on attachment 74531 [details]
Updated patch

View in context: https://bugs.webkit.org/attachment.cgi?id=74531&action=review

Looks great. There is only one tiny thing that I'll change before landing.

> WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp:526
> +    WebKitWebViewPrivate* priv = m_webView->priv;
> +    Node* node = hit.innerNonSharedNode();
> +    priv->tooltipArea = node ? node->getRect() : IntRect();

This should probably just be m_webView->priv->tooltipArea = ... I'll fix that and land it.
Comment 8 Martin Robinson 2010-11-23 12:40:50 PST
Committed r72621: <http://trac.webkit.org/changeset/72621>