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

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml/html
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-11-22 17:06:46
Message-ID: 1227373606.005164.11044.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 887726 by orlovich:

Backport button grouping fix.


 M  +17 -2     html_formimpl.cpp  
 M  +6 -0      html_miscimpl.cpp  
 M  +1 -0      html_miscimpl.h  


--- branches/KDE/4.1/kdelibs/khtml/html/html_formimpl.cpp #887725:887726
@@ -1724,8 +1724,21 @@
 
 void HTMLInputElementImpl::setChecked(bool _checked)
 {
-    if (m_form && m_type == RADIO && _checked && !name().isEmpty())
-        m_form->radioClicked(this);
+    if (m_type == RADIO && _checked && !name().isEmpty()) {
+        // uncheck others in the group..
+        if (m_form) {
+            m_form->radioClicked(this);
+        } else {
+            // We're not in form, so we group with other formless radios with the \
same name +            HTMLCollectionImpl candidates(document()->documentElement(), \
HTMLCollectionImpl::FORMLESS_INPUT); +            unsigned long len = \
candidates.length(); +            for (unsigned long c = 0; c < len; ++c) {
+                HTMLInputElementImpl* current = \
static_cast<HTMLInputElementImpl*>(candidates.item(c)); +                if (current \
!= this && current->name() == name() && current->inputType() == \
HTMLInputElementImpl::RADIO) +                    current->setChecked(false);
+            }
+        }
+    }
 
     if (checked() == _checked) return;
     m_useDefaultChecked = false;
@@ -3030,3 +3043,5 @@
 
 // -------------------------------------------------------------------------
 
+
+// kate: indent-width 4; replace-tabs on; tab-width 8; space-indent on;
--- branches/KDE/4.1/kdelibs/khtml/html/html_miscimpl.cpp #887725:887726
@@ -127,6 +127,10 @@
         if(e->id() == ID_AREA)
             check = true;
         break;
+    case FORMLESS_INPUT:
+        if(e->id() == ID_INPUT && !static_cast<HTMLInputElementImpl*>(e)->form())
+            check = true;
+        break;
     case DOC_APPLETS:   // all OBJECT and APPLET elements
         if(e->id() == ID_OBJECT || e->id() == ID_APPLET || e->id() == ID_EMBED)
             check = true;
@@ -441,3 +445,5 @@
         return false;
     }
 }
+
+// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
--- branches/KDE/4.1/kdelibs/khtml/html/html_miscimpl.h #887725:887726
@@ -66,6 +66,7 @@
         SELECT_OPTIONS,
         // from HTMLMap
         MAP_AREAS,
+        FORMLESS_INPUT, // input elements that do not have form associated w/them
         DOC_ALL,        // "all" elements (IE)
         NODE_CHILDREN,   // first-level children (IE)
         FORM_ELEMENTS,   // input elements in a form


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

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