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( ...@@ -347,7 +347,7 @@ bool AccessibilityTreeFormatter::MatchesPropertyFilters(
} }
bool AccessibilityTreeFormatter::MatchesNodeFilters( bool AccessibilityTreeFormatter::MatchesNodeFilters(
const std::vector<NodeFilter>& node_filters, const std::vector<AXNodeFilter>& node_filters,
const base::DictionaryValue& dict) { const base::DictionaryValue& dict) {
for (const auto& filter : node_filters) { for (const auto& filter : node_filters) {
std::string value; std::string value;
...@@ -438,7 +438,7 @@ void AccessibilityTreeFormatterBase::SetPropertyFilters( ...@@ -438,7 +438,7 @@ void AccessibilityTreeFormatterBase::SetPropertyFilters(
} }
void AccessibilityTreeFormatterBase::SetNodeFilters( void AccessibilityTreeFormatterBase::SetNodeFilters(
const std::vector<NodeFilter>& node_filters) { const std::vector<AXNodeFilter>& node_filters) {
node_filters_ = node_filters; node_filters_ = node_filters;
} }
......
...@@ -151,7 +151,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatterBase ...@@ -151,7 +151,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatterBase
std::string* contents) override; std::string* contents) override;
void SetPropertyFilters( void SetPropertyFilters(
const std::vector<AXPropertyFilter>& property_filters) override; 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; void set_show_ids(bool show_ids) override;
base::FilePath::StringType GetVersionSpecificExpectedFileSuffix() override; base::FilePath::StringType GetVersionSpecificExpectedFileSuffix() override;
...@@ -222,7 +222,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatterBase ...@@ -222,7 +222,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatterBase
// Node filters used when formatting the accessibility tree as text. // Node filters used when formatting the accessibility tree as text.
// Any node which matches a node wilder will be skipped, along with all its // Any node which matches a node wilder will be skipped, along with all its
// children. // children.
std::vector<NodeFilter> node_filters_; std::vector<AXNodeFilter> node_filters_;
// Whether or not node ids should be included in the dump. // Whether or not node ids should be included in the dump.
bool show_ids_ = false; bool show_ids_ = false;
......
...@@ -77,7 +77,6 @@ bool AccessibilityTreeContainsLoadedDocWithUrl(BrowserAccessibility* node, ...@@ -77,7 +77,6 @@ bool AccessibilityTreeContainsLoadedDocWithUrl(BrowserAccessibility* node,
} // namespace } // namespace
using ui::AXPropertyFilter; using ui::AXPropertyFilter;
typedef AccessibilityTreeFormatter::NodeFilter NodeFilter;
DumpAccessibilityTestBase::DumpAccessibilityTestBase() DumpAccessibilityTestBase::DumpAccessibilityTestBase()
: formatter_factory_(nullptr), : formatter_factory_(nullptr),
......
...@@ -119,7 +119,7 @@ class DumpAccessibilityTestBase : public ContentBrowserTest, ...@@ -119,7 +119,7 @@ class DumpAccessibilityTestBase : public ContentBrowserTest,
std::vector<ui::AXPropertyFilter> property_filters_; std::vector<ui::AXPropertyFilter> property_filters_;
// The node filters loaded from the test file. // 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. // The current tree-formatter and event-recorder factories.
AccessibilityTreeFormatter::FormatterFactory formatter_factory_; AccessibilityTreeFormatter::FormatterFactory formatter_factory_;
......
...@@ -58,21 +58,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatter ...@@ -58,21 +58,7 @@ class CONTENT_EXPORT AccessibilityTreeFormatter
public: public:
using AXTreeSelector = ui::AXTreeSelector; using AXTreeSelector = ui::AXTreeSelector;
using AXPropertyFilter = ui::AXPropertyFilter; using AXPropertyFilter = ui::AXPropertyFilter;
using AXNodeFilter = ui::AXNodeFilter;
// 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) {}
};
// Create the appropriate native subclass of AccessibilityTreeFormatter. // Create the appropriate native subclass of AccessibilityTreeFormatter.
static std::unique_ptr<AccessibilityTreeFormatter> Create(); static std::unique_ptr<AccessibilityTreeFormatter> Create();
...@@ -99,8 +85,8 @@ class CONTENT_EXPORT AccessibilityTreeFormatter ...@@ -99,8 +85,8 @@ class CONTENT_EXPORT AccessibilityTreeFormatter
const std::string& text, const std::string& text,
bool default_result); bool default_result);
// Check if the given dictionary matches any of the supplied NodeFilter(s). // Check if the given dictionary matches any of the supplied AXNodeFilter(s).
static bool MatchesNodeFilters(const std::vector<NodeFilter>& node_filters, static bool MatchesNodeFilters(const std::vector<AXNodeFilter>& node_filters,
const base::DictionaryValue& dict); const base::DictionaryValue& dict);
// Build an accessibility tree for any window. // Build an accessibility tree for any window.
...@@ -133,7 +119,8 @@ class CONTENT_EXPORT AccessibilityTreeFormatter ...@@ -133,7 +119,8 @@ class CONTENT_EXPORT AccessibilityTreeFormatter
const std::vector<AXPropertyFilter>& property_filters) = 0; const std::vector<AXPropertyFilter>& property_filters) = 0;
// Set regular expression filters that apply to every node before output. // 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 // If true, the internal accessibility id of each node will be included
// in its output. // in its output.
......
...@@ -62,6 +62,21 @@ struct AX_EXPORT AXPropertyFilter { ...@@ -62,6 +62,21 @@ struct AX_EXPORT AXPropertyFilter {
AXPropertyFilter(const 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 } // namespace ui
#endif // UI_ACCESSIBILITY_PLATFORM_INSPECT_INSPECT_H_ #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