--nextPart1488636.N8WZ8H0jXH Content-Type: multipart/mixed; boundary="Boundary-01=_IcF4AGRx9Lci+Mn" Content-Transfer-Encoding: 7bit Content-Disposition: inline --Boundary-01=_IcF4AGRx9Lci+Mn Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hello! Wow, my second patch in 3 days! The following patch implements (or fixes, since it is a w3c recommandation)= =20 bug 59489 (http://bugs.kde.org/show_bug.cgi?id=3D59489). With the patch, you can click on the label of a checkbox/radiobox to select= =20 it. Clicking on a text input, combobox or anything else label focuses it. Please review/correct/commit. regards --Boundary-01=_IcF4AGRx9Lci+Mn Content-Type: text/x-diff; charset="us-ascii"; name="formsclick.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="formsclick.diff" Index: khtmlview.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/khtmlview.cpp,v retrieving revision 1.639 diff -u -3 -r1.639 khtmlview.cpp =2D-- khtmlview.cpp 19 Jun 2004 20:47:34 -0000 1.639 +++ khtmlview.cpp 28 Jun 2004 15:18:40 -0000 @@ -727,17 +733,21 @@ d->clickX =3D xm; d->clickY =3D ym; } =2D bool swallowEvent =3D dispatchMouseEvent(EventImpl::MOUSEDOWN_EVENT,me= v.innerNode.handle(),true, d->clickCount,_mouse,true,DOM::= NodeImpl::MousePress); =2D + =20 khtml::RenderObject* r =3D mev.innerNode.handle() ? mev.innerNode.hand= le()->renderer() : 0; if (r && r->isWidget()) _mouse->ignore(); =2D + =20 if (!swallowEvent) { emit m_part->nodeActivated(mev.innerNode); =2D + if (mev.innerNode.handle()->parentNode()->id()=3D=3DID_LABEL)=20 + { + DOM::ElementImpl *inputForm=3Dstatic_cast(mev= =2EinnerNode.handle()->parentNode())->formElement(); + if (inputForm) + static_cast(inputForm)->activateInput(); + } khtml::MousePressEvent event( _mouse, xm, ym, mev.url, mev.target, mev.in= nerNode ); QApplication::sendEvent( m_part, &event ); // we might be deleted after this Index: html/html_formimpl.cpp =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v retrieving revision 1.372 diff -u -3 -r1.372 html_formimpl.cpp =2D-- html/html_formimpl.cpp 22 Jun 2004 05:46:41 -0000 1.372 +++ html/html_formimpl.cpp 28 Jun 2004 15:18:46 -0000 @@ -1553,6 +1553,19 @@ } } =20 +void HTMLInputElementImpl::activateInput() +{ +switch (m_type) +{ +case RADIO: +case CHECKBOX: +setChecked(!checked()); +break; +default: +focus(); +} +} + bool HTMLInputElementImpl::isEditable() { return ((m_type =3D=3D TEXT) || (m_type =3D=3D PASSWORD) || (m_type = =3D=3D ISINDEX) || (m_type =3D=3D FILE)); @@ -1580,15 +1593,20 @@ HTMLElementImpl::attach(); } =20 =2D#if 0 + ElementImpl *HTMLLabelElementImpl::formElement() { DOMString formElementId =3D getAttribute(ATTR_FOR); if (formElementId.isEmpty()) =2D return 0; + { + uint children=3DchildNodeCount(); + if (children>1)=20 + for (unsigned int i=3D0;iid()=3D=3DID_INPUT) return static_cast(childNode(i)); + return 0; + } return getDocument()->getElementById(formElementId); } =2D#endif =20 // -----------------------------------------------------------------------= =2D- =20 Index: html/html_formimpl.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.h,v retrieving revision 1.152 diff -u -3 -r1.152 html_formimpl.h =2D-- html/html_formimpl.h 22 Jun 2004 05:46:41 -0000 1.152 +++ html/html_formimpl.h 28 Jun 2004 15:18:46 -0000 @@ -291,6 +291,7 @@ =20 DOMString altText() const; void activate(); + void activateInput(); =20 protected: =20 @@ -319,6 +320,7 @@ =20 virtual Id id() const; virtual void attach(); + virtual ElementImpl* formElement(); =20 private: DOMString m_formElementID; --Boundary-01=_IcF4AGRx9Lci+Mn-- --nextPart1488636.N8WZ8H0jXH Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQBA4FcNB+BYfnGUHkURAm60AJ9b5o4wnT8zkNPRH06OoE0U3aDn/ACdGRUm y6coZ0O/sKMyBrKESrk5tRY= =c+3n -----END PGP SIGNATURE----- --nextPart1488636.N8WZ8H0jXH--