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 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 return [[[NSAttributedString alloc] initWithString:text] autorelease]; | 1768 return [[[NSAttributedString alloc] initWithString:text] autorelease]; |
1769 } | 1769 } |
1770 | 1770 |
1771 if ([attribute isEqualToString:@"AXNextTextMarkerForTextMarker"]) { | 1771 if ([attribute isEqualToString:@"AXNextTextMarkerForTextMarker"]) { |
1772 BrowserAccessibility* object; | 1772 BrowserAccessibility* object; |
1773 int offset; | 1773 int offset; |
1774 if (!GetTextMarkerData(parameter, &object, &offset)) | 1774 if (!GetTextMarkerData(parameter, &object, &offset)) |
1775 return nil; | 1775 return nil; |
1776 | 1776 |
1777 DCHECK(object); | 1777 DCHECK(object); |
1778 if (object->IsTextOnlyObject() && | 1778 if ((object->IsSimpleTextControl() || object->IsTextOnlyObject()) && |
1779 offset < static_cast<int>(object->GetText().length())) { | 1779 offset < static_cast<int>(object->GetText().length())) { |
1780 ++offset; | 1780 ++offset; |
1781 } else { | 1781 } else { |
1782 offset = 0; | |
1783 while (object && | 1782 while (object && |
1784 !(object->IsTextOnlyObject() && object->GetText().length() == 0)) { | 1783 !(object->IsTextOnlyObject() && object->GetText().length() == 0)) { |
1785 object = BrowserAccessibilityManager::NextTextOnlyObject(object); | 1784 object = BrowserAccessibilityManager::NextTextOnlyObject(object); |
1786 } | 1785 } |
1787 if (!object) | 1786 if (!object) |
1788 return nil; | 1787 return nil; |
1789 | 1788 |
1790 offset = 0; | 1789 offset = 0; |
1791 } | 1790 } |
1792 | 1791 |
1793 return CreateTextMarker(*object, offset); | 1792 return CreateTextMarker(*object, offset); |
1794 } | 1793 } |
1795 | 1794 |
1796 if ([attribute isEqualToString:@"AXPreviousTextMarkerForTextMarker"]) { | 1795 if ([attribute isEqualToString:@"AXPreviousTextMarkerForTextMarker"]) { |
1797 BrowserAccessibility* object; | 1796 BrowserAccessibility* object; |
1798 int offset; | 1797 int offset; |
1799 if (!GetTextMarkerData(parameter, &object, &offset)) | 1798 if (!GetTextMarkerData(parameter, &object, &offset)) |
1800 return nil; | 1799 return nil; |
1801 | 1800 |
1802 DCHECK(object); | 1801 DCHECK(object); |
1803 if (object->IsTextOnlyObject() && offset > 0) { | 1802 if ((object->IsSimpleTextControl() || object->IsTextOnlyObject()) && |
| 1803 offset > 0) { |
1804 --offset; | 1804 --offset; |
1805 } else { | 1805 } else { |
1806 while (object && | 1806 while (object && |
1807 !(object->IsTextOnlyObject() && object->GetText().length() == 0)) { | 1807 !(object->IsTextOnlyObject() && object->GetText().length() == 0)) { |
1808 object = BrowserAccessibilityManager::PreviousTextOnlyObject(object); | 1808 object = BrowserAccessibilityManager::PreviousTextOnlyObject(object); |
1809 } | 1809 } |
1810 if (!object) | 1810 if (!object) |
1811 return nil; | 1811 return nil; |
1812 | 1812 |
1813 offset = object->GetText().length() - 1; | 1813 offset = object->GetText().length() - 1; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2324 if (!browserAccessibility_) | 2324 if (!browserAccessibility_) |
2325 return [super hash]; | 2325 return [super hash]; |
2326 return browserAccessibility_->GetId(); | 2326 return browserAccessibility_->GetId(); |
2327 } | 2327 } |
2328 | 2328 |
2329 - (BOOL)accessibilityShouldUseUniqueId { | 2329 - (BOOL)accessibilityShouldUseUniqueId { |
2330 return YES; | 2330 return YES; |
2331 } | 2331 } |
2332 | 2332 |
2333 @end | 2333 @end |
OLD | NEW |