Commit f144f4a9 authored by Nektarios Paisios's avatar Nektarios Paisios Committed by Commit Bot

Reland "Adds code in ViewAccessibility to manage the focus of AXVirtualView descendants"

This is a reland of cb9c3091

TBR=afakhry@chromium.org,dmazzoni@chromium.org,sky@chromium.org

Original change's description:
> Adds code in ViewAccessibility to manage the focus of AXVirtualView descendants
>
> Also renamed some methods to make interface more consistent.
> In preparation for more changes in AXVirtualView.
> R=dmazzoni@chromium.org, aleventhal@chromium.org
>
> Change-Id: Ib417493794cc16536e20c3ce72dc8b00ba8568a9
> Reviewed-on: https://chromium-review.googlesource.com/c/1296621
> Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
> Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Nektarios Paisios <nektar@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#602876}

Change-Id: I08aa777df2ce4a7fc93e30e00ef4aced623fdd6e
Reviewed-on: https://chromium-review.googlesource.com/c/1301796
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603148}
parent cf418066
......@@ -136,7 +136,7 @@ KeyboardShortcutItemView::KeyboardShortcutItemView(
// Use leaf list item role so that name is spoken by screen reader, but
// redundant child label text is not also spoken.
GetViewAccessibility().OverrideRole(ax::mojom::Role::kListItem);
GetViewAccessibility().OverrideIsLeaf();
GetViewAccessibility().OverrideIsLeaf(true);
accessible_name_ = description_label_view_->text() +
base::ASCIIToUTF16(", ") + shortcut_label_view_->text();
}
......
......@@ -73,7 +73,7 @@ KeywordHintView::KeywordHintView(views::ButtonListener* listener,
// Use leaf alert role so that name is spoken by screen reader, but redundant
// child label text is not also spoken.
GetViewAccessibility().OverrideRole(ax::mojom::Role::kGenericContainer);
GetViewAccessibility().OverrideIsLeaf();
GetViewAccessibility().OverrideIsLeaf(true);
}
KeywordHintView::~KeywordHintView() {}
......
......@@ -34,6 +34,12 @@ const AXNodeData& AXPlatformNodeBase::GetData() const {
return *empty_data;
}
gfx::NativeViewAccessible AXPlatformNodeBase::GetFocus() {
if (delegate_)
return delegate_->GetFocus();
return nullptr;
}
gfx::NativeViewAccessible AXPlatformNodeBase::GetParent() {
if (delegate_)
return delegate_->GetParent();
......
......@@ -49,6 +49,7 @@ class AX_EXPORT AXPlatformNodeBase : public AXPlatformNode {
// These are simple wrappers to our delegate.
const AXNodeData& GetData() const;
gfx::NativeViewAccessible GetFocus();
gfx::NativeViewAccessible GetParent();
int GetChildCount();
gfx::NativeViewAccessible ChildAtIndex(int index);
......
......@@ -460,6 +460,8 @@ jumbo_component("views") {
"../views_bridge_mac/views_nswindow_delegate.mm",
"../views_bridge_mac/views_scrollbar_bridge.h",
"../views_bridge_mac/views_scrollbar_bridge.mm",
"accessibility/ax_virtual_view.cc",
"accessibility/ax_virtual_view.h",
"cocoa/bridge_factory_host.cc",
"cocoa/bridged_native_widget_host_impl.mm",
"cocoa/drag_drop_client_mac.h",
......@@ -766,8 +768,6 @@ jumbo_component("views") {
if (has_native_accessibility) {
sources += [
"accessibility/ax_virtual_view.cc",
"accessibility/ax_virtual_view.h",
"accessibility/view_ax_platform_node_delegate.cc",
"accessibility/view_ax_platform_node_delegate.h",
"accessibility/view_ax_platform_node_delegate_mac.h",
......
......@@ -147,7 +147,7 @@ TEST_F(AXTreeSourceViewsTest, GetTreeDataWithFocus) {
TEST_F(AXTreeSourceViewsTest, IgnoredView) {
View* ignored_view = new View();
ignored_view->GetViewAccessibility().set_is_ignored(true);
ignored_view->GetViewAccessibility().OverrideIsIgnored(true);
widget_->GetContentsView()->AddChildView(ignored_view);
AXAuraObjCache* cache = AXAuraObjCache::GetInstance();
......
......@@ -21,7 +21,7 @@ AXViewObjWrapper::AXViewObjWrapper(View* view) : view_(view) {
AXViewObjWrapper::~AXViewObjWrapper() {}
bool AXViewObjWrapper::IsIgnored() {
return view_->GetViewAccessibility().is_ignored();
return view_->GetViewAccessibility().IsIgnored();
}
AXAuraObjWrapper* AXViewObjWrapper::GetParent() {
......
......@@ -163,6 +163,11 @@ void AXVirtualView::OverrideBoundsRect(const gfx::RectF& location) {
custom_data_.location = location;
}
ui::AXNodeData& AXVirtualView::GetData() {
return const_cast<ui::AXNodeData&>(
const_cast<const AXVirtualView*>(this)->GetData());
}
// ui::AXPlatformNodeDelegate
const ui::AXNodeData& AXVirtualView::GetData() const {
......@@ -194,7 +199,7 @@ gfx::NativeWindow AXVirtualView::GetTopLevelWidget() {
gfx::NativeViewAccessible AXVirtualView::GetParent() {
if (parent_view_)
return parent_view_->GetNativeViewAccessible();
return parent_view_->GetNativeObject();
if (virtual_parent_view_)
return virtual_parent_view_->GetNativeObject();
......@@ -251,7 +256,7 @@ bool AXVirtualView::IsParentVisible() const {
if (parent_view_) {
const auto* parent_node = static_cast<ui::AXPlatformNodeBase*>(
ui::AXPlatformNode::FromNativeViewAccessible(
parent_view_->GetNativeViewAccessible()));
parent_view_->GetNativeObject()));
if (!parent_node) {
NOTREACHED() << "AXVirtualView should be created on a platform with "
"native accessibility support.";
......
......@@ -73,10 +73,10 @@ class VIEWS_EXPORT AXVirtualView : public ui::AXPlatformNodeDelegateBase {
const AXVirtualView* child_at(int index) const;
AXVirtualView* child_at(int index);
// Returns the parent view if the parent is a real View and not an
// AXVirtualView. Returns nullptr otherwise.
const View* parent_view() const { return parent_view_; }
View* parent_view() { return parent_view_; }
// Returns the ViewAccessibility parent if the parent is a real View and not
// an AXVirtualView. Returns nullptr otherwise.
const ViewAccessibility* parent_view() const { return parent_view_; }
ViewAccessibility* parent_view() { return parent_view_; }
// Returns the parent view if the parent is an AXVirtualView and not a real
// View. Returns nullptr otherwise.
......@@ -107,6 +107,8 @@ class VIEWS_EXPORT AXVirtualView : public ui::AXPlatformNodeDelegateBase {
void OverrideDescription(const std::string& description);
void OverrideDescription(const base::string16& description);
void OverrideBoundsRect(const gfx::RectF& location);
// Allows clients to modify the AXNodeData for this virtual view.
ui::AXNodeData& GetData();
// ui::AXPlatformNodeDelegate
const ui::AXNodeData& GetData() const override;
......@@ -127,9 +129,9 @@ class VIEWS_EXPORT AXVirtualView : public ui::AXPlatformNodeDelegateBase {
private:
// Sets the parent view if the parent is a real View and not an AXVirtualView.
// It is invalid to set both |parent_view_| and |virtual_parent_view_|.
void set_parent_view(View* view) {
void set_parent_view(ViewAccessibility* view_accessibility) {
DCHECK(!virtual_parent_view_);
parent_view_ = view;
parent_view_ = view_accessibility;
}
bool IsParentVisible() const;
......@@ -140,7 +142,7 @@ class VIEWS_EXPORT AXVirtualView : public ui::AXPlatformNodeDelegateBase {
// Weak. Owns us if not nullptr.
// Either |parent_view_| or |virtual_parent_view_| should be set but not both.
View* parent_view_;
ViewAccessibility* parent_view_;
// Weak. Owns us if not nullptr.
// Either |parent_view_| or |virtual_parent_view_| should be set but not both.
......
......@@ -46,8 +46,8 @@ class AXVirtualViewTest : public ViewsTestBase {
button_->SetSize(gfx::Size(20, 20));
widget_->GetContentsView()->AddChildView(button_);
virtual_label_ = new AXVirtualView;
virtual_label_->OverrideRole(ax::mojom::Role::kStaticText);
virtual_label_->OverrideName("Label");
virtual_label_->GetData().role = ax::mojom::Role::kStaticText;
virtual_label_->GetData().SetName("Label");
button_->GetViewAccessibility().AddVirtualChildView(
base::WrapUnique(virtual_label_));
widget_->Show();
......
......@@ -46,14 +46,17 @@ std::unique_ptr<ViewAccessibility> ViewAccessibility::Create(View* view) {
#endif
ViewAccessibility::ViewAccessibility(View* view)
: owner_view_(view), is_leaf_(false) {}
: view_(view),
focused_virtual_child_(nullptr),
is_leaf_(false),
is_ignored_(false) {}
ViewAccessibility::~ViewAccessibility() = default;
void ViewAccessibility::AddVirtualChildView(
std::unique_ptr<AXVirtualView> virtual_view) {
DCHECK(virtual_view);
if (virtual_view->parent_view() == view())
if (virtual_view->parent_view() == this)
return;
AddVirtualChildViewAt(std::move(virtual_view), virtual_child_count());
}
......@@ -71,7 +74,7 @@ void ViewAccessibility::AddVirtualChildViewAt(
DCHECK_GE(index, 0);
DCHECK_LE(index, virtual_child_count());
virtual_view->set_parent_view(view());
virtual_view->set_parent_view(this);
virtual_children_.insert(virtual_children_.begin() + index,
std::move(virtual_view));
}
......@@ -87,6 +90,8 @@ std::unique_ptr<AXVirtualView> ViewAccessibility::RemoveVirtualChildView(
std::move(virtual_children_[cur_index]);
virtual_children_.erase(virtual_children_.begin() + cur_index);
child->set_parent_view(nullptr);
if (focused_virtual_child_ && child->Contains(focused_virtual_child_))
focused_virtual_child_ = nullptr;
return child;
}
......@@ -95,6 +100,17 @@ void ViewAccessibility::RemoveAllVirtualChildViews() {
RemoveVirtualChildView(virtual_children_.back().get());
}
bool ViewAccessibility::Contains(const AXVirtualView* virtual_view) const {
DCHECK(virtual_view);
for (const auto& virtual_child : virtual_children_) {
// AXVirtualView::Contains() also checks if the provided virtual view is the
// same as |this|.
if (virtual_child->Contains(virtual_view))
return true;
}
return false;
}
int ViewAccessibility::GetIndexOf(const AXVirtualView* virtual_view) const {
DCHECK(virtual_view);
const auto iter =
......@@ -114,14 +130,14 @@ const ui::AXUniqueId& ViewAccessibility::GetUniqueId() const {
void ViewAccessibility::GetAccessibleNodeData(ui::AXNodeData* data) const {
// Views may misbehave if their widget is closed; return an unknown role
// rather than possibly crashing.
views::Widget* widget = owner_view_->GetWidget();
const views::Widget* widget = view_->GetWidget();
if (!widget || !widget->widget_delegate() || widget->IsClosed()) {
data->role = ax::mojom::Role::kUnknown;
data->SetRestriction(ax::mojom::Restriction::kDisabled);
return;
}
owner_view_->GetAccessibleNodeData(data);
view_->GetAccessibleNodeData(data);
if (custom_data_.role != ax::mojom::Role::kUnknown)
data->role = custom_data_.role;
......@@ -138,7 +154,7 @@ void ViewAccessibility::GetAccessibleNodeData(ui::AXNodeData* data) const {
if (!data->HasStringAttribute(ax::mojom::StringAttribute::kDescription)) {
base::string16 tooltip;
owner_view_->GetTooltipText(gfx::Point(), &tooltip);
view_->GetTooltipText(gfx::Point(), &tooltip);
// Some screen readers announce the accessible description right after the
// accessible name. Only use the tooltip as the accessible description if
// it's different from the name, otherwise users might be puzzled as to why
......@@ -150,30 +166,31 @@ void ViewAccessibility::GetAccessibleNodeData(ui::AXNodeData* data) const {
}
}
data->location = gfx::RectF(owner_view_->GetBoundsInScreen());
data->location = gfx::RectF(view_->GetBoundsInScreen());
data->AddStringAttribute(ax::mojom::StringAttribute::kClassName,
owner_view_->GetClassName());
view_->GetClassName());
if (owner_view_->IsAccessibilityFocusable())
if (view_->IsAccessibilityFocusable())
data->AddState(ax::mojom::State::kFocusable);
if (!owner_view_->enabled())
if (!view_->enabled())
data->SetRestriction(ax::mojom::Restriction::kDisabled);
if (!owner_view_->visible() && data->role != ax::mojom::Role::kAlert)
if (!view_->visible() && data->role != ax::mojom::Role::kAlert)
data->AddState(ax::mojom::State::kInvisible);
if (owner_view_->context_menu_controller())
if (view_->context_menu_controller())
data->AddAction(ax::mojom::Action::kShowContextMenu);
}
bool ViewAccessibility::IsLeaf() const {
return is_leaf_;
void ViewAccessibility::OverrideFocus(AXVirtualView* virtual_view) {
DCHECK(!virtual_view || Contains(virtual_view))
<< "|virtual_view| must be nullptr or a descendant of this view.";
focused_virtual_child_ = virtual_view;
}
void ViewAccessibility::OverrideRole(const ax::mojom::Role role) {
DCHECK(IsValidRoleForViews(role));
DCHECK(IsValidRoleForViews(role)) << "Invalid role for Views.";
custom_data_.role = role;
}
......@@ -193,12 +210,22 @@ void ViewAccessibility::OverrideDescription(const base::string16& description) {
custom_data_.SetDescription(description);
}
void ViewAccessibility::OverrideIsLeaf() {
is_leaf_ = true;
void ViewAccessibility::OverrideIsLeaf(bool value) {
is_leaf_ = value;
}
void ViewAccessibility::OverrideIsIgnored(bool value) {
is_ignored_ = value;
}
gfx::NativeViewAccessible ViewAccessibility::GetNativeObject() {
return nullptr;
}
gfx::NativeViewAccessible ViewAccessibility::GetFocusedDescendant() {
if (focused_virtual_child_)
return focused_virtual_child_->GetNativeObject();
return GetNativeObject();
}
} // namespace views
......@@ -48,12 +48,21 @@ class VIEWS_EXPORT ViewAccessibility {
// Note that string attributes are only used if non-empty, so you can't
// override a string with the empty string.
//
// Sets one of our virtual descendants as having the accessibility focus. This
// means that if this view has the system focus, it will set the accessibility
// focus to the provided descendant virtual view instead. Set this to nullptr
// if none of our virtual descendants should have the accessibility focus. It
// is illegal to set this to any virtual view that is currently not one of our
// descendants and this is enforced by a DCHECK.
void OverrideFocus(AXVirtualView* virtual_view);
void OverrideRole(const ax::mojom::Role role);
void OverrideName(const std::string& name);
void OverrideName(const base::string16& name);
void OverrideDescription(const std::string& description);
void OverrideDescription(const base::string16& description);
void OverrideIsLeaf(); // Force this node to be treated as a leaf node.
void OverrideIsLeaf(bool value);
void OverrideIsIgnored(bool value);
virtual gfx::NativeViewAccessible GetNativeObject();
virtual void NotifyAccessibilityEvent(ax::mojom::Event event_type) {}
......@@ -63,10 +72,9 @@ class VIEWS_EXPORT ViewAccessibility {
virtual const ui::AXUniqueId& GetUniqueId() const;
bool IsLeaf() const;
bool is_ignored() const { return is_ignored_; }
void set_is_ignored(bool ignored) { is_ignored_ = ignored; }
View* view() const { return view_; }
bool IsLeaf() const { return is_leaf_; }
bool IsIgnored() const { return is_ignored_; }
//
// Methods for managing virtual views.
......@@ -97,29 +105,44 @@ class VIEWS_EXPORT ViewAccessibility {
return virtual_children_[index].get();
}
// Returns true if |virtual_view| is contained within the hierarchy of this
// View, even as an indirect descendant.
bool Contains(const AXVirtualView* virtual_view) const;
// Returns the index of |virtual_view|, or -1 if |virtual_view| is not a child
// of this View.
int GetIndexOf(const AXVirtualView* virtual_view) const;
// Returns the native accessibility object associated with the AXVirtualView
// descendant that is currently focused. If no virtual descendants are
// present, or no virtual descendant has been marked as focused, returns the
// native accessibility object associated with this view.
gfx::NativeViewAccessible GetFocusedDescendant();
protected:
explicit ViewAccessibility(View* view);
View* view() const { return owner_view_; }
private:
// Weak. Owns this.
View* const owner_view_;
View* const view_;
// If there are any virtual children, they override any real children.
// We own our virtual children.
std::vector<std::unique_ptr<AXVirtualView>> virtual_children_;
// The virtual child that is currently focused.
// This is nullptr if no virtual child is focused.
// See also OverrideFocus() and GetFocusedDescendant().
AXVirtualView* focused_virtual_child_;
const ui::AXUniqueId unique_id_;
// Contains data set explicitly via SetRole, SetName, etc. that overrides
// anything provided by GetAccessibleNodeData().
// Contains data set explicitly via OverrideRole, OverrideName, etc. that
// overrides anything provided by GetAccessibleNodeData().
ui::AXNodeData custom_data_;
// If set to true, anything that is a descendant of this view will be hidden
// from accessibility.
bool is_leaf_;
// When true the view is ignored when generating the AX node hierarchy, but
......@@ -128,7 +151,9 @@ class VIEWS_EXPORT ViewAccessibility {
// "ignored" would mean that the digits 1 - 9 would appear as if they were
// immediate children of the root. Likewise "internal" container views can be
// ignored, like a Widget's RootView, ClientView, etc.
bool is_ignored_ = false;
// Similar to setting the role of an ARIA widget to "none" or
// "presentational".
bool is_ignored_;
DISALLOW_COPY_AND_ASSIGN(ViewAccessibility);
};
......
......@@ -30,6 +30,9 @@ base::LazyInstance<std::map<int32_t, ui::AXPlatformNode*>>::Leaky
// Information required to fire a delayed accessibility event.
struct QueuedEvent {
QueuedEvent(ax::mojom::Event type, int32_t node_id)
: type(type), node_id(node_id) {}
ax::mojom::Event type;
int32_t node_id;
};
......@@ -108,8 +111,8 @@ int ViewAXPlatformNodeDelegate::menu_depth_ = 0;
ViewAXPlatformNodeDelegate::ViewAXPlatformNodeDelegate(View* view)
: ViewAccessibility(view) {
ax_node_ = ui::AXPlatformNode::Create(this);
DCHECK(ax_node_);
ax_platform_node_ = ui::AXPlatformNode::Create(this);
DCHECK(ax_platform_node_);
static bool first_time = true;
if (first_time) {
......@@ -118,7 +121,8 @@ ViewAXPlatformNodeDelegate::ViewAXPlatformNodeDelegate(View* view)
first_time = false;
}
g_unique_id_to_ax_platform_node.Get()[GetUniqueId().Get()] = ax_node_;
g_unique_id_to_ax_platform_node.Get()[GetUniqueId().Get()] =
ax_platform_node_;
}
ViewAXPlatformNodeDelegate::~ViewAXPlatformNodeDelegate() {
......@@ -126,21 +130,23 @@ ViewAXPlatformNodeDelegate::~ViewAXPlatformNodeDelegate() {
ui::AXPlatformNode::SetPopupFocusOverride(nullptr);
g_unique_id_to_ax_platform_node.Get().erase(GetUniqueId().Get());
ax_node_->Destroy();
ax_platform_node_->Destroy();
}
gfx::NativeViewAccessible ViewAXPlatformNodeDelegate::GetNativeObject() {
return ax_node_->GetNativeViewAccessible();
DCHECK(ax_platform_node_);
return ax_platform_node_->GetNativeViewAccessible();
}
void ViewAXPlatformNodeDelegate::NotifyAccessibilityEvent(
ax::mojom::Event event_type) {
DCHECK(ax_platform_node_);
if (g_is_queueing_events) {
g_event_queue.Get().push_back({event_type, GetUniqueId().Get()});
g_event_queue.Get().emplace_back(event_type, GetUniqueId());
return;
}
ax_node_->NotifyAccessibilityEvent(event_type);
ax_platform_node_->NotifyAccessibilityEvent(event_type);
// Some events have special handling.
switch (event_type) {
......@@ -171,7 +177,7 @@ void ViewAXPlatformNodeDelegate::NotifyAccessibilityEvent(
#if defined(OS_MACOSX)
void ViewAXPlatformNodeDelegate::AnnounceText(base::string16& text) {
ax_node_->AnnounceText(text);
ax_platform_node_->AnnounceText(text);
}
#endif
......@@ -180,7 +186,7 @@ void ViewAXPlatformNodeDelegate::OnMenuItemActive() {
// currently selected item as focused, even though the actual focus is in the
// browser's currently focused textfield.
ui::AXPlatformNode::SetPopupFocusOverride(
ax_node_->GetNativeViewAccessible());
ax_platform_node_->GetNativeViewAccessible());
}
void ViewAXPlatformNodeDelegate::OnMenuStart() {
......@@ -199,7 +205,7 @@ void ViewAXPlatformNodeDelegate::OnMenuEnd() {
// ui::AXPlatformNodeDelegate
const ui::AXNodeData& ViewAXPlatformNodeDelegate::GetData() const {
// Clear it, then populate it.
// Clear the data, then populate it.
data_ = ui::AXNodeData();
GetAccessibleNodeData(&data_);
......@@ -234,7 +240,6 @@ int ViewAXPlatformNodeDelegate::GetChildCount() {
return virtual_child_count();
int child_count = view()->child_count();
std::vector<Widget*> child_widgets;
bool is_tab_modal_showing;
PopulateChildWidgetVector(&child_widgets, &is_tab_modal_showing);
......@@ -270,7 +275,6 @@ gfx::NativeViewAccessible ViewAXPlatformNodeDelegate::ChildAtIndex(int index) {
}
int child_widget_count = static_cast<int>(child_widgets.size());
if (index < view()->child_count()) {
return view()->child_at(index)->GetNativeViewAccessible();
} else if (index < view()->child_count() + child_widget_count) {
......@@ -362,7 +366,12 @@ gfx::NativeViewAccessible ViewAXPlatformNodeDelegate::GetFocus() {
View* focused_view =
focus_manager ? focus_manager->GetFocusedView() : nullptr;
return focused_view ? focused_view->GetNativeViewAccessible() : nullptr;
if (!focused_view)
return nullptr;
// The accessibility focus will be either on the |focused_view| or on one of
// its virtual children.
return focused_view->GetViewAccessibility().GetFocusedDescendant();
}
ui::AXPlatformNode* ViewAXPlatformNodeDelegate::GetFromNodeID(int32_t id) {
......
......@@ -79,7 +79,7 @@ class ViewAXPlatformNodeDelegate : public ViewAccessibility,
// We own this, but it is reference-counted on some platforms so we can't use
// a unique_ptr. It is destroyed in the destructor.
ui::AXPlatformNode* ax_node_;
ui::AXPlatformNode* ax_platform_node_;
mutable ui::AXNodeData data_;
......
......@@ -363,7 +363,7 @@ TEST_F(ViewAXPlatformNodeDelegateWinTest, Overrides) {
alert_view->GetViewAccessibility().OverrideRole(ax::mojom::Role::kAlert);
alert_view->GetViewAccessibility().OverrideName(L"Name");
alert_view->GetViewAccessibility().OverrideDescription("Description");
alert_view->GetViewAccessibility().OverrideIsLeaf();
alert_view->GetViewAccessibility().OverrideIsLeaf(true);
contents_view->AddChildView(alert_view);
// Descendant should be ignored because the parent uses OverrideIsLeaf().
......
......@@ -157,7 +157,7 @@ Tab::Tab(TabbedPane* tabbed_pane, const base::string16& title, View* contents)
// Use leaf so that name is spoken by screen reader without exposing the
// children.
GetViewAccessibility().OverrideIsLeaf();
GetViewAccessibility().OverrideIsLeaf(true);
}
Tab::~Tab() {}
......
......@@ -54,7 +54,7 @@ class ClientSideNonClientFrameView : public NonClientFrameView,
: widget_(widget) {
// Not part of the accessibility node hierarchy because the window frame is
// provided by the window manager.
GetViewAccessibility().set_is_ignored(true);
GetViewAccessibility().OverrideIsIgnored(true);
// Initialize kTopViewInset to a default value. Further updates will come
// from Ash. This is necessary so that during app window creation,
......@@ -424,9 +424,9 @@ void DesktopWindowTreeHostMus::OnWidgetInitDone() {
// window frame is provided by the window manager.
Widget* widget = native_widget_delegate_->AsWidget();
if (widget->non_client_view())
widget->non_client_view()->GetViewAccessibility().set_is_ignored(true);
widget->non_client_view()->GetViewAccessibility().OverrideIsIgnored(true);
if (widget->client_view())
widget->client_view()->GetViewAccessibility().set_is_ignored(true);
widget->client_view()->GetViewAccessibility().OverrideIsIgnored(true);
MusClient::Get()->OnWidgetInitDone(widget);
}
......
......@@ -470,10 +470,10 @@ TEST_F(DesktopWindowTreeHostMusTest, Accessibility) {
// Widget frame views do not participate in accessibility node hierarchy
// because the frame is provided by the window manager.
views::NonClientView* non_client_view = widget->non_client_view();
EXPECT_TRUE(non_client_view->GetViewAccessibility().is_ignored());
EXPECT_TRUE(non_client_view->GetViewAccessibility().IsIgnored());
EXPECT_TRUE(
non_client_view->frame_view()->GetViewAccessibility().is_ignored());
EXPECT_TRUE(widget->client_view()->GetViewAccessibility().is_ignored());
non_client_view->frame_view()->GetViewAccessibility().IsIgnored());
EXPECT_TRUE(widget->client_view()->GetViewAccessibility().IsIgnored());
}
// Used to ensure the visibility of the root window is changed before that of
......
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