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

a11y inspect reorg: accessibility_ui should reuse accessible tree formatter methods

Bug: 1133330
Change-Id: I187c8c14ad14a5f36b939556d41940e0acbd3374
AX-Relnotes: n/a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2481349Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Commit-Queue: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818539}
parent 09e12b17
......@@ -260,28 +260,6 @@ void HandleAccessibilityRequestCallback(
std::move(callback).Run(base::RefCountedString::TakeString(&json_string));
}
bool MatchesPropertyFilters(
const std::vector<AXPropertyFilter>& property_filters,
const std::string& text) {
bool allow = false;
for (const auto& filter : property_filters) {
if (base::MatchPattern(text, filter.match_str)) {
switch (filter.type) {
case AXPropertyFilter::ALLOW_EMPTY:
allow = true;
break;
case AXPropertyFilter::ALLOW:
allow = (!base::MatchPattern(text, "*=''"));
break;
case AXPropertyFilter::DENY:
allow = false;
break;
}
}
}
return allow;
}
std::string RecursiveDumpAXPlatformNodeAsString(
ui::AXPlatformNode* node,
int indent,
......@@ -293,7 +271,8 @@ std::string RecursiveDumpAXPlatformNodeAsString(
std::vector<std::string> attributes = base::SplitString(
line, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
for (std::string attribute : attributes) {
if (MatchesPropertyFilters(property_filters, attribute)) {
if (content::AccessibilityTreeFormatter::MatchesPropertyFilters(
property_filters, attribute, false)) {
str += attribute + " ";
}
}
......
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