Changeset 160903 in webkit
- Timestamp:
- Dec 20, 2013 3:52:17 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r160896 r160903 1 2013-12-20 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-19 Ryosuke Niwa <rniwa@webkit.org> 2 22 -
trunk/LayoutTests/accessibility/loading-iframe-sends-notification.html
r160485 r160903 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
r160840 r160903 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
r160901 r160903 1 2013-12-20 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: 15 (WebCore::AXObjectCache::detachWrapper): Added a new parameter and 16 updated all the prototypes in different ports. 17 * accessibility/AXObjectCache.cpp: 18 (WebCore::AXObjectCache::~AXObjectCache): Call detachWrapper() 19 specifying that we do it because the cache is being destroyed. 20 (WebCore::AXObjectCache::remove): Call detachWrapper() specifying 21 that we do it because an accessible element is being destroyed. 22 23 * accessibility/atk/AXObjectCacheAtk.cpp: 24 (WebCore::AXObjectCache::detachWrapper): Emit the children-changed 25 signal when needed. We rely on the cached reference to the parent 26 AtkObject (using the implementation of atk_object_get_parent from 27 the AtkObject class) to find the right object to emit the signal 28 from here, since the accessibility hierarchy from WebCore will no 29 longer be accessible at this point. 30 (WebCore::AXObjectCache::attachWrapper): Emit the children-change 31 signal from here unless we are in the middle of a layout update, 32 trying to provide as much information (e.g. the offset) as possible. 33 (WebCore::AXObjectCache::postPlatformNotification): Make sure we 34 update (touch) the subtree under an accessibility object whenever 35 we receive AXChildrenChanded from WebCore, to ensure that those 36 objects will also be visible rightaway to ATs, and that those get 37 properly notified of the event at that very same moment. 38 39 * accessibility/ios/AXObjectCacheIOS.mm: 40 (WebCore::AXObjectCache::detachWrapper): Updated function signature. 41 * accessibility/mac/AXObjectCacheMac.mm: 42 (WebCore::AXObjectCache::detachWrapper): Ditto. 43 * accessibility/win/AXObjectCacheWin.cpp: 44 (WebCore::AXObjectCache::detachWrapper): Ditto. 45 46 * accessibility/AccessibilityObject.cpp: 47 (WebCore::AccessibilityObject::children): Add the option ot 48 request the AccessibilityChildrenVector without updating it if 49 needed, to avoid maybe recreating the child subtree when trying to 50 get the offset of a newly attached element from attachWrapper. 51 * accessibility/AccessibilityObject.h: 52 1 53 2013-12-20 Laszlo Vidacs <lvidacs.u-szeged@partner.samsung.com> 2 54 -
trunk/Source/WebCore/accessibility/AXObjectCache.cpp
r160789 r160903 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(CacheDestroyed); 126 126 removeAXID(obj); … … 494 494 return; 495 495 496 detachWrapper(obj );496 detachWrapper(obj, ElementDestroyed); 497 497 obj->detach(ElementDestroyed, this); 498 498 removeAXID(obj); -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r160778 r160903 103 103 void remove(AXID); 104 104 105 void detachWrapper(AccessibilityObject* );105 void detachWrapper(AccessibilityObject*, AccessibilityDetachmentType); 106 106 void attachWrapper(AccessibilityObject*); 107 107 void childrenChanged(Node*); … … 288 288 inline void AXObjectCache::textChanged(AccessibilityObject*) { } 289 289 inline void AXObjectCache::updateCacheAfterNodeIsAttached(Node*) { } 290 inline void AXObjectCache::detachWrapper(AccessibilityObject* ) { }290 inline void AXObjectCache::detachWrapper(AccessibilityObject*, AccessibilityDetachmentType) { } 291 291 inline void AXObjectCache::frameLoadingEventNotification(Frame*, AXLoadingEvent) { } 292 292 inline void AXObjectCache::frameLoadingEventPlatformNotification(AccessibilityObject*, AXLoadingEvent) { } -
trunk/Source/WebCore/accessibility/AccessibilityObject.cpp
r160778 r160903 1264 1264 1265 1265 #if HAVE(ACCESSIBILITY) 1266 const AccessibilityObject::AccessibilityChildrenVector& AccessibilityObject::children() 1267 { 1268 updateChildrenIfNecessary(); 1266 const AccessibilityObject::AccessibilityChildrenVector& AccessibilityObject::children(bool updateChildrenIfNeeded) 1267 { 1268 if (updateChildrenIfNeeded) 1269 updateChildrenIfNecessary(); 1269 1270 1270 1271 return m_children; -
trunk/Source/WebCore/accessibility/AccessibilityObject.h
r160778 r160903 692 692 virtual void textChanged() { } 693 693 virtual void updateAccessibilityRole() { } 694 const AccessibilityChildrenVector& children( );694 const AccessibilityChildrenVector& children(bool updateChildrenIfNeeded = true); 695 695 virtual void addChildren() { } 696 696 virtual void addChild(AccessibilityObject*) { } -
trunk/Source/WebCore/accessibility/atk/AXObjectCacheAtk.cpp
r160485 r160903 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, AccessibilityDetachmentType 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->wrapper(); 86 if (!atkParent) 87 return; 88 89 size_t index = coreParent->children(false).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 { 200 int numOfChildren = atk_object_get_n_accessible_children(axObject); 201 for (int i = 0; i < numOfChildren; ++i) 202 GRefPtr<AtkObject> child(atk_object_ref_accessible_child(axObject, i)); 203 } 204 break; 205 206 case AXSelectedChildrenChanged: 207 case AXMenuListValueChanged: 151 208 if (notification == AXMenuListValueChanged && coreObject->isMenuList()) { 152 209 g_signal_emit_by_name(axObject, "focus-event", true); … … 154 211 } 155 212 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) 213 break; 214 215 case AXValueChanged: 216 if (ATK_IS_VALUE(axObject)) { 217 AtkPropertyValues propertyValues; 218 propertyValues.property_name = "accessible-value"; 219 220 memset(&propertyValues.new_value, 0, sizeof(GValue)); 221 atk_value_get_current_value(ATK_VALUE(axObject), &propertyValues.new_value); 222 223 g_signal_emit_by_name(ATK_OBJECT(axObject), "property-change::accessible-value", &propertyValues, NULL); 224 } 225 break; 226 227 case AXInvalidStatusChanged: 168 228 atk_object_notify_state_change(axObject, ATK_STATE_INVALID_ENTRY, coreObject->invalidStatus() != "false"); 229 break; 230 231 default: 232 break; 233 } 169 234 } 170 235 -
trunk/Source/WebCore/accessibility/ios/AXObjectCacheIOS.mm
r160485 r160903 38 38 namespace WebCore { 39 39 40 void AXObjectCache::detachWrapper(AccessibilityObject* obj )40 void AXObjectCache::detachWrapper(AccessibilityObject* obj, AccessibilityDetachmentType) 41 41 { 42 42 [obj->wrapper() detach]; -
trunk/Source/WebCore/accessibility/mac/AXObjectCacheMac.mm
r160778 r160903 44 44 namespace WebCore { 45 45 46 void AXObjectCache::detachWrapper(AccessibilityObject* obj )46 void AXObjectCache::detachWrapper(AccessibilityObject* obj, AccessibilityDetachmentType) 47 47 { 48 48 [obj->wrapper() detach]; -
trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp
r160485 r160903 43 43 namespace WebCore { 44 44 45 void AXObjectCache::detachWrapper(AccessibilityObject* obj )45 void AXObjectCache::detachWrapper(AccessibilityObject* obj, AccessibilityDetachmentType) 46 46 { 47 47 // On Windows, AccessibilityObjects are created when get_accChildCount is -
trunk/Tools/ChangeLog
r160902 r160903 1 2013-12-20 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-20 Peter Molnar <pmolnar.u-szeged@partner.samsung.com> 2 16 -
trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp
r160485 r160903 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
r160485 r160903 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.