[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-08-22 21:36:29
Message-ID: 1219440989.875466.23483.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 851099 by orlovich:

Fix a bunch of bugs with focus of form elements:
1) Don't allow a disabled/readonly focus element to be focused 
2) Cleaer focus from an element when it gets disabled
3) readonly things shouldn't be focusable either
BUG: 159682


 M  +1 -1      html/html_formimpl.cpp  
 M  +7 -0      rendering/render_form.cpp  
 M  +5 -0      xml/dom_docimpl.cpp  


--- branches/KDE/4.1/kdelibs/khtml/html/html_formimpl.cpp #851098:851099
@@ -979,7 +979,7 @@
 
 bool HTMLGenericFormElementImpl::isFocusable() const
 {
-    if (disabled())
+    if (disabled() || readOnly())
 	return false;
 
     //Non-widget INPUT TYPE="image" and <BUTTON> support focus, too.
--- branches/KDE/4.1/kdelibs/khtml/rendering/render_form.cpp #851098:851099
@@ -171,6 +171,13 @@
 void RenderFormElement::updateFromElement()
 {
     m_widget->setEnabled(!element()->disabled());
+
+    // If we've disabled/made r/o a focused element, clear its focus,
+    // so Qt doesn't do funny stuff like let one type into a disabled
+    // line edit.
+    if ((element()->disabled() || element()->readOnly()) && element()->focused())
+        document()->quietResetFocus();
+
     RenderWidget::updateFromElement();
     setPadding();
 }
--- branches/KDE/4.1/kdelibs/khtml/xml/dom_docimpl.cpp #851098:851099
@@ -2400,6 +2400,11 @@
     // don't process focus changes while detaching
     if( !m_render ) return;
 
+    // See if the new node is really focusable. It might not be
+    // if focus() was called explicitly.
+    if (newFocusNode && !newFocusNode->isFocusable())
+        return;
+
     // Make sure newFocusNode is actually in this document
     if (newFocusNode && (newFocusNode->document() != this))
         return;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic