[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 16:37:12 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 67f1e647203055dbfa245894e06631910d5e8940
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 29 12:35:16 2010 +0000

    2010-11-29  Carlos Garcia Campos  <cgarcia at igalia.com>
    
            Reviewed by Xan Lopez.
    
            [Gtk] Tooltips should be fully keyboard accessible
            https://bugs.webkit.org/show_bug.cgi?id=25525
    
            Position the tooltip under the current focused element when the
            tooltip has been triggered using the keyboard.
    
            * webkit/webkitwebview.cpp:
            (webkit_web_view_query_tooltip):
            (webkit_web_view_show_help):
            (webkit_web_view_class_init):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72789 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index c1ab250..90aeaa4 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -2,6 +2,21 @@
 
         Reviewed by Xan Lopez.
 
+        [Gtk] Tooltips should be fully keyboard accessible
+        https://bugs.webkit.org/show_bug.cgi?id=25525
+
+        Position the tooltip under the current focused element when the
+        tooltip has been triggered using the keyboard.
+
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_query_tooltip):
+        (webkit_web_view_show_help):
+        (webkit_web_view_class_init):
+
+2010-11-29  Carlos Garcia Campos  <cgarcia at igalia.com>
+
+        Reviewed by Xan Lopez.
+
         [GTK] Tooltips not shown when scrolling
         https://bugs.webkit.org/show_bug.cgi?id=50143
 
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 0c6b20c..3e888f8 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -1654,6 +1654,34 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y,
 {
     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(widget);
 
+    if (keyboard_mode) {
+        WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
+
+        // Get the title of the current focused element.
+        Frame* coreFrame = core(webView)->focusController()->focusedOrMainFrame();
+        if (!coreFrame)
+            return FALSE;
+
+        Node* node = getFocusedNode(coreFrame);
+        if (!node)
+            return FALSE;
+
+        for (Node* titleNode = node; titleNode; titleNode = titleNode->parentNode()) {
+            if (titleNode->isElementNode()) {
+                String title = static_cast<Element*>(titleNode)->title();
+                if (!title.isEmpty()) {
+                    GdkRectangle area = coreFrame->view()->contentsToWindow(node->getRect());
+                    gtk_tooltip_set_tip_area(tooltip, &area);
+                    gtk_tooltip_set_text(tooltip, title.utf8().data());
+
+                    return TRUE;
+                }
+            }
+        }
+
+        return FALSE;
+    }
+
     if (priv->tooltipText.length() > 0) {
         if (!keyboard_mode) {
             if (!priv->tooltipArea.isEmpty()) {
@@ -1668,6 +1696,14 @@ static gboolean webkit_web_view_query_tooltip(GtkWidget *widget, gint x, gint y,
 
     return FALSE;
 }
+
+static gboolean webkit_web_view_show_help(GtkWidget* widget, GtkWidgetHelpType help_type)
+{
+    if (help_type == GTK_WIDGET_HELP_TOOLTIP)
+        gtk_widget_set_has_tooltip(widget, TRUE);
+
+    return GTK_WIDGET_CLASS(webkit_web_view_parent_class)->show_help(widget, help_type);
+}
 #endif
 
 static GtkIMContext* webkit_web_view_get_im_context(WebKitWebView* webView)
@@ -2741,6 +2777,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
     widgetClass->drag_data_received = webkit_web_view_drag_data_received;
 #if GTK_CHECK_VERSION(2, 12, 0)
     widgetClass->query_tooltip = webkit_web_view_query_tooltip;
+    widgetClass->show_help = webkit_web_view_show_help;
 #endif
 
     GtkContainerClass* containerClass = GTK_CONTAINER_CLASS(webViewClass);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list