Changeset 91132 in webkit
- Timestamp:
- Jul 15, 2011 4:55:31 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r91128 r91132 1 2011-07-13 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Focus and selection events are not fired when a <select>'s selection 4 changes 5 https://bugs.webkit.org/show_bug.cgi?id=64504 6 <rdar://problem/9319881> 7 8 Reviewed by Alice Liu. 9 10 * platform/win/accessibility/option-element-selection-and-focus-events-expected.txt: Added. 11 * platform/win/accessibility/option-element-selection-and-focus-events.html: Added. 12 1 13 2011-07-12 Jon Honeycutt <jhoneycutt@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r91129 r91132 1 2011-07-13 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Focus and selection events are not fired when a <select>'s selection 4 changes 5 https://bugs.webkit.org/show_bug.cgi?id=64504 6 <rdar://problem/9319881> 7 8 Reviewed by Alice Liu. 9 10 Test: platform/win/accessibility/option-element-selection-and-focus-events.html 11 12 * accessibility/chromium/AXObjectCacheChromium.cpp: 13 (WebCore::AXObjectCache::postPlatformNotification): 14 Add new notification type to the section of unhandled notifications. 15 16 * accessibility/AXObjectCache.h: 17 Declare a new notification, AXMenuListItemSelected. 18 19 * accessibility/AccessibilityMenuList.cpp: 20 (WebCore::AccessibilityMenuList::didUpdateActiveOption): 21 Tell our child popup that the active option changed, and post a 22 notification that our value changed. 23 24 * accessibility/AccessibilityMenuList.h: 25 Declare didUpdateActiveOption(). 26 27 * accessibility/AccessibilityMenuListPopup.cpp: 28 (WebCore::AccessibilityMenuListPopup::didUpdateActiveOption): 29 Get the child <option> element that is selected, and fire focus and 30 selection events for it. 31 32 * accessibility/AccessibilityMenuListPopup.h: 33 Declare didUpdateActiveOption(). 34 35 * accessibility/win/AXObjectCacheWin.cpp: 36 (WebCore::AXObjectCache::postPlatformNotification): 37 Map AXMenuListItemSelected -> EVENT_OBJECT_SELECTION. 38 39 * dom/SelectElement.cpp: 40 (WebCore::SelectElement::setSelectedIndex): 41 Pass the newly-selected index. 42 43 * rendering/RenderMenuList.cpp: 44 (WebCore::RenderMenuList::RenderMenuList): 45 Update the initialization list for the renamed m_lastActiveIndex. 46 (WebCore::RenderMenuList::setTextFromOption): 47 A new selection has been made in the popup; call 48 didUpdateActiveOption(). 49 (WebCore::RenderMenuList::didSetSelectedIndex): 50 Call didUpdateActiveOption(), passing the index of the newly-selected 51 <option>. 52 (WebCore::RenderMenuList::didUpdateActiveOption): 53 If accessibility is disabled, or if the active option has not changed, 54 return early. Check whether the option index is in the range of list 55 items, and assert that the item at that index is an <option> element. 56 Tell the AccessibilityMenuList for this element that we updated the 57 active option. 58 59 * rendering/RenderMenuList.h: 60 Updated the declaration of didSetSelectedIndex() to take the selected 61 index. Declared didUpdateActiveOption(). Renamed m_lastSelectedIndex to 62 m_lastActiveIndex. 63 1 64 2011-07-13 Jon Honeycutt <jhoneycutt@apple.com> 2 65 -
trunk/Source/WebCore/accessibility/AXObjectCache.h
r89609 r91132 130 130 AXScrolledToAnchor, 131 131 AXLiveRegionChanged, 132 AXMenuListItemSelected, 132 133 AXMenuListValueChanged, 133 134 AXRowCountChanged, -
trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp
r89609 r91132 83 83 } 84 84 85 void AccessibilityMenuList::didUpdateActiveOption(int optionIndex) 86 { 87 const AccessibilityChildrenVector& childObjects = children(); 88 if (childObjects.isEmpty()) 89 return; 90 91 ASSERT(childObjects.size() == 1); 92 ASSERT(childObjects[0]->isMenuListPopup()); 93 94 RefPtr<Document> document = m_renderer->document(); 95 AXObjectCache* cache = document->axObjectCache(); 96 97 if (AccessibilityMenuListPopup* popup = static_cast<AccessibilityMenuListPopup*>(childObjects[0].get())) 98 popup->didUpdateActiveOption(optionIndex); 99 100 cache->postNotification(this, document.get(), AXObjectCache::AXMenuListValueChanged, true, PostSynchronously); 101 } 102 85 103 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AccessibilityMenuList.h
r89609 r91132 43 43 virtual bool press() const; 44 44 45 void didUpdateActiveOption(int optionIndex); 46 45 47 private: 46 48 AccessibilityMenuList(RenderMenuList*); -
trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
r91128 r91132 124 124 } 125 125 126 void AccessibilityMenuListPopup::didUpdateActiveOption(int optionIndex) 127 { 128 ASSERT_ARG(optionIndex, optionIndex >= 0); 129 ASSERT_ARG(optionIndex, optionIndex < m_children.size()); 130 131 RefPtr<Document> document = m_menuList->renderer()->document(); 132 AXObjectCache* cache = document->axObjectCache(); 133 RefPtr<AccessibilityObject> child = m_children[optionIndex].get(); 134 135 cache->postNotification(child.get(), document.get(), AXObjectCache::AXFocusedUIElementChanged, true, PostSynchronously); 136 cache->postNotification(child.get(), document.get(), AXObjectCache::AXMenuListItemSelected, true, PostSynchronously); 137 } 138 126 139 } // namespace WebCore -
trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.h
r89609 r91132 34 34 class AccessibilityMenuListOption; 35 35 class HTMLElement; 36 class HTMLSelectElement; 36 37 37 38 class AccessibilityMenuListPopup : public AccessibilityObject { … … 43 44 virtual bool isEnabled() const; 44 45 virtual bool isOffScreen() const; 46 47 void didUpdateActiveOption(int optionIndex); 45 48 46 49 private: -
trunk/Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp
r86451 r91132 88 88 case AXLiveRegionChanged: 89 89 case AXLoadComplete: 90 case AXMenuListItemSelected: 90 91 case AXMenuListValueChanged: 91 92 case AXRowCollapsed: -
trunk/Source/WebCore/accessibility/win/AXObjectCacheWin.cpp
r68078 r91132 89 89 break; 90 90 91 case AXMenuListItemSelected: 92 msaaEvent = EVENT_OBJECT_SELECTION; 93 break; 94 91 95 default: 92 96 return; -
trunk/Source/WebCore/dom/SelectElement.cpp
r91129 r91132 391 391 if (renderer) { 392 392 if (data.usesMenuList()) 393 toRenderMenuList(renderer)->didSetSelectedIndex( );393 toRenderMenuList(renderer)->didSetSelectedIndex(listIndex); 394 394 else if (renderer->isListBox()) 395 395 toRenderListBox(renderer)->selectionChanged(); -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r90069 r91132 27 27 28 28 #include "AXObjectCache.h" 29 #include "AccessibilityMenuList.h" 29 30 #include "CSSFontSelector.h" 30 31 #include "CSSStyleSelector.h" … … 58 59 , m_optionsChanged(true) 59 60 , m_optionsWidth(0) 60 , m_last SelectedIndex(-1)61 , m_lastActiveIndex(-1) 61 62 , m_popupIsVisible(false) 62 63 { … … 205 206 206 207 setText(text.stripWhiteSpace()); 208 didUpdateActiveOption(optionIndex); 207 209 } 208 210 … … 339 341 #endif 340 342 341 void RenderMenuList::didSetSelectedIndex() 342 { 343 int index = selectedIndex(); 344 if (m_lastSelectedIndex == index) 345 return; 346 347 m_lastSelectedIndex = index; 348 349 if (AXObjectCache::accessibilityEnabled()) 350 document()->axObjectCache()->postNotification(this, AXObjectCache::AXMenuListValueChanged, true, PostSynchronously); 343 void RenderMenuList::didSetSelectedIndex(int listIndex) 344 { 345 SelectElement* select = toSelectElement(static_cast<Element*>(node())); 346 didUpdateActiveOption(select->listToOptionIndex(listIndex)); 347 } 348 349 void RenderMenuList::didUpdateActiveOption(int optionIndex) 350 { 351 if (!AXObjectCache::accessibilityEnabled()) 352 return; 353 354 if (m_lastActiveIndex == optionIndex) 355 return; 356 m_lastActiveIndex = optionIndex; 357 358 SelectElement* select = toSelectElement(static_cast<Element*>(node())); 359 if (optionIndex < 0 || optionIndex > static_cast<int>(select->listItems().size())) 360 return; 361 362 ASSERT(toOptionElement(select->listItems()[optionIndex])); 363 364 if (AccessibilityMenuList* menuList = static_cast<AccessibilityMenuList*>(document()->axObjectCache()->get(this))) 365 menuList->didUpdateActiveOption(optionIndex); 351 366 } 352 367 -
trunk/Source/WebCore/rendering/RenderMenuList.h
r88952 r91132 56 56 void setOptionsChanged(bool changed) { m_optionsChanged = changed; } 57 57 58 void didSetSelectedIndex( );58 void didSetSelectedIndex(int listIndex); 59 59 60 60 String text() const; … … 125 125 void updateOptionsWidth(); 126 126 127 void didUpdateActiveOption(int optionIndex); 128 127 129 RenderText* m_buttonText; 128 130 RenderBlock* m_innerBlock; … … 131 133 int m_optionsWidth; 132 134 133 int m_last SelectedIndex;135 int m_lastActiveIndex; 134 136 135 137 RefPtr<RenderStyle> m_optionStyle; -
trunk/Tools/ChangeLog
r91124 r91132 1 2011-07-13 Jon Honeycutt <jhoneycutt@apple.com> 2 3 Focus and selection events are not fired when a <select>'s selection 4 changes 5 https://bugs.webkit.org/show_bug.cgi?id=64504 6 <rdar://problem/9319881> 7 8 Reviewed by Alice Liu. 9 10 * DumpRenderTree/AccessibilityController.h: 11 Added m_notificationsEventHook for addNotificationListener(). 12 m_allEventsHook will now be used for setLogAccessibilityEvents(). 13 14 * DumpRenderTree/win/AccessibilityControllerWin.cpp: 15 (AccessibilityController::AccessibilityController): 16 Initialize m_notificationsEventHook. 17 (AccessibilityController::~AccessibilityController): 18 Turn off logging of all accessibility events. If 19 m_notificationsEventHook is non-null, unhook it. 20 (logEventProc): 21 Add handling of EVENT_OBJECT_SELECTION. 22 (AccessibilityController::setLogAccessibilityEvents): 23 If the state of logging is not changing, return early. If we're turning 24 off logging, unhook m_allEventsHook, and zero it out. Otherwise, add a 25 hook for all events. 26 (AccessibilityController::addNotificationListener): 27 Use m_notificationsEventHook rather than m_allEventsHook. 28 1 29 2011-07-15 Dimitri Glazkov <dglazkov@chromium.org> 2 30 -
trunk/Tools/DumpRenderTree/AccessibilityController.h
r78179 r91132 67 67 68 68 HWINEVENTHOOK m_allEventsHook; 69 HWINEVENTHOOK m_notificationsEventHook; 69 70 HashMap<PlatformUIElement, JSObjectRef> m_notificationListeners; 70 71 #endif -
trunk/Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp
r78179 r91132 45 45 , m_valueChangeEventHook(0) 46 46 , m_allEventsHook(0) 47 , m_notificationsEventHook(0) 47 48 { 48 49 } … … 51 52 { 52 53 setLogFocusEvents(false); 54 setLogAccessibilityEvents(false); 53 55 setLogValueChangeEvents(false); 54 56 55 if (m_ allEventsHook)56 UnhookWinEvent(m_ allEventsHook);57 if (m_notificationsEventHook) 58 UnhookWinEvent(m_notificationsEventHook); 57 59 58 60 for (HashMap<PlatformUIElement, JSObjectRef>::iterator it = m_notificationListeners.begin(); it != m_notificationListeners.end(); ++it) … … 131 133 break; 132 134 135 case EVENT_OBJECT_SELECTION: 136 printf("Received selection event for object '%S'.\n", name.c_str()); 137 break; 138 133 139 case EVENT_OBJECT_VALUECHANGE: { 134 140 BSTR valueBSTR; … … 214 220 } 215 221 216 void AccessibilityController::setLogAccessibilityEvents(bool) 217 { 222 void AccessibilityController::setLogAccessibilityEvents(bool logAccessibilityEvents) 223 { 224 if (!!m_allEventsHook == logAccessibilityEvents) 225 return; 226 227 if (!logAccessibilityEvents) { 228 UnhookWinEvent(m_allEventsHook); 229 m_allEventsHook = 0; 230 return; 231 } 232 233 // Ensure that accessibility is initialized for the WebView by querying for 234 // the root accessible object. 235 rootElement(); 236 237 m_allEventsHook = SetWinEventHook(EVENT_MIN, EVENT_MAX, GetModuleHandle(0), logEventProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); 238 239 ASSERT(m_allEventsHook); 218 240 } 219 241 … … 292 314 void AccessibilityController::addNotificationListener(PlatformUIElement element, JSObjectRef functionCallback) 293 315 { 294 if (!m_ allEventsHook)295 m_ allEventsHook = SetWinEventHook(EVENT_MIN, EVENT_MAX, GetModuleHandle(0), notificationListenerProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT);316 if (!m_notificationsEventHook) 317 m_notificationsEventHook = SetWinEventHook(EVENT_MIN, EVENT_MAX, GetModuleHandle(0), notificationListenerProc, GetCurrentProcessId(), 0, WINEVENT_INCONTEXT); 296 318 297 319 JSValueProtect(frame->globalContext(), functionCallback);
Note: See TracChangeset
for help on using the changeset viewer.