Chromium Code Reviews| 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; |