| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
| 6 | 6 |
| 7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
| 8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 // boundary type, we can just let the screenreader handle it. | 2130 // boundary type, we can just let the screenreader handle it. |
| 2131 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2131 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
| 2132 *start_offset = 0; | 2132 *start_offset = 0; |
| 2133 *end_offset = 0; | 2133 *end_offset = 0; |
| 2134 *text = NULL; | 2134 *text = NULL; |
| 2135 return S_FALSE; | 2135 return S_FALSE; |
| 2136 } | 2136 } |
| 2137 | 2137 |
| 2138 // According to the IA2 Spec, only line boundaries should succeed when | 2138 // According to the IA2 Spec, only line boundaries should succeed when |
| 2139 // the offset is one past the end of the text. | 2139 // the offset is one past the end of the text. |
| 2140 if (offset == text_len && boundary_type != IA2_TEXT_BOUNDARY_LINE) { | 2140 if (offset == text_len) { |
| 2141 *start_offset = 0; | 2141 if (boundary_type == IA2_TEXT_BOUNDARY_LINE) { |
| 2142 *end_offset = 0; | 2142 --offset; |
| 2143 *text = nullptr; | 2143 } else { |
| 2144 return S_FALSE; | 2144 *start_offset = 0; |
| 2145 *end_offset = 0; |
| 2146 *text = nullptr; |
| 2147 return S_FALSE; |
| 2148 } |
| 2145 } | 2149 } |
| 2146 | 2150 |
| 2147 *start_offset = FindBoundary( | 2151 *start_offset = FindBoundary( |
| 2148 text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); | 2152 text_str, boundary_type, offset, ui::BACKWARDS_DIRECTION); |
| 2149 *end_offset = FindBoundary( | 2153 *end_offset = FindBoundary( |
| 2150 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); | 2154 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); |
| 2151 return get_text(*start_offset, *end_offset, text); | 2155 return get_text(*start_offset, *end_offset, text); |
| 2152 } | 2156 } |
| 2153 | 2157 |
| 2154 STDMETHODIMP BrowserAccessibilityWin::get_textBeforeOffset( | 2158 STDMETHODIMP BrowserAccessibilityWin::get_textBeforeOffset( |
| (...skipping 2808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4963 return static_cast<BrowserAccessibilityWin*>(obj); | 4967 return static_cast<BrowserAccessibilityWin*>(obj); |
| 4964 } | 4968 } |
| 4965 | 4969 |
| 4966 const BrowserAccessibilityWin* | 4970 const BrowserAccessibilityWin* |
| 4967 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 4971 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 4968 DCHECK(!obj || obj->IsNative()); | 4972 DCHECK(!obj || obj->IsNative()); |
| 4969 return static_cast<const BrowserAccessibilityWin*>(obj); | 4973 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 4970 } | 4974 } |
| 4971 | 4975 |
| 4972 } // namespace content | 4976 } // namespace content |
| OLD | NEW |