SVN commit 873059 by orlovich: Rework how we do onchange for input/checkboxes, unbreaking it and simplifying things. As we only want to fire it in response to user events, this just does it in defaultEventHandler. Fixes kde-look wallaper settings, and along with Germain's previous fix this covers #165607, #170451. This also doesn't suffer from #148118 BUG:148118 BUG:165607 BUG:170451 M +8 -0 html/html_formimpl.cpp M +1 -12 rendering/render_form.cpp --- branches/KDE/4.1/kdelibs/khtml/html/html_formimpl.cpp #873058:873059 @@ -1801,8 +1801,16 @@ MouseEventImpl* const me = static_cast(evt); if ((m_type == RADIO || m_type == CHECKBOX) && me->id() == EventImpl::MOUSEUP_EVENT && me->detail() > 0) { + + // Did we change? Always yes for checkboxes, and for radio buttons + // only if we're not already checked. + bool changed = m_type == CHECKBOX || !checked(); + // click will follow setChecked(m_type == RADIO ? true : !checked()); + + if (changed) + onChange(); } if (evt->id() == EventImpl::CLICK_EVENT && m_type == IMAGE && m_render) { // record the mouse position for when we get the DOMActivate event --- branches/KDE/4.1/kdelibs/khtml/rendering/render_form.cpp #873058:873059 @@ -269,8 +269,7 @@ void RenderCheckBox::updateFromElement() { if (widget()->isChecked() != element()->checked()) { - m_ignoreStateChanged = true; // We don't want an onchange here, - // or us getting yanked in a recalcStyle in the process, etc. + m_ignoreStateChanged = true; widget()->setChecked(element()->checked()); m_ignoreStateChanged = false; } @@ -282,10 +281,6 @@ { if (m_ignoreStateChanged) return; element()->setChecked(state == Qt::Checked); - - ref(); - element()->onChange(); - deref(); } bool RenderCheckBox::handleEvent(const DOM::EventImpl& ev) @@ -346,12 +341,6 @@ { if (m_ignoreToggled) return; - - if(activated) { - ref(); - element()->onChange(); - deref(); - } } bool RenderRadioButton::handleEvent(const DOM::EventImpl& ev)