From 557e476e26c86df1003c4ad9251d60ba5c7f8be7 Mon Sep 17 00:00:00 2001 From: "xan@webkit.org" Date: Thu, 30 Jul 2009 07:52:23 +0000 Subject: [PATCH] 2009-07-30 Xan Lopez Reviewed by Maciej Stachowiak. https://bugs.webkit.org/show_bug.cgi?id=25535 [GTK] object:state-changed:checked events missing for radio buttons and checkboxes Implement state-changed:checked for radio buttons and checkboxes. * accessibility/gtk/AXObjectCacheAtk.cpp: (WebCore::AXObjectCache::postPlatformNotification): * html/HTMLInputElement.cpp: (WebCore::HTMLInputElement::setChecked): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46574 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 14 ++++++++++++++ WebCore/accessibility/gtk/AXObjectCacheAtk.cpp | 7 ++++++- WebCore/html/HTMLInputElement.cpp | 7 +++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 57fcbfcf479..242e58e545b 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,17 @@ +2009-07-30 Xan Lopez + + Reviewed by Maciej Stachowiak. + + https://bugs.webkit.org/show_bug.cgi?id=25535 + [GTK] object:state-changed:checked events missing for radio buttons and checkboxes + + Implement state-changed:checked for radio buttons and checkboxes. + + * accessibility/gtk/AXObjectCacheAtk.cpp: + (WebCore::AXObjectCache::postPlatformNotification): + * html/HTMLInputElement.cpp: + (WebCore::HTMLInputElement::setChecked): + 2009-07-30 Xan Lopez Forgot the 'break'. diff --git a/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp b/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp index 25665b1b2ed..a04367f5ccd 100644 --- a/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp +++ b/WebCore/accessibility/gtk/AXObjectCacheAtk.cpp @@ -37,8 +37,13 @@ void AXObjectCache::attachWrapper(AccessibilityObject* obj) g_object_unref(atkObj); } -void AXObjectCache::postPlatformNotification(AccessibilityObject*, const String&) +void AXObjectCache::postPlatformNotification(AccessibilityObject* coreObject, const String& message) { + if (message == "AXCheckedStateChanged") { + if (!coreObject->isCheckboxOrRadio()) + return; + g_signal_emit_by_name(coreObject->wrapper(), "state-change", "checked", coreObject->isChecked()); + } } void AXObjectCache::handleFocusedUIElementChanged() diff --git a/WebCore/html/HTMLInputElement.cpp b/WebCore/html/HTMLInputElement.cpp index f35292f6108..61e3157643f 100644 --- a/WebCore/html/HTMLInputElement.cpp +++ b/WebCore/html/HTMLInputElement.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "HTMLInputElement.h" +#include "AXObjectCache.h" #include "CSSPropertyNames.h" #include "ChromeClient.h" #include "Document.h" @@ -972,6 +973,12 @@ void HTMLInputElement::setChecked(bool nowChecked, bool sendChangeEvent) if (renderer() && renderer()->style()->hasAppearance()) renderer()->theme()->stateChanged(renderer(), CheckedState); + // Ideally we'd do this from the render tree (matching + // RenderTextView), but it's not possible to do it at the moment + // because of the way the code is structured. + if (renderer() && AXObjectCache::accessibilityEnabled()) + renderer()->document()->axObjectCache()->postNotification(renderer(), "AXCheckedStateChanged", true); + // Only send a change event for items in the document (avoid firing during // parsing) and don't send a change event for a radio button that's getting // unchecked to match other browsers. DOM is not a useful standard for this -- GitLab