Changeset 160417 in webkit
- Timestamp:
- Dec 11, 2013 2:28:21 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r160410 r160417 1 2013-12-11 Mario Sanchez Prada <mario.prada@samsung.com> 2 3 Programmatically-inserted children lack accessibility events 4 https://bugs.webkit.org/show_bug.cgi?id=100275 5 6 Reviewed by Chris Fleizach. 7 8 Add new test to chack that children-changed signals are properly 9 emitted when adding/removing elements in the accessibility hierarchy. 10 11 * accessibility/children-changed-sends-notification-expected.txt: Added. 12 * accessibility/children-changed-sends-notification.html: Added. 13 14 Update test to filter out unrelated non-loading events. 15 * accessibility/loading-iframe-sends-notification.html: Updated. 16 17 Skip the test on the Mac as it does not expose these kind of 18 notifications when children are being added or removed. 19 * platform/mac/TestExpectations: Skip newly added test. 20 1 21 2013-12-10 Gurpreet Kaur <k.gurpreet@samsung.com> 2 22 -
trunk/LayoutTests/accessibility/loading-iframe-sends-notification.html
r155410 r160417 54 54 55 55 window.accessibilityController.addNotificationListener(function (target, notification) { 56 // Ignore this notification if it's not on the iframe. 57 if (target.description.indexOf("InnerFrame") == -1) 56 // Ignore this notification if it's not on the iframe or not about the iframe being loaded. 57 if (target.description.indexOf("InnerFrame") == -1 58 || (notification != "AXLoadComplete" && notification != "AXLayoutComplete")) 58 59 return; 59 60 -
trunk/LayoutTests/platform/mac/TestExpectations
r160249 r160417 41 41 # Accessibility tests for notifications that don't exist or aren't needed on Mac OS X. 42 42 accessibility/aria-checkbox-sends-notification.html 43 accessibility/children-changed-sends-notification.html 43 44 accessibility/menu-list-sends-change-notification.html 44 45 accessibility/multiselect-list-reports-active-option.html -
trunk/Source/WebCore/ChangeLog
r160415 r160417 1 2013-12-11 Mario Sanchez Prada <mario.prada@samsung.com> 2 3 Programmatically-inserted children lack accessibility events 4 https://bugs.webkit.org/show_bug.cgi?id=100275 5 6 Reviewed by Chris Fleizach. 7 8 Test: accessibility/children-changed-sends-notification.html 9 10 Emit children-changed::add and children-changed::remove whenever 11 an object has been added/removed to the accessibility hierarchy, 12 that is, when a new AtkObject is being attached/detached. 13 14 * accessibility/AXObjectCache.h: Added new enumeration to know 15 when we are detaching a wrapper because of the cache or the 16 element is being destroyed, so we can use that information. 17 (WebCore::AXObjectCache::detachWrapper): Added a new parameter and 18 updated all the prototypes in different ports. 19 * accessibility/AXObjectCache.cpp: 20 (WebCore::AXObjectCache::~AXObjectCache): Call detachWrapper() 21 specifying that we do it because the cache is being destroyed. 22 (WebCore::AXObjectCache::remove): Call detachWrapper() specifying 23 that we do it because an accessible element is being destroyed. 24 25 * accessibility/atk/AXObjectCacheAtk.cpp: 26 (WebCore::AXObjectCache::detachWrapper): Emit the children-changed 27 signal when needed. We rely on the cached reference to the parent 28 AtkObject (using the implementation of atk_object_get_parent from 29 the AtkObject class) to find the right object to emit the signal 30 from here, since the accessibility hierarchy from WebCore will no 31 longer be accessible at this point. 32 (WebCore::AXObjectCache::attachWrapper): Emit the children-change 33 signal from here unless we are in the middle of a layout update, 34 trying to provide as much information (e.g. the offset) as possible. 35 (WebCore::AXObjectCache::postPlatformNotification): Make sure we 36 update (touch) the subtree under an accessibility object whenever 37 we receive AXChildrenChanded from WebCore, to ensure that those 38 objects will also be visible rightaway to ATs, and that those get 39 properly notified of the event at that very same moment. 40 41 * accessibility/ios/AXObjectCacheIOS.mm: 42 (WebCore::AXObjectCache::detachWrapper): Updated function signature. 43 * accessibility/mac/AXObjectCacheMac.mm: 44 (WebCore::AXObjectCache::detachWrapper): Ditto. 45 * accessibility/win/AXObjectCacheWin.cpp: 46 (WebCore::AXObjectCache::detachWrapper): Ditto. 47 1 48 2013-12-11 Andreas Kling <akling@apple.com> 2 49 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r159500 r160417 122 122 for (HashMap<AXID, RefPtr<AccessibilityObject>>::iterator it = m_objects.begin(); it != end; ++it) { 123 123 AccessibilityObject* obj = (*it).value.get(); 124 detachWrapper(obj );124 detachWrapper(obj, CacheDestroyed); 125 125 obj->detach(); 126 126 removeAXID(obj); … … 494 494 return; 495 495 496 detachWrapper(obj );496 detachWrapper(obj, ElementDestroyed); 497 497 obj->detach(); 498 498 removeAXID(obj); -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r159500 r160417 72 72 enum PostType { PostSynchronously, PostAsynchronously }; 73 73 74 enum DetachmentType { CacheDestroyed, ElementDestroyed }; 75 74 76 class AXObjectCache { 75 77 WTF_MAKE_NONCOPYABLE(AXObjectCache); WTF_MAKE_FAST_ALLOCATED; … … 103 105 void remove(AXID); 104 106 105 void detachWrapper(AccessibilityObject* );107 void detachWrapper(AccessibilityObject*, DetachmentType); 106 108 void attachWrapper(AccessibilityObject*); 107 109 void childrenChanged(Node*); … … 285 287 inline void AXObjectCache::textChanged(AccessibilityObject*) { } 286 288 inline void AXObjectCache::updateCacheAfterNodeIsAttached(Node*) { } 287 inline void AXObjectCache::detachWrapper(AccessibilityObject* ) { }289 inline void AXObjectCache::detachWrapper(AccessibilityObject*, DetachmentType) { } 288 290 inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { } 289 291 inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { } -
trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
r157718 r160417 32 32 #include "WebKitAccessibleWrapperAtk.h" 33 33 #include <wtf/gobject/GOwnPtr.h> 34 #include <wtf/gobject/GRefPtr.h> 34 35 #include <wtf/text/CString.h> 35 36 36 37 namespace WebCore { 37 38 38 void AXObjectCache::detachWrapper(AccessibilityObject* obj) 39 { 40 webkitAccessibleDetach(WEBKIT_ACCESSIBLE(obj->wrapper())); 39 void AXObjectCache::detachWrapper(AccessibilityObject* obj, DetachmentType detachmentType) 40 { 41 AtkObject* wrapper = obj->wrapper(); 42 ASSERT(wrapper); 43 44 // If an object is being detached NOT because of the AXObjectCache being destroyed, 45 // then it's being removed from the accessibility tree and we should emit a signal. 46 if (detachmentType != CacheDestroyed) { 47 if (obj->document()) { 48 // Look for the right object to emit the signal from, but using the implementation 49 // of atk_object_get_parent from AtkObject class (which uses a cached pointer if set) 50 // since the accessibility hierarchy in WebCore will no longer be navigable. 51 gpointer webkitAccessibleClass = g_type_class_peek_parent(WEBKIT_ACCESSIBLE_GET_CLASS(wrapper)); 52 gpointer atkObjectClass = g_type_class_peek_parent(webkitAccessibleClass); 53 AtkObject* atkParent = ATK_OBJECT_CLASS(atkObjectClass)->get_parent(ATK_OBJECT(wrapper)); 54 55 // We don't want to emit any signal from an object outside WebKit's world. 56 if (WEBKIT_IS_ACCESSIBLE(atkParent)) { 57 // The accessibility hierarchy is already invalid, so the parent-children relationships 58 // in the AccessibilityObject tree are not there anymore, so we can't know the offset. 59 g_signal_emit_by_name(atkParent, "children-changed::remove", -1, wrapper); 60 } 61 } 62 } 63 64 webkitAccessibleDetach(WEBKIT_ACCESSIBLE(wrapper)); 41 65 } 42 66 … … 46 70 obj->setWrapper(atkObj); 47 71 g_object_unref(atkObj); 72 73 // If an object is being attached and we are not in the middle of a layout update, then 74 // we should report ATs by emitting the children-changed::add signal from the parent. 75 Document* document = obj->document(); 76 if (!document || document->childNeedsStyleRecalc()) 77 return; 78 79 // Don't emit the signal for objects that we already know won't be exposed directly. 80 AccessibilityObject* coreParent = obj->parentObjectUnignored(); 81 if (!coreParent || coreParent->accessibilityIsIgnoredByDefault()) 82 return; 83 84 // Look for the right object to emit the signal from. 85 AtkObject* atkParent = coreParent ? coreParent->wrapper() : 0; 86 if (!atkParent) 87 return; 88 89 size_t index = coreParent->children().find(obj); 90 g_signal_emit_by_name(atkParent, "children-changed::add", index, atkObj); 48 91 } 49 92 … … 144 187 return; 145 188 146 if (notification == AXCheckedStateChanged) { 189 switch (notification) { 190 case AXCheckedStateChanged: 147 191 if (!coreObject->isCheckboxOrRadio()) 148 192 return; 149 193 atk_object_notify_state_change(axObject, ATK_STATE_CHECKED, coreObject->isChecked()); 150 } else if (notification == AXSelectedChildrenChanged || notification == AXMenuListValueChanged) { 194 break; 195 196 case AXChildrenChanged: 197 // We need to make sure that the children AtkObjects are created at this moment, 198 // so the children-changed::add signal gets properly emitted in attachWrapper(). 199 if (int numOfChildren = atk_object_get_n_accessible_children(axObject)) { 200 for (int i = 0; i < numOfChildren; ++i) 201 GRefPtr<AtkObject> child(atk_object_ref_accessible_child(axObject, i)); 202 } 203 break; 204 205 case AXSelectedChildrenChanged: 206 case AXMenuListValueChanged: 151 207 if (notification == AXMenuListValueChanged && coreObject->isMenuList()) { 152 208 g_signal_emit_by_name(axObject, "focus-event", true); … … 154 210 } 155 211 notifyChildrenSelectionChange(coreObject); 156 } else if (notification == AXValueChanged) { 157 if (!ATK_IS_VALUE(axObject)) 158 return; 159 160 AtkPropertyValues propertyValues; 161 propertyValues.property_name = "accessible-value"; 162 163 memset(&propertyValues.new_value, 0, sizeof(GValue)); 164 atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value); 165 166 g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL); 167 } else if (notification == AXInvalidStatusChanged) 212 break; 213 214 case AXValueChanged: 215 if (ATK_IS_VALUE(axObject)) { 216 AtkPropertyValues propertyValues; 217 propertyValues.property_name = "accessible-value"; 218 219 memset(&propertyValues.new_value, 0, sizeof(GValue)); 220 atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value); 221 222 g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL); 223 } 224 break; 225 226 case AXInvalidStatusChanged: 168 227 atk_object_notify_state_change(axObject, ATK_STATE_INVALID_ENTRY, coreObject->invalidStatus() != "false"); 228 break; 229 230 default: 231 break; 232 } 169 233 } 170 234 -
trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm
r149255 r160417 38 38 namespace WebCore { 39 39 40 void AXObjectCache::detachWrapper(AccessibilityObject* obj )40 void AXObjectCache::detachWrapper(AccessibilityObject* obj, DetachmentType) 41 41 { 42 42 [obj->wrapper() detach]; -
trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
r156698 r160417 44 44 namespace WebCore { 45 45 46 void AXObjectCache::detachWrapper(AccessibilityObject* obj )46 void AXObjectCache::detachWrapper(AccessibilityObject* obj, DetachmentType) 47 47 { 48 48 [obj->wrapper() detach]; -
trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp
r154877 r160417 43 43 namespace WebCore { 44 44 45 void AXObjectCache::detachWrapper(AccessibilityObject* obj )45 void AXObjectCache::detachWrapper(AccessibilityObject* obj, DetachmentType) 46 46 { 47 47 // On Windows, AccessibilityObjects are created when get_accChildCount is -
trunk/Tools/ChangeLog
r160414 r160417 1 2013-12-11 Mario Sanchez Prada <mario.prada@samsung.com> 2 3 Programmatically-inserted children lack accessibility events 4 https://bugs.webkit.org/show_bug.cgi?id=100275 5 6 Reviewed by Chris Fleizach. 7 8 Update DRT and WebKitTestRunner to handle the children-changed 9 signal properly, considering the detail and optional parameters. 10 11 * DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp: Updated. 12 (axObjectEventListener): 13 * WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp: Updated. 14 1 15 2013-12-03 Mark Rowe <mrowe@apple.com> 2 16 -
trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp
r157631 r160417 114 114 notificationName = "AXFocusedUIElementChanged"; 115 115 } else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) { 116 signalName.set(g_strdup("children-changed")); 116 const gchar* childrenChangedDetail = g_quark_to_string(signalHint->detail); 117 signalName.set(g_strdup_printf("children-changed:%s", childrenChangedDetail)); 117 118 signalValue.set(g_strdup_printf("%d", g_value_get_uint(¶mValues[1]))); 119 notificationName = !g_strcmp0(childrenChangedDetail, "add") ? "AXChildrenAdded" : "AXChildrenRemoved"; 118 120 } else if (!g_strcmp0(signalQuery.signal_name, "property-change")) { 119 121 signalName.set(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail))); -
trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityNotificationHandlerAtk.cpp
r159287 r160417 103 103 notificationName = "AXFocusedUIElementChanged"; 104 104 } else if (!g_strcmp0(signalQuery.signal_name, "children-changed")) { 105 signalName.set(g_strdup("children-changed")); 105 const gchar* childrenChangedDetail = g_quark_to_string(signalHint->detail); 106 signalName.set(g_strdup_printf("children-changed:%s", childrenChangedDetail)); 106 107 signalValue.set(g_strdup_printf("%d", g_value_get_uint(¶mValues[1]))); 108 notificationName = !g_strcmp0(childrenChangedDetail, "add") ? "AXChildrenAdded" : "AXChildrenRemoved"; 107 109 } else if (!g_strcmp0(signalQuery.signal_name, "property-change")) { 108 110 signalName.set(g_strdup_printf("property-change:%s", g_quark_to_string(signalHint->detail)));
Note: See TracChangeset
for help on using the changeset viewer.