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 3dc424aa6d40f6c3f5f2c0cfadb78dac91546f4a..05912e27eeb5aac41a37bc8bb774565e2ff7a3aa 100644 |
--- a/content/browser/accessibility/browser_accessibility_win.cc |
+++ b/content/browser/accessibility/browser_accessibility_win.cc |
@@ -930,11 +930,11 @@ STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { |
// the part before the "/". |
std::vector<std::string> product_components; |
base::SplitString(GetContentClient()->GetProduct(), '/', &product_components); |
- DCHECK_EQ(2U, product_components.size()); |
+ //DCHECK_EQ(2U, product_components.size()); |
dmazzoni
2015/02/20 18:16:21
if these checks are failing, please file a bug and
|
if (product_components.size() != 2) |
return E_FAIL; |
*app_name = SysAllocString(base::UTF8ToUTF16(product_components[0]).c_str()); |
- DCHECK(*app_name); |
+ //DCHECK(*app_name); |
return *app_name ? S_OK : E_FAIL; |
} |
@@ -949,12 +949,12 @@ STDMETHODIMP BrowserAccessibilityWin::get_appVersion(BSTR* app_version) { |
// the part after the "/". |
std::vector<std::string> product_components; |
base::SplitString(GetContentClient()->GetProduct(), '/', &product_components); |
- DCHECK_EQ(2U, product_components.size()); |
+ //DCHECK_EQ(2U, product_components.size()); |
if (product_components.size() != 2) |
return E_FAIL; |
*app_version = |
SysAllocString(base::UTF8ToUTF16(product_components[1]).c_str()); |
- DCHECK(*app_version); |
+ //DCHECK(*app_version); |
return *app_version ? S_OK : E_FAIL; |
} |
@@ -2091,6 +2091,15 @@ STDMETHODIMP BrowserAccessibilityWin::get_textAtOffset( |
if (!start_offset || !end_offset || !text) |
return E_INVALIDARG; |
+ const base::string16& text_str = TextForIAccessibleText(); |
+ HandleSpecialTextOffset(text_str, &offset); |
+ if (offset < 0) |
+ return E_INVALIDARG; |
+ |
+ LONG text_len = text_str.length(); |
+ if (offset > text_len) |
+ return E_INVALIDARG; |
+ |
// The IAccessible2 spec says we don't have to implement the "sentence" |
// boundary type, we can just let the screenreader handle it. |
if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
@@ -2100,7 +2109,14 @@ STDMETHODIMP BrowserAccessibilityWin::get_textAtOffset( |
return S_FALSE; |
} |
- const base::string16& text_str = TextForIAccessibleText(); |
+ // According to the IA2 Spec, only line boundaries should succeed when |
+ // the offset is one past the end of the text. |
+ if (offset == text_len && boundary_type != IA2_TEXT_BOUNDARY_LINE) { |
+ *start_offset = 0; |
+ *end_offset = 0; |
+ *text = nullptr; |
+ return S_FALSE; |
+ } |
*start_offset = FindBoundary( |
text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); |
@@ -3560,6 +3576,9 @@ LONG BrowserAccessibilityWin::FindBoundary( |
LONG start_offset, |
ui::TextBoundaryDirection direction) { |
HandleSpecialTextOffset(text, &start_offset); |
+ if (ia2_boundary == IA2_TEXT_BOUNDARY_WORD && IsEditableText()) |
+ return GetWordStartBoundary(static_cast<int>(start_offset), direction); |
+ |
ui::TextBoundaryType boundary = IA2TextBoundaryToTextBoundary(ia2_boundary); |
const std::vector<int32>& line_breaks = GetIntListAttribute( |
ui::AX_ATTR_LINE_BREAKS); |