Commit e7a54b0e authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Chromium LUCI CQ

views: implement RootView::AnnounceText for Mac

This change has RootView::AnnounceText (which is what the other Views
methods to announce text use) call the platform API on Mac, via
AXPlatformNode.

To test this, build `views_examples_with_content` and press the button
on the "Accessibility Features" page - you should hear and see VoiceOver
announce "Button pressed".

Bug: 1157157
Change-Id: Ia0845e29b86eb66411cd45399ba0ef340537b92c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2618620
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarRobert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842268}
parent 9a33bf90
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h" #include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/base/cursor/cursor.h" #include "ui/base/cursor/cursor.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/ui_base_switches_util.h" #include "ui/base/ui_base_switches_util.h"
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/events/keycodes/keyboard_codes.h" #include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h" #include "ui/gfx/canvas.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/drag_controller.h" #include "ui/views/drag_controller.h"
#include "ui/views/metadata/metadata_impl_macros.h" #include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
...@@ -261,9 +263,10 @@ void RootView::DeviceScaleFactorChanged(float old_device_scale_factor, ...@@ -261,9 +263,10 @@ void RootView::DeviceScaleFactorChanged(float old_device_scale_factor,
void RootView::AnnounceText(const base::string16& text) { void RootView::AnnounceText(const base::string16& text) {
#if defined(OS_APPLE) #if defined(OS_APPLE)
// MacOSX has its own API for making announcements; see AnnounceText() gfx::NativeViewAccessible native = GetViewAccessibility().GetNativeObject();
// override in ax_platform_node_mac.[h|mm] auto* ax_node = ui::AXPlatformNode::FromNativeViewAccessible(native);
NOTREACHED(); if (ax_node)
ax_node->AnnounceText(text);
#else #else
DCHECK(GetWidget()); DCHECK(GetWidget());
DCHECK(GetContentsView()); DCHECK(GetContentsView());
......
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