Focus and selection events are not fired when a <select>'s selection
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 23:16:31 +0000 (23:16 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jul 2011 23:16:31 +0000 (23:16 +0000)
commit8ad60fb8b094c7f144231bb9efaafbe6f874c4fb
tree315369826afcadad44f7983a696623e2d24439f6
parent99d0da527568e341f15a1c591d1db6696416fc87
Focus and selection events are not fired when a <select>'s selection
changes
https://bugs.webkit.org/show_bug.cgi?id=64504
<rdar://problem/9319881>

Reviewed by Alice Liu.

Source/WebCore:

Test: platform/win/accessibility/option-element-selection-and-focus-events.html

* accessibility/chromium/AXObjectCacheChromium.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
Add new notification type to the section of unhandled notifications.

* accessibility/AXObjectCache.h:
Declare a new notification, AXMenuListItemSelected.

* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::didUpdateActiveOption):
Tell our child popup that the active option changed, and post a
notification that our value changed.

* accessibility/AccessibilityMenuList.h:
Declare didUpdateActiveOption().

* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::didUpdateActiveOption):
Get the child <option> element that is selected, and fire focus and
selection events for it.

* accessibility/AccessibilityMenuListPopup.h:
Declare didUpdateActiveOption().

* accessibility/win/AXObjectCacheWin.cpp:
(WebCore::AXObjectCache::postPlatformNotification):
Map AXMenuListItemSelected -> EVENT_OBJECT_SELECTION.

* dom/SelectElement.cpp:
(WebCore::SelectElement::setSelectedIndex):
Pass the newly-selected index.

* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::RenderMenuList):
Update the initialization list for the renamed m_lastActiveIndex.
(WebCore::RenderMenuList::setTextFromOption):
A new selection has been made in the popup; call
didUpdateActiveOption().
(WebCore::RenderMenuList::didSetSelectedIndex):
Call didUpdateActiveOption(), passing the index of the newly-selected
<option>.
(WebCore::RenderMenuList::didUpdateActiveOption):
If accessibility is disabled, or if the active option has not changed,
return early. Check whether the option index is in the range of list
items, and assert that the item at that index is an <option> element.
Tell the AccessibilityMenuList for this element that we updated the
active option.

* rendering/RenderMenuList.h:
Updated the declaration of didSetSelectedIndex() to take the selected
index. Declared didUpdateActiveOption(). Renamed m_lastSelectedIndex to
m_lastActiveIndex.

Tools:

* DumpRenderTree/AccessibilityController.h:
Added m_notificationsEventHook for addNotificationListener().
m_allEventsHook will now be used for setLogAccessibilityEvents().

* DumpRenderTree/win/AccessibilityControllerWin.cpp:
(AccessibilityController::AccessibilityController):
Initialize m_notificationsEventHook.
(AccessibilityController::~AccessibilityController):
Turn off logging of all accessibility events. If
m_notificationsEventHook is non-null, unhook it.
(logEventProc):
Add handling of EVENT_OBJECT_SELECTION.
(AccessibilityController::setLogAccessibilityEvents):
If the state of logging is not changing, return early. If we're turning
off logging, unhook m_allEventsHook, and zero it out. Otherwise, add a
hook for all events.
(AccessibilityController::addNotificationListener):
Use m_notificationsEventHook rather than m_allEventsHook.

LayoutTests:

* platform/win/accessibility/option-element-selection-and-focus-events-expected.txt: Added.
* platform/win/accessibility/option-element-selection-and-focus-events.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/win/accessibility/option-element-selection-and-focus-events-expected.txt [new file with mode: 0644]
LayoutTests/platform/win/accessibility/option-element-selection-and-focus-events.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AXObjectCache.h
Source/WebCore/accessibility/AccessibilityMenuList.cpp
Source/WebCore/accessibility/AccessibilityMenuList.h
Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp
Source/WebCore/accessibility/AccessibilityMenuListPopup.h
Source/WebCore/accessibility/chromium/AXObjectCacheChromium.cpp
Source/WebCore/accessibility/win/AXObjectCacheWin.cpp
Source/WebCore/dom/SelectElement.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderMenuList.h
Tools/ChangeLog
Tools/DumpRenderTree/AccessibilityController.h
Tools/DumpRenderTree/win/AccessibilityControllerWin.cpp