Commit 2d50f5cb authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Draw an accessibility focus ring around the focused object in ChromeVox Next.

BUG=314889

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

Cr-Commit-Position: refs/heads/master@{#296773}
parent 244b6032
...@@ -237,8 +237,8 @@ class TreeSerializationState { ...@@ -237,8 +237,8 @@ class TreeSerializationState {
routing_id); routing_id);
std::vector<content::AXEventNotificationDetails> details; std::vector<content::AXEventNotificationDetails> details;
details.push_back(detail); details.push_back(detail);
automation_util::DispatchAccessibilityEventsToAutomation(details, automation_util::DispatchAccessibilityEventsToAutomation(
browser_context); details, browser_context, gfx::Vector2d());
} }
// Notify the extension bindings to destroy the tree for the given tab // Notify the extension bindings to destroy the tree for the given tab
......
...@@ -76,7 +76,8 @@ class AutomationWebContentsObserver ...@@ -76,7 +76,8 @@ class AutomationWebContentsObserver
const std::vector<content::AXEventNotificationDetails>& details) const std::vector<content::AXEventNotificationDetails>& details)
OVERRIDE { OVERRIDE {
automation_util::DispatchAccessibilityEventsToAutomation( automation_util::DispatchAccessibilityEventsToAutomation(
details, browser_context_); details, browser_context_,
web_contents()->GetContainerBounds().OffsetFromOrigin());
} }
virtual void RenderFrameDeleted( virtual void RenderFrameDeleted(
......
...@@ -125,7 +125,8 @@ namespace automation_util { ...@@ -125,7 +125,8 @@ namespace automation_util {
void DispatchAccessibilityEventsToAutomation( void DispatchAccessibilityEventsToAutomation(
const std::vector<content::AXEventNotificationDetails>& details, const std::vector<content::AXEventNotificationDetails>& details,
content::BrowserContext* browser_context) { content::BrowserContext* browser_context,
const gfx::Vector2d& location_offset) {
using api::automation_internal::AXEventParams; using api::automation_internal::AXEventParams;
using api::automation_internal::AXTreeUpdate; using api::automation_internal::AXTreeUpdate;
...@@ -143,9 +144,11 @@ void DispatchAccessibilityEventsToAutomation( ...@@ -143,9 +144,11 @@ void DispatchAccessibilityEventsToAutomation(
AXTreeUpdate& ax_tree_update = ax_event_params.update; AXTreeUpdate& ax_tree_update = ax_event_params.update;
ax_tree_update.node_id_to_clear = event.node_id_to_clear; ax_tree_update.node_id_to_clear = event.node_id_to_clear;
for (size_t i = 0; i < event.nodes.size(); ++i) { for (size_t i = 0; i < event.nodes.size(); ++i) {
ui::AXNodeData src = event.nodes[i];
src.location.Offset(location_offset);
linked_ptr<api::automation_internal::AXNodeData> out_node( linked_ptr<api::automation_internal::AXNodeData> out_node(
new api::automation_internal::AXNodeData()); new api::automation_internal::AXNodeData());
PopulateNodeData(event.nodes[i], out_node); PopulateNodeData(src, out_node);
ax_tree_update.nodes.push_back(out_node); ax_tree_update.nodes.push_back(out_node);
} }
......
...@@ -27,7 +27,8 @@ namespace automation_util { ...@@ -27,7 +27,8 @@ namespace automation_util {
// from accessibility to Automation types. // from accessibility to Automation types.
void DispatchAccessibilityEventsToAutomation( void DispatchAccessibilityEventsToAutomation(
const std::vector<content::AXEventNotificationDetails>& details, const std::vector<content::AXEventNotificationDetails>& details,
content::BrowserContext* browser_context); content::BrowserContext* browser_context,
const gfx::Vector2d& location_offset);
void DispatchTreeDestroyedEventToAutomation( void DispatchTreeDestroyedEventToAutomation(
int process_id, int process_id,
......
...@@ -95,6 +95,7 @@ cvox2.Background.prototype = { ...@@ -95,6 +95,7 @@ cvox2.Background.prototype = {
var output = evt.target.attributes.name + ' ' + evt.target.role; var output = evt.target.attributes.name + ' ' + evt.target.role;
cvox.ChromeVox.tts.speak(output, cvox.AbstractTts.QUEUE_MODE_FLUSH); cvox.ChromeVox.tts.speak(output, cvox.AbstractTts.QUEUE_MODE_FLUSH);
cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(output)); cvox.ChromeVox.braille.write(cvox.NavBraille.fromText(output));
chrome.accessibilityPrivate.setFocusRing([evt.target.location]);
}, },
/** /**
......
...@@ -112,5 +112,5 @@ void AutomationManagerAsh::SendEvent(BrowserContext* context, ...@@ -112,5 +112,5 @@ void AutomationManagerAsh::SendEvent(BrowserContext* context,
std::vector<content::AXEventNotificationDetails> details; std::vector<content::AXEventNotificationDetails> details;
details.push_back(detail); details.push_back(detail);
extensions::automation_util::DispatchAccessibilityEventsToAutomation( extensions::automation_util::DispatchAccessibilityEventsToAutomation(
details, context); details, context, gfx::Vector2d());
} }
...@@ -7,8 +7,12 @@ var allTests = [ ...@@ -7,8 +7,12 @@ var allTests = [
function assertOkButtonLocation(event) { function assertOkButtonLocation(event) {
var okButton = rootNode.firstChild().firstChild(); var okButton = rootNode.firstChild().firstChild();
assertTrue('location' in okButton); assertTrue('location' in okButton);
assertEq({left:100, top: 200, width: 300, height: 400},
okButton.location); // We can't assert the left and top positions because they're
// returned in global screen coordinates. Just check the width and
// height.
assertEq(300, okButton.location.width);
assertEq(400, okButton.location.height);
chrome.test.succeed(); chrome.test.succeed();
}; };
......
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