File patch-r887726.diff of Package kdelibs4
Subject: khtml button grouping outside forms fix
From: wstephenson@suse.de
Bug: kde:89363
Patch-upstream: 887726
--- khtml/html/html_miscimpl.cpp (revision 887725)
+++ khtml/html/html_miscimpl.cpp (revision 887726)
@@ -127,6 +127,10 @@ bool HTMLCollectionImpl::nodeMatches(Nod
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 @@ bool HTMLMappedNameCollectionImpl::match
return false;
}
}
+
+// kate: indent-width 4; replace-tabs on; tab-width 4; space-indent on;
--- khtml/html/html_formimpl.cpp (revision 887725)
+++ khtml/html/html_formimpl.cpp (revision 887726)
@@ -1724,8 +1724,21 @@ void HTMLInputElementImpl::reset()
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 @@ void HTMLIsIndexElementImpl::setPrompt(c
// -------------------------------------------------------------------------
+
+// kate: indent-width 4; replace-tabs on; tab-width 8; space-indent on;
--- khtml/html/html_miscimpl.h (revision 887725)
+++ khtml/html/html_miscimpl.h (revision 887726)
@@ -66,6 +66,7 @@ public:
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
Index: khtml/html/html_miscimpl.cpp
===================================================================
Index: khtml/html/html_formimpl.cpp
===================================================================
Index: khtml/html/html_miscimpl.h
===================================================================