patch: click event handling

Maciej Stachowiak mjs at apple.com
Tue Oct 28 14:25:46 CET 2003



Here's a patch to make click handlers added w/ addEventListener work 
right for form controls.


-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/ChangeLog,v
retrieving revision 1.2137
diff -u -p -r1.2137 ChangeLog
--- ChangeLog	2003/10/28 19:40:06	1.2137
+++ ChangeLog	2003/10/28 22:12:00
@@ -1,5 +1,15 @@
 2003-10-28  Maciej Stachowiak  <mjs at apple.com>
 
+        Reviewed by John.
+
+	- fixed 3464528 - addEventListener does not work for buttons, text areas, or inputs
+
+        * khtml/rendering/render_form.cpp:
+        (RenderFormElement::slotClicked): Send CLICK_EVENT as well as one
+	of KHTML_CLICK_EVENT or KHTML_DOUBLE_CLICK_EVENT.
+
+2003-10-28  Maciej Stachowiak  <mjs at apple.com>
+
         Fixed broken build.
 
         * kwq/KWQKPartsPart.mm:
Index: khtml/rendering/render_form.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/rendering/render_form.cpp,v
retrieving revision 1.66
diff -u -p -r1.66 khtml/rendering/render_form.cpp
--- khtml/rendering/render_form.cpp	2003/10/17 22:32:13	1.66
+++ khtml/rendering/render_form.cpp	2003/10/28 22:12:01
@@ -172,6 +172,7 @@ void RenderFormElement::slotClicked()
     RenderArena *arena = ref();
     QMouseEvent e2( QEvent::MouseButtonRelease, m_mousePos, m_button, m_state);
 
+    element()->dispatchMouseEvent(&e2, EventImpl::CLICK_EVENT, m_clickCount);
     element()->dispatchMouseEvent(&e2, m_isDoubleClick ? EventImpl::KHTML_DBLCLICK_EVENT : EventImpl::KHTML_CLICK_EVENT, m_clickCount);
     m_isDoubleClick = false;
     deref(arena);
-------------- next part --------------



Here's a sample page that demonstrates the bug in Safari; adding a 
click handler w/ addEventListener and then clicking on the button or 
either of the text fields does not fire the handler:

-------------- next part --------------
Skipped content of type multipart/appledouble-------------- next part --------------


I'm not sure if Konqueror has the same bug or not.


More information about the Khtml-devel mailing list