Changeset 154697 in webkit
- Timestamp:
- Aug 27, 2013 10:16:03 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r154687 r154697 1 2013-08-27 Denis Nomiyama <d.nomiyama@samsung.com> 2 3 [GTK] Missing DRT AccessibilityUIElement::addNotificationListener implementation 4 https://bugs.webkit.org/show_bug.cgi?id=119883 5 6 Unskipped the checkbox notification test in a11y and added the expected results. 7 8 Reviewed by Chris Fleizach. 9 10 * platform/gtk/TestExpectations: Unskipped the checkbox notification test in a11y. 11 * platform/gtk/accessibility/aria-checkbox-sends-notification-expected.txt: Added. 12 1 13 2013-08-27 Ádám Kallai <kadam@inf.u-szeged.hu> 2 14 -
trunk/LayoutTests/platform/gtk/TestExpectations
r154477 r154697 783 783 webkit.org/b/98350 accessibility/aria-invalid.html [ Timeout ] 784 784 785 # Missing DRT AccessibilityController::addNotificationListener implementation786 webkit.org/b/70606 accessibility/aria-checkbox-sends-notification.html [ Timeout ]787 788 785 Bug(GTK) media/progress-events-generated-correctly.html [ Failure Timeout ] 789 786 -
trunk/Tools/ChangeLog
r154668 r154697 1 2013-08-27 Denis Nomiyama <d.nomiyama@samsung.com> 2 3 [GTK] Missing DRT AccessibilityUIElement::addNotificationListener implementation 4 https://bugs.webkit.org/show_bug.cgi?id=119883 5 6 Implemented the notification listener for AccessibilityUIElement. The signal is generated 7 by AXObjectCache::postPlatformNotification() and received by axObjectEventListener(). 8 axObjectEventListener will then invoke JSObjectCallAsFunction() with the respective 9 callback function. The global callback function and callbacks for specific elements are 10 stored in a HashMap in AccessibilityCallbacksAtk.cpp. 11 12 Reviewed by Chris Fleizach. 13 14 * DumpRenderTree/AccessibilityUIElement.h: Added a notification handler for GTK+ 15 * DumpRenderTree/atk/AccessibilityCallbacks.h: Added addAccessibilityNotificationListener() 16 and removeAccessibilityNotificationListener() 17 * DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp: 18 (axObjectEventListener): Call JS callback for global notification or for a specific element 19 (disconnectAccessibilityCallbacks): Only disconnect if logging is off and there is no 20 notification handler 21 (addAccessibilityNotificationHandler): Add notification listener to the list 22 (removeAccessibilityNotificationHandler): Remove notification listener from the list 23 * DumpRenderTree/atk/AccessibilityControllerAtk.cpp: 24 (AccessibilityController::setLogAccessibilityEvents): Set logging off before disconnecting 25 * DumpRenderTree/atk/AccessibilityNotificationHandlerAtk.cpp: Added. 26 (AccessibilityNotificationHandler::AccessibilityNotificationHandler): Create handler 27 (AccessibilityNotificationHandler::~AccessibilityNotificationHandler): Destroy handler. 28 Remove handler from the list and disconnect callbacks 29 (AccessibilityNotificationHandler::setNotificationFunctionCallback): Set the notification 30 callback and connect callbacks to signals 31 * DumpRenderTree/atk/AccessibilityNotificationHandlerAtk.h: Added. 32 (AccessibilityNotificationHandler::setPlatformElement): Set platform element 33 (AccessibilityNotificationHandler::platformElement): Get platform element 34 (AccessibilityNotificationHandler::notificationFunctionCallback): Get notification callback 35 * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp: 36 (AccessibilityUIElement::addNotificationListener): Create notification handler, set the 37 platform element and the notification callback 38 (AccessibilityUIElement::removeNotificationListener): 39 * DumpRenderTree/efl/CMakeLists.txt: Added AccessibilityNotificationHandlerAtk.cpp/h 40 * GNUmakefile.am: Added AccessibilityNotificationHandlerAtk.cpp/h 41 1 42 2013-08-27 Carlos Garcia Campos <cgarcia@igalia.com> 2 43 -
trunk/Tools/DumpRenderTree/AccessibilityUIElement.h
r151179 r154697 47 47 typedef COMPtr<IAccessible> PlatformUIElement; 48 48 #elif HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL)) 49 #include "AccessibilityNotificationHandlerAtk.h" 49 50 #include <atk/atk.h> 50 51 typedef AtkObject* PlatformUIElement; … … 274 275 NotificationHandler m_notificationHandler; 275 276 #endif 277 278 #if PLATFORM(GTK) || PLATFORM(EFL) 279 RefPtr<AccessibilityNotificationHandler> m_notificationHandler; 280 #endif 276 281 }; 277 282 -
trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacks.h
r142451 r154697 30 30 #define AccessibilityCallbacks_h 31 31 32 #include "AccessibilityNotificationHandlerAtk.h" 33 #include "AccessibilityUIElement.h" 34 35 const PlatformUIElement GlobalNotificationKey = 0; 36 32 37 void connectAccessibilityCallbacks(); 33 38 void disconnectAccessibilityCallbacks(); 39 void addAccessibilityNotificationHandler(AccessibilityNotificationHandler*); 40 void removeAccessibilityNotificationHandler(AccessibilityNotificationHandler*); 34 41 35 42 #endif -
trunk/Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp
r142451 r154697 33 33 34 34 #include "AccessibilityController.h" 35 #include "AccessibilityNotificationHandlerAtk.h" 35 36 #include "DumpRenderTree.h" 37 #include "JSRetainPtr.h" 36 38 #include <atk/atk.h> 37 39 #include <wtf/gobject/GOwnPtr.h> … … 53 55 static guint propertyChangedListenerId = 0; 54 56 static guint visibleDataChangedListenerId = 0; 57 static HashMap<PlatformUIElement, AccessibilityNotificationHandler*> notificationHandlers; 58 59 extern bool loggingAccessibilityEvents; 55 60 56 61 static void printAccessibilityEvent(AtkObject* accessible, const gchar* signalName, const gchar* signalValue) … … 88 93 GOwnPtr<gchar> signalName; 89 94 GOwnPtr<gchar> signalValue; 95 String notificationName; 90 96 91 97 g_signal_query(signalHint->signal_id, &signalQuery); … … 94 100 signalName.set(g_strdup_printf("state-change:%s", g_value_get_string(¶mValues[1]))); 95 101 signalValue.set(g_strdup_printf("%d", g_value_get_boolean(¶mValues[2]))); 102 if (!g_strcmp0(g_value_get_string(¶mValues[1]), "checked")) 103 notificationName = "CheckedStateChanged"; 96 104 } else if (!g_strcmp0(signalQuery.signal_name, "focus-event")) { 97 105 signalName.set(g_strdup("focus-event")); … … 105 113 signalName.set(g_strdup(signalQuery.signal_name)); 106 114 107 printAccessibilityEvent(accessible, signalName.get(), signalValue.get()); 115 if (loggingAccessibilityEvents) 116 printAccessibilityEvent(accessible, signalName.get(), signalValue.get()); 117 118 #if PLATFORM(GTK) 119 JSGlobalContextRef jsContext = webkit_web_frame_get_global_context(mainFrame); 120 #else 121 JSContextRef jsContext = 0; 122 #endif 123 if (!jsContext) 124 return TRUE; 125 126 if (notificationName.length()) { 127 for (HashMap<PlatformUIElement, AccessibilityNotificationHandler*>::iterator it = notificationHandlers.begin(); it != notificationHandlers.end(); ++it) { 128 if (it->key == accessible || it->key == GlobalNotificationKey) { 129 JSRetainPtr<JSStringRef> jsNotificationEventName(Adopt, JSStringCreateWithUTF8CString(reinterpret_cast<const char*>(notificationName.utf8().data()))); 130 JSValueRef notificationNameArgument = JSValueMakeString(jsContext, jsNotificationEventName.get()); 131 AccessibilityNotificationHandler* notificationHandler = it->value; 132 if (notificationHandler->platformElement()) { 133 JSValueRef argument = notificationNameArgument; 134 // Listener for one element just gets one argument, the notification name. 135 JSObjectCallAsFunction(jsContext, notificationHandler->notificationFunctionCallback(), 0, 1, &argument, 0); 136 } else { 137 // A global listener gets the element and the notification name as arguments. 138 JSValueRef arguments[2]; 139 arguments[0] = AccessibilityUIElement::makeJSAccessibilityUIElement(jsContext, AccessibilityUIElement(accessible)); 140 arguments[1] = notificationNameArgument; 141 JSObjectCallAsFunction(jsContext, notificationHandler->notificationFunctionCallback(), 0, 2, arguments, 0); 142 } 143 } 144 } 145 } 108 146 109 147 return TRUE; … … 141 179 void disconnectAccessibilityCallbacks() 142 180 { 181 // Only disconnect if logging is off and there is no notification handler. 182 if (loggingAccessibilityEvents || !notificationHandlers.isEmpty()) 183 return; 184 143 185 // AtkObject signals. 144 186 if (stateChangeListenerId) { … … 168 210 } 169 211 170 #endif 212 void addAccessibilityNotificationHandler(AccessibilityNotificationHandler* notificationHandler) 213 { 214 if (!notificationHandler) 215 return; 216 217 #if PLATFORM(GTK) 218 JSGlobalContextRef jsContext = webkit_web_frame_get_global_context(mainFrame); 219 #else 220 JSContextRef jsContext = 0; 221 #endif 222 if (!jsContext) 223 return; 224 225 JSValueProtect(jsContext, notificationHandler->notificationFunctionCallback()); 226 // Check if this notification handler is related to a specific element. 227 if (notificationHandler->platformElement()) { 228 if (notificationHandlers.contains(notificationHandler->platformElement())) { 229 JSValueUnprotect(jsContext, notificationHandlers.find(notificationHandler->platformElement())->value->notificationFunctionCallback()); 230 notificationHandlers.remove(notificationHandler->platformElement()); 231 } 232 notificationHandlers.add(notificationHandler->platformElement(), notificationHandler); 233 } else { 234 if (notificationHandlers.contains(GlobalNotificationKey)) { 235 JSValueUnprotect(jsContext, notificationHandlers.find(GlobalNotificationKey)->value->notificationFunctionCallback()); 236 notificationHandlers.remove(GlobalNotificationKey); 237 } 238 notificationHandlers.add(GlobalNotificationKey, notificationHandler); 239 } 240 241 connectAccessibilityCallbacks(); 242 } 243 244 void removeAccessibilityNotificationHandler(AccessibilityNotificationHandler* notificationHandler) 245 { 246 if (!notificationHandler) 247 return; 248 249 #if PLATFORM(GTK) 250 JSGlobalContextRef jsContext = webkit_web_frame_get_global_context(mainFrame); 251 #else 252 JSGlobalContextRef jsContext = 0; 253 #endif 254 if (!jsContext) 255 return; 256 257 for (HashMap<PlatformUIElement, AccessibilityNotificationHandler*>::iterator it = notificationHandlers.begin(); it != notificationHandlers.end(); ++it) { 258 if (it->value == notificationHandler) { 259 JSValueUnprotect(jsContext, notificationHandler->notificationFunctionCallback()); 260 notificationHandlers.remove(it); 261 } 262 } 263 } 264 265 #endif -
trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp
r152397 r154697 36 36 #include <atk/atk.h> 37 37 38 staticbool loggingAccessibilityEvents = false;38 bool loggingAccessibilityEvents = false; 39 39 40 40 AccessibilityController::AccessibilityController() … … 71 71 72 72 if (!logAccessibilityEvents) { 73 loggingAccessibilityEvents = false; 73 74 disconnectAccessibilityCallbacks(); 74 loggingAccessibilityEvents = false;75 75 return; 76 76 } -
trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp
r153435 r154697 30 30 #if HAVE(ACCESSIBILITY) 31 31 32 #include "AccessibilityNotificationHandlerAtk.h" 32 33 #include <JavaScriptCore/JSStringRef.h> 33 34 #include <JavaScriptCore/OpaqueJSString.h> … … 1028 1029 bool AccessibilityUIElement::addNotificationListener(JSObjectRef functionCallback) 1029 1030 { 1030 // FIXME: implement 1031 return false; 1031 if (!functionCallback) 1032 return false; 1033 1034 // Only one notification listener per element. 1035 if (m_notificationHandler) 1036 return false; 1037 1038 m_notificationHandler = new AccessibilityNotificationHandler(); 1039 m_notificationHandler->setPlatformElement(platformUIElement()); 1040 m_notificationHandler->setNotificationFunctionCallback(functionCallback); 1041 1042 return true; 1032 1043 } 1033 1044 1034 1045 void AccessibilityUIElement::removeNotificationListener() 1035 1046 { 1036 // FIXME: implement 1047 // Programmers should not be trying to remove a listener that's already removed. 1048 ASSERT(m_notificationHandler); 1049 1050 m_notificationHandler = 0; 1037 1051 } 1038 1052 -
trunk/Tools/DumpRenderTree/efl/CMakeLists.txt
r151402 r154697 11 11 ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp 12 12 ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityControllerAtk.cpp 13 ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityNotificationHandlerAtk.cpp 13 14 ${TOOLS_DIR}/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp 14 15 ${TOOLS_DIR}/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp -
trunk/Tools/GNUmakefile.am
r153421 r154697 156 156 Tools/DumpRenderTree/atk/AccessibilityCallbacksAtk.cpp \ 157 157 Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp \ 158 Tools/DumpRenderTree/atk/AccessibilityNotificationHandlerAtk.cpp \ 159 Tools/DumpRenderTree/atk/AccessibilityNotificationHandlerAtk.h \ 158 160 Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp \ 159 161 Tools/DumpRenderTree/cairo/PixelDumpSupportCairo.cpp \
Note: See TracChangeset
for help on using the changeset viewer.