Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Unified Diff: content/renderer/accessibility/blink_ax_tree_source.cc

Issue 682583002: Make use of new faster Blink AX live region APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profiling
Patch Set: Update Android expectations Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/accessibility/aria-alert-expected-android.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/accessibility/blink_ax_tree_source.cc
diff --git a/content/renderer/accessibility/blink_ax_tree_source.cc b/content/renderer/accessibility/blink_ax_tree_source.cc
index c2ca4ef477543a70210e16cff3f19ff754666ebe..51d753121b738a11b97a0be6cd895bdbfc46262a 100644
--- a/content/renderer/accessibility/blink_ax_tree_source.cc
+++ b/content/renderer/accessibility/blink_ax_tree_source.cc
@@ -60,10 +60,6 @@ bool IsParentUnignoredOf(WebAXObject ancestor,
return parent.equals(ancestor);
}
-bool IsTrue(std::string html_value) {
- return LowerCaseEqualsASCII(html_value, "true");
-}
-
std::string GetEquivalentAriaRoleString(const ui::AXRole role) {
switch (role) {
case ui::AX_ROLE_ARTICLE:
@@ -313,10 +309,6 @@ void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src,
WebNode node = src.node();
bool is_iframe = false;
- std::string live_atomic;
- std::string live_busy;
- std::string live_status;
- std::string live_relevant;
if (!node.isNull() && node.isElementNode()) {
WebElement element = node.to<WebElement>();
@@ -371,12 +363,6 @@ void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src,
dst->AddStringAttribute(ui::AX_ATTR_ROLE, role);
}
- // Live region attributes
- live_atomic = UTF16ToUTF8(element.getAttribute("aria-atomic"));
- live_busy = UTF16ToUTF8(element.getAttribute("aria-busy"));
- live_status = UTF16ToUTF8(element.getAttribute("aria-live"));
- live_relevant = UTF16ToUTF8(element.getAttribute("aria-relevant"));
-
// Browser plugin (used in a <webview>).
if (node_to_browser_plugin_instance_id_map_) {
BrowserPlugin* browser_plugin = BrowserPlugin::GetFromNode(element);
@@ -388,64 +374,21 @@ void BlinkAXTreeSource::SerializeNode(blink::WebAXObject src,
}
}
- // Walk up the parent chain to set live region attributes of containers
- std::string container_live_atomic;
- std::string container_live_busy;
- std::string container_live_status;
- std::string container_live_relevant;
- WebAXObject container_accessible = src;
- while (!container_accessible.isDetached()) {
- WebNode container_node = container_accessible.node();
- if (!container_node.isNull() && container_node.isElementNode()) {
- WebElement container_elem = container_node.to<WebElement>();
- if (container_elem.hasAttribute("aria-atomic") &&
- container_live_atomic.empty()) {
- container_live_atomic =
- UTF16ToUTF8(container_elem.getAttribute("aria-atomic"));
- }
- if (container_elem.hasAttribute("aria-busy") &&
- container_live_busy.empty()) {
- container_live_busy =
- UTF16ToUTF8(container_elem.getAttribute("aria-busy"));
- }
- if (container_elem.hasAttribute("aria-live") &&
- container_live_status.empty()) {
- container_live_status =
- UTF16ToUTF8(container_elem.getAttribute("aria-live"));
- }
- if (container_elem.hasAttribute("aria-relevant") &&
- container_live_relevant.empty()) {
- container_live_relevant =
- UTF16ToUTF8(container_elem.getAttribute("aria-relevant"));
- }
- }
- container_accessible = container_accessible.parentObject();
- }
-
- if (!live_atomic.empty())
- dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, IsTrue(live_atomic));
- if (!live_busy.empty())
- dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, IsTrue(live_busy));
- if (!live_status.empty())
- dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS, live_status);
- if (!live_relevant.empty())
- dst->AddStringAttribute(ui::AX_ATTR_LIVE_RELEVANT, live_relevant);
-
- if (!container_live_atomic.empty()) {
+ if (src.isInLiveRegion()) {
+ dst->AddBoolAttribute(ui::AX_ATTR_LIVE_ATOMIC, src.liveRegionAtomic());
+ dst->AddBoolAttribute(ui::AX_ATTR_LIVE_BUSY, src.liveRegionBusy());
+ dst->AddStringAttribute(ui::AX_ATTR_LIVE_STATUS,
+ UTF16ToUTF8(src.liveRegionStatus()));
+ dst->AddStringAttribute(ui::AX_ATTR_LIVE_RELEVANT,
+ UTF16ToUTF8(src.liveRegionRelevant()));
dst->AddBoolAttribute(ui::AX_ATTR_CONTAINER_LIVE_ATOMIC,
- IsTrue(container_live_atomic));
- }
- if (!container_live_busy.empty()) {
+ src.containerLiveRegionAtomic());
dst->AddBoolAttribute(ui::AX_ATTR_CONTAINER_LIVE_BUSY,
- IsTrue(container_live_busy));
- }
- if (!container_live_status.empty()) {
+ src.containerLiveRegionBusy());
dst->AddStringAttribute(ui::AX_ATTR_CONTAINER_LIVE_STATUS,
- container_live_status);
- }
- if (!container_live_relevant.empty()) {
+ UTF16ToUTF8(src.containerLiveRegionStatus()));
dst->AddStringAttribute(ui::AX_ATTR_CONTAINER_LIVE_RELEVANT,
- container_live_relevant);
+ UTF16ToUTF8(src.containerLiveRegionRelevant()));
}
if (dst->role == ui::AX_ROLE_PROGRESS_INDICATOR ||
« no previous file with comments | « no previous file | content/test/data/accessibility/aria-alert-expected-android.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698