Commit f5fadc38 authored by Nektarios Paisios's avatar Nektarios Paisios Committed by Chromium LUCI CQ

Focused nodes should never be ignored

This work is required before we can merge the two position classes: AXNodePosition and BrowserAccessibilityPosition.

This patch fixes AXNode::IsIgnored so that it won't mark focused nodes as ignored.
This is for consistency with AXNode::IsVisibleOrIgnored.
The merged AXPosition class will need to rely on IsIgnored extensively and there shouldn't
be a mismatch with platform code that uses IsInvisibleOrIgnored.

Also improves method comments and simplifies the name of
AXNode::IsFocusedWithinThisTree.

R=dmazzoni@chromium.org, aleventhal@chromium.org

AX-Relnotes: n/a.
Bug: 1049261
Change-Id: Ic8fc261b10afcf5db2a458bf9081e17036ccc82d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637596Reviewed-by: default avatarKurt Catti-Schmidt <kschmi@microsoft.com>
Reviewed-by: default avatarAaron Leventhal <aleventhal@chromium.org>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845791}
parent 383bd75b
......@@ -1246,7 +1246,7 @@ std::string AXNode::GetValueForTextField() const {
}
bool AXNode::IsIgnored() const {
return data().IsIgnored();
return data().IsIgnored() && !IsFocusedInThisTree();
}
bool AXNode::IsIgnoredForTextNavigation() const {
......@@ -1254,13 +1254,10 @@ bool AXNode::IsIgnoredForTextNavigation() const {
}
bool AXNode::IsInvisibleOrIgnored() const {
if (!data().IsInvisibleOrIgnored())
return false;
return !IsFocusedWithinThisTree();
return data().IsInvisibleOrIgnored() && !IsFocusedInThisTree();
}
bool AXNode::IsFocusedWithinThisTree() const {
bool AXNode::IsFocusedInThisTree() const {
return id() == tree_->data().focus_id;
}
......
......@@ -456,7 +456,8 @@ class AX_EXPORT AXNode final {
// element.
bool IsEmbeddedGroup() const;
// Returns true if node has ignored state or ignored role.
// Returns true if this node has the ignored state or the ignored role.
// Focused nodes are, by design, not ignored.
bool IsIgnored() const;
// Some nodes are not ignored but should be skipped during text navigation.
......@@ -464,11 +465,14 @@ class AX_EXPORT AXNode final {
// encountering a splitter during character and word navigation.
bool IsIgnoredForTextNavigation() const;
// Returns true if node is invisible or ignored.
// Returns true if node is invisible, or if it is ignored as determined by
// `AXNode::IsIgnored()`.
bool IsInvisibleOrIgnored() const;
// Returns true if node is focused within this tree.
bool IsFocusedWithinThisTree() const;
// Returns true if this node is focused in the current tree. Every
// accessibility tree may have its own independent focus, e.g. an iframe may
// have a different focus from the main web page.
bool IsFocusedInThisTree() const;
// Returns true if an ancestor of this node (not including itself) is a
// leaf node, meaning that this node is not actually exposed to any
......
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