Commit c091a49a authored by Alexander Surkov's avatar Alexander Surkov Committed by Commit Bot

a11y inspect reorg: move PropertyNode to a new location

Bug: 1133330
Change-Id: I9e52d0154dba2b3b1b5dbe532bb3daba4167a48c
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2471880Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Alexander Surkov <asurkov@igalia.com>
Cr-Commit-Position: refs/heads/master@{#817758}
parent 78e91d07
......@@ -347,7 +347,7 @@ bool AccessibilityTreeFormatter::MatchesPropertyFilters(
}
bool AccessibilityTreeFormatter::MatchesNodeFilters(
const std::vector<NodeFilter>& node_filters,
const std::vector<AXNodeFilter>& node_filters,
const base::DictionaryValue& dict) {
for (const auto& filter : node_filters) {
std::string value;
......@@ -438,7 +438,7 @@ void AccessibilityTreeFormatterBase::SetPropertyFilters(
}
void AccessibilityTreeFormatterBase::SetNodeFilters(
const std::vector<NodeFilter>& node_filters) {
const std::vector<AXNodeFilter>& node_filters) {
node_filters_ = node_filters;
}
......
......@@ -151,7 +151,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatterBase
std::string* contents) override;
void SetPropertyFilters(
const std::vector<AXPropertyFilter>& property_filters) override;
void SetNodeFilters(const std::vector<NodeFilter>& node_filters) override;
void SetNodeFilters(const std::vector<AXNodeFilter>& node_filters) override;
void set_show_ids(bool show_ids) override;
base::FilePath::StringType GetVersionSpecificExpectedFileSuffix() override;
......@@ -222,7 +222,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatterBase
// Node filters used when formatting the accessibility tree as text.
// Any node which matches a node wilder will be skipped, along with all its
// children.
std::vector<NodeFilter> node_filters_;
std::vector<AXNodeFilter> node_filters_;
// Whether or not node ids should be included in the dump.
bool show_ids_ = false;
......
......@@ -77,7 +77,6 @@ bool AccessibilityTreeContainsLoadedDocWithUrl(BrowserAccessibility* node,
} // namespace
using ui::AXPropertyFilter;
typedef AccessibilityTreeFormatter::NodeFilter NodeFilter;
DumpAccessibilityTestBase::DumpAccessibilityTestBase()
: formatter_factory_(nullptr),
......
......@@ -119,7 +119,7 @@ class DumpAccessibilityTestBase : public ContentBrowserTest,
std::vector<ui::AXPropertyFilter> property_filters_;
// The node filters loaded from the test file.
std::vector<AccessibilityTreeFormatter::NodeFilter> node_filters_;
std::vector<ui::AXNodeFilter> node_filters_;
// The current tree-formatter and event-recorder factories.
AccessibilityTreeFormatter::FormatterFactory formatter_factory_;
......
......@@ -58,21 +58,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatter
public:
using AXTreeSelector = ui::AXTreeSelector;
using AXPropertyFilter = ui::AXPropertyFilter;
// A single node filter specification which will exclude any node where the
// value of the named property matches the given pattern.
//
// This can be used to exclude nodes based on properties like role, for
// example to exclude all inlineTextBox nodes under blink we would use a
// NodeFilter of the form:
// {property='internalRole', pattern='inlineTextBox'};
struct NodeFilter {
std::string property;
std::string pattern;
NodeFilter(const std::string& property, const std::string& pattern)
: property(property), pattern(pattern) {}
};
using AXNodeFilter = ui::AXNodeFilter;
// Create the appropriate native subclass of AccessibilityTreeFormatter.
static std::unique_ptr<AccessibilityTreeFormatter> Create();
......@@ -99,8 +85,8 @@ class CONTENT_EXPORT AccessibilityTreeFormatter
const std::string& text,
bool default_result);
// Check if the given dictionary matches any of the supplied NodeFilter(s).
static bool MatchesNodeFilters(const std::vector<NodeFilter>& node_filters,
// Check if the given dictionary matches any of the supplied AXNodeFilter(s).
static bool MatchesNodeFilters(const std::vector<AXNodeFilter>& node_filters,
const base::DictionaryValue& dict);
// Build an accessibility tree for any window.
......@@ -133,7 +119,8 @@ class CONTENT_EXPORT AccessibilityTreeFormatter
const std::vector<AXPropertyFilter>& property_filters) = 0;
// Set regular expression filters that apply to every node before output.
virtual void SetNodeFilters(const std::vector<NodeFilter>& node_filters) = 0;
virtual void SetNodeFilters(
const std::vector<AXNodeFilter>& node_filters) = 0;
// If true, the internal accessibility id of each node will be included
// in its output.
......
......@@ -62,6 +62,21 @@ struct AX_EXPORT AXPropertyFilter {
AXPropertyFilter(const AXPropertyFilter&);
};
// A single node filter specification which will exclude any node where the
// value of the named property matches the given pattern.
//
// This can be used to exclude nodes based on properties like role, for
// example to exclude all inlineTextBox nodes under blink we would use a
// NodeFilter of the form:
// {property='internalRole', pattern='inlineTextBox'};
struct AX_EXPORT AXNodeFilter {
std::string property;
std::string pattern;
AXNodeFilter(const std::string& property, const std::string& pattern)
: property(property), pattern(pattern) {}
};
} // namespace ui
#endif // UI_ACCESSIBILITY_PLATFORM_INSPECT_INSPECT_H_
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