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

Unified Diff: content/browser/accessibility/browser_accessibility_win.cc

Issue 2040523002: Improves computation of IAccessible2 Hypertext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Mac browser test. Created 4 years, 6 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/browser/accessibility/browser_accessibility_win_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/accessibility/browser_accessibility_win.cc
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc
index 816aa2bf3ff8f229fc121d7438d08909061a22cb..430e3c0fc0dbfb2dac62dc403aca60c3223f7509 100644
--- a/content/browser/accessibility/browser_accessibility_win.cc
+++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -2411,7 +2411,13 @@ STDMETHODIMP BrowserAccessibilityWin::get_hyperlink(
}
int32_t id = hyperlinks()[index];
- BrowserAccessibilityWin* link = GetFromID(id);
+ BrowserAccessibilityWin* link = nullptr;
+ if (id < 0) {
+ // We are at a tree boundary.
+ link = ToBrowserAccessibilityWin(PlatformGetChild(0));
+ } else {
+ link = GetFromID(id);
+ }
if (!link)
return E_FAIL;
@@ -3509,18 +3515,15 @@ void BrowserAccessibilityWin::UpdateStep1ComputeWinAttributes() {
win_attributes_->description = GetString16Attribute(ui::AX_ATTR_DESCRIPTION);
base::string16 value = GetValue();
-
// On Windows, the value of a document should be its url.
if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA ||
GetRole() == ui::AX_ROLE_WEB_AREA) {
value = base::UTF8ToUTF16(manager()->GetTreeData().url);
}
-
// If this doesn't have a value and is linked then set its value to the url
// attribute. This allows screen readers to read an empty link's destination.
if (value.empty() && (ia_state() & STATE_SYSTEM_LINKED))
value = GetString16Attribute(ui::AX_ATTR_URL);
-
win_attributes_->value = value;
// Clear any old relationships between this node and other nodes.
@@ -3545,10 +3548,13 @@ void BrowserAccessibilityWin::UpdateStep1ComputeWinAttributes() {
}
void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() {
- if (PlatformIsLeaf()) {
- if (IsSimpleTextControl())
+ if (!PlatformChildCount()) {
+ if (IsSimpleTextControl()) {
win_attributes_->hypertext = value();
- else {
+ } else if (IsRichTextControl()) {
+ // We don't want to expose any associated label in IA2 Hypertext.
+ return;
+ } else {
win_attributes_->hypertext = name();
}
@@ -3569,6 +3575,11 @@ void BrowserAccessibilityWin::UpdateStep2ComputeHypertext() {
} else {
int32_t char_offset = static_cast<int32_t>(GetText().size());
int32_t child_id = child->GetId();
+ if (i == 0 && HasIntAttribute(ui::AX_ATTR_CHILD_TREE_ID)) {
+ // Cannot store IDs from another tree into this node. Store an invalid
+ // ID to signal that we are in this situation.
+ child_id = -1;
dmazzoni 2016/06/06 22:24:34 Use a unique id instead. Every BrowserAccessibilit
+ }
int32_t index = hyperlinks().size();
win_attributes_->hyperlink_offset_to_index[char_offset] = index;
win_attributes_->hyperlinks.push_back(child_id);
@@ -4032,7 +4043,13 @@ BrowserAccessibilityWin::GetHyperlinkFromHypertextOffset(int offset) const {
DCHECK_GE(index, 0);
DCHECK_LT(index, static_cast<int32_t>(hyperlinks().size()));
int32_t id = hyperlinks()[index];
- BrowserAccessibilityWin* hyperlink = GetFromID(id);
+ BrowserAccessibilityWin* hyperlink = nullptr;
+ if (id < 0) {
+ hyperlink = ToBrowserAccessibilityWin(PlatformGetChild(0));
+ } else {
+ hyperlink = GetFromID(id);
+ }
+
if (!hyperlink)
return nullptr;
return hyperlink;
« no previous file with comments | « no previous file | content/browser/accessibility/browser_accessibility_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698