Commit ffedad06 authored by dmazzoni@chromium.org's avatar dmazzoni@chromium.org

Fire accessible event on web area object when scrolling

Scroll events for the main document were accidentally removed in bug
371039 - this is a better way to restore them by firing them on the
web area, rather than the ScrollView/FrameView.

This brings back the "scroll" sounds on Android, and also makes Android
update the position of accessibility focus after scrolling.

BUG=371039, 374316, 414291

Review URL: https://codereview.chromium.org/662913002

git-svn-id: svn://svn.chromium.org/blink/trunk@184002 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 9e0d44d4
...@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS window.pageXOffset is 0 PASS window.pageXOffset is 0
Got notification on scroll area Got notification on web area
PASS window.pageXOffset is 500 PASS window.pageXOffset is 500
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -29,8 +29,8 @@ if (window.testRunner && window.accessibilityController) { ...@@ -29,8 +29,8 @@ if (window.testRunner && window.accessibilityController) {
shouldBe("window.pageXOffset", "0"); shouldBe("window.pageXOffset", "0");
accessibilityController.addNotificationListener(function (target, notification) { accessibilityController.addNotificationListener(function (target, notification) {
if (target.role == 'AXRole: AXScrollArea') { if (target.role == 'AXRole: AXWebArea' && notification == 'ScrollPositionChanged') {
debug('Got notification on scroll area'); debug('Got notification on web area');
accessibilityController.removeNotificationListener(); accessibilityController.removeNotificationListener();
shouldBe("window.pageXOffset", "500"); shouldBe("window.pageXOffset", "500");
finishJSTest(); finishJSTest();
......
...@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -7,7 +7,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS window.pageYOffset is 0 PASS window.pageYOffset is 0
Got notification on scroll area Got notification on web area
PASS window.pageYOffset is 500 PASS window.pageYOffset is 500
PASS successfullyParsed is true PASS successfullyParsed is true
......
...@@ -29,8 +29,8 @@ if (window.testRunner && window.accessibilityController) { ...@@ -29,8 +29,8 @@ if (window.testRunner && window.accessibilityController) {
shouldBe("window.pageYOffset", "0"); shouldBe("window.pageYOffset", "0");
accessibilityController.addNotificationListener(function (target, notification) { accessibilityController.addNotificationListener(function (target, notification) {
if (target.role == 'AXRole: AXScrollArea') { if (target.role == 'AXRole: AXWebArea' && notification == 'ScrollPositionChanged') {
debug('Got notification on scroll area'); debug('Got notification on web area');
accessibilityController.removeNotificationListener(); accessibilityController.removeNotificationListener();
shouldBe("window.pageYOffset", "500"); shouldBe("window.pageYOffset", "500");
finishJSTest(); finishJSTest();
......
...@@ -1036,9 +1036,13 @@ void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode) ...@@ -1036,9 +1036,13 @@ void AXObjectCache::handleScrolledToAnchor(const Node* anchorNode)
postPlatformNotification(AXObject::firstAccessibleObjectFromNode(anchorNode), AXScrolledToAnchor); postPlatformNotification(AXObject::firstAccessibleObjectFromNode(anchorNode), AXScrolledToAnchor);
} }
void AXObjectCache::handleScrollPositionChanged(FrameView* scrollView) void AXObjectCache::handleScrollPositionChanged(FrameView* frameView)
{ {
postPlatformNotification(getOrCreate(scrollView), AXScrollPositionChanged); // Prefer to fire the scroll position changed event on the frame view's child web area, if possible.
AXObject* targetAXObject = getOrCreate(frameView);
if (targetAXObject && !targetAXObject->children().isEmpty())
targetAXObject = targetAXObject->children()[0].get();
postPlatformNotification(targetAXObject, AXScrollPositionChanged);
} }
void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject) void AXObjectCache::handleScrollPositionChanged(RenderObject* renderObject)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment