[PATCH] Last version of the "fix label form focus" (59489)

Tobias Anton TA at ESC-Electronics.de
Tue Jul 6 16:22:36 BST 2004


On Dienstag, 6. Juli 2004 17:01, Germain Garand wrote:
> I looked at your patch, and though I'm not really fluent with the event
> handling mechanism, there are things that bother me:
> - first: indentation is crappy, please fix it to match the code style :-)
> - you seem to short-circuit totally the DOM events with your activateInput
> ...it should really be a click()

Actually, the label should issue a DOMActivate event to the input element 
rather than a mouse click. But this does neither work for checkboxes, nor for 
radio buttons and text areas.

To make it work this way, the class HTMLTextAreaElementImpl would need a new 
defaultEventHandler method handling the DOMACTIVATE_EVENT, and 
HTMLInputElementImpl::defaultEventHandler would need something like:

Index: html/html_formimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v
retrieving revision 1.372
diff -u -3 -p -r1.372 html_formimpl.cpp
--- html/html_formimpl.cpp      22 Jun 2004 05:46:41 -0000      1.372
+++ html/html_formimpl.cpp      6 Jul 2004 16:17:53 -0000
@@ -1504,8 +1504,10 @@ void HTMLInputElementImpl::defaultEventH
                if (te->keyVal() == ' ')
                    check = true;
            }
+           if (evt->id() == EventImpl::DOMACTIVATE_EVENT)
+               check = true;
            if (check) {
-               if (evt->id() == EventImpl::KEYUP_EVENT) {
+               if (evt->id() == EventImpl::KEYUP_EVENT || 
evt->id()==EventImpl::DOMACTIVATE_EVENT) {
                    if (m_type == RADIO || m_type == CHECKBOX)
                        setChecked(m_type == RADIO ? true : !checked());
                    click();

Cheers
-- Tobias




More information about the kfm-devel mailing list