2007-10-02 Cosimo Cecchi <cosimoc@svn.gnome.org>
authorzecke <zecke@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Oct 2007 16:31:13 +0000 (16:31 +0000)
committerzecke <zecke@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Oct 2007 16:31:13 +0000 (16:31 +0000)
        Reviewed by Mark.

        http://bugs.webkit.org/show_bug.cgi?id=15299
        Fix "hovering_over_link" signal being fired every time mouse moves.

        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::ChromeClient):
        (WebKit::ChromeClient::mouseDidMoveOverElement):
        * WebCoreSupport/ChromeClientGtk.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@26020 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/gtk/ChangeLog
WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

index 82bc88f1c65479bb5f6b8a6cacfade2c7b3cbbe7..c7578456998f5e21abce81bb258b88e7cd1d71c3 100644 (file)
@@ -1,3 +1,15 @@
+2007-10-02  Cosimo Cecchi  <cosimoc@svn.gnome.org>
+
+        Reviewed by Mark.
+
+        http://bugs.webkit.org/show_bug.cgi?id=15299
+        Fix "hovering_over_link" signal being fired every time mouse moves.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::ChromeClient):
+        (WebKit::ChromeClient::mouseDidMoveOverElement):
+        * WebCoreSupport/ChromeClientGtk.h:
+
 2007-09-21  Sean Egan  <seanegan@gmail.com>
 
         Reviewed by Alp.
index 221dc3ed773d9efcdd76a50f0c3e44b051df5925..88a8c6843ab5f08d51328b1b04f6eb5b173a3260 100644 (file)
@@ -43,6 +43,7 @@ using namespace WebCore;
 namespace WebKit {
 ChromeClient::ChromeClient(WebKitGtkPage* page)
     : m_webPage(page)
+    , m_didSendLinkSignal(false)
 {
 }
 
@@ -273,13 +274,19 @@ void ChromeClient::updateBackingStore()
 void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags)
 {
     // check if the element is a link...
-    KURL url = hit.absoluteLinkURL();
-    if(!url.isEmpty()) {
-        CString titleString = hit.title().utf8();
-        DeprecatedCString urlString = url.prettyURL().utf8();
-        g_signal_emit_by_name(m_webPage, "hovering_over_link", titleString.data(), urlString.data());
-    } else
+    bool isLink = hit.isLiveLink();
+    if (isLink && !m_didSendLinkSignal) {
+        KURL url = hit.absoluteLinkURL();
+        if (!url.isEmpty()) {
+            CString titleString = hit.title().utf8();
+            DeprecatedCString urlString = url.prettyURL().utf8();
+            g_signal_emit_by_name(m_webPage, "hovering_over_link", titleString.data(), urlString.data());
+            m_didSendLinkSignal = true;
+        }
+    } else if (!isLink && m_didSendLinkSignal) {
         g_signal_emit_by_name(m_webPage, "hovering_over_link", 0, 0);
+        m_didSendLinkSignal = false;
+    }
 }
 
 void ChromeClient::setToolTip(const String&)
index 0edd150b33ef3cd58512019eff0132910a0c632c..bebffaba0e49581b6cef6d03695fe815edbf4bf5 100644 (file)
@@ -103,6 +103,7 @@ namespace WebKit {
         virtual void print(WebCore::Frame*);
     private:
         WebKitGtkPage* m_webPage;
+        bool m_didSendLinkSignal;
     };
 }