| 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 <execinfo.h> | 5 #include <execinfo.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 9 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
| 10 | 10 |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 if (!browserAccessibility_->GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, | 1006 if (!browserAccessibility_->GetIntAttribute(ui::AX_ATTR_TEXT_SEL_START, |
| 1007 &selStart) || | 1007 &selStart) || |
| 1008 !browserAccessibility_->GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, | 1008 !browserAccessibility_->GetIntAttribute(ui::AX_ATTR_TEXT_SEL_END, |
| 1009 &selEnd)) { | 1009 &selEnd)) { |
| 1010 return nil; | 1010 return nil; |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 if (selStart > selEnd) | 1013 if (selStart > selEnd) |
| 1014 std::swap(selStart, selEnd); | 1014 std::swap(selStart, selEnd); |
| 1015 | 1015 |
| 1016 const std::vector<int32_t>& line_breaks = | 1016 const std::vector<int> line_breaks = |
| 1017 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LINE_BREAKS); | 1017 browserAccessibility_->GetLineStartOffsets(); |
| 1018 for (int i = 0; i < static_cast<int>(line_breaks.size()); ++i) { | 1018 for (int i = 0; i < static_cast<int>(line_breaks.size()); ++i) { |
| 1019 if (line_breaks[i] > selStart) | 1019 if (line_breaks[i] > selStart) |
| 1020 return [NSNumber numberWithInt:i]; | 1020 return [NSNumber numberWithInt:i]; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 return [NSNumber numberWithInt:static_cast<int>(line_breaks.size())]; | 1023 return [NSNumber numberWithInt:static_cast<int>(line_breaks.size())]; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 // Returns whether or not this node should be ignored in the | 1026 // Returns whether or not this node should be ignored in the |
| 1027 // accessibility tree. | 1027 // accessibility tree. |
| (...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 } | 1985 } |
| 1986 | 1986 |
| 1987 // Returns the accessibility value for the given attribute and parameter. If the | 1987 // Returns the accessibility value for the given attribute and parameter. If the |
| 1988 // value isn't supported this will return nil. | 1988 // value isn't supported this will return nil. |
| 1989 // TODO(nektar): Implement all unimplemented attributes, e.g. text markers. | 1989 // TODO(nektar): Implement all unimplemented attributes, e.g. text markers. |
| 1990 - (id)accessibilityAttributeValue:(NSString*)attribute | 1990 - (id)accessibilityAttributeValue:(NSString*)attribute |
| 1991 forParameter:(id)parameter { | 1991 forParameter:(id)parameter { |
| 1992 if (![self instanceActive]) | 1992 if (![self instanceActive]) |
| 1993 return nil; | 1993 return nil; |
| 1994 | 1994 |
| 1995 const std::vector<int32_t>& line_breaks = | 1995 const std::vector<int> line_breaks = |
| 1996 browserAccessibility_->GetIntListAttribute(ui::AX_ATTR_LINE_BREAKS); | 1996 browserAccessibility_->GetLineStartOffsets(); |
| 1997 base::string16 value = browserAccessibility_->GetValue(); | 1997 base::string16 value = browserAccessibility_->GetValue(); |
| 1998 int len = static_cast<int>(value.size()); | 1998 int len = static_cast<int>(value.size()); |
| 1999 | 1999 |
| 2000 if ([attribute isEqualToString: | 2000 if ([attribute isEqualToString: |
| 2001 NSAccessibilityStringForRangeParameterizedAttribute]) { | 2001 NSAccessibilityStringForRangeParameterizedAttribute]) { |
| 2002 return [self valueForRange:[(NSValue*)parameter rangeValue]]; | 2002 return [self valueForRange:[(NSValue*)parameter rangeValue]]; |
| 2003 } | 2003 } |
| 2004 | 2004 |
| 2005 if ([attribute | 2005 if ([attribute |
| 2006 isEqualToString: | 2006 isEqualToString: |
| (...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2878 if (![self instanceActive]) | 2878 if (![self instanceActive]) |
| 2879 return [super hash]; | 2879 return [super hash]; |
| 2880 return browserAccessibility_->GetId(); | 2880 return browserAccessibility_->GetId(); |
| 2881 } | 2881 } |
| 2882 | 2882 |
| 2883 - (BOOL)accessibilityShouldUseUniqueId { | 2883 - (BOOL)accessibilityShouldUseUniqueId { |
| 2884 return YES; | 2884 return YES; |
| 2885 } | 2885 } |
| 2886 | 2886 |
| 2887 @end | 2887 @end |
| OLD | NEW |