| 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; | 1782 do { |
| 1783 while (object && | |
| 1784 !(object->IsTextOnlyObject() && object->GetText().length() == 0)) { | |
| 1785 object = BrowserAccessibilityManager::NextTextOnlyObject(object); | 1783 object = BrowserAccessibilityManager::NextTextOnlyObject(object); |
| 1786 } | 1784 } while ( |
| 1785 object && |
| 1786 !(object->IsTextOnlyObject() && object->GetText().length() == 0)); |
| 1787 if (!object) | 1787 if (!object) |
| 1788 return nil; | 1788 return nil; |
| 1789 | 1789 |
| 1790 offset = 0; | 1790 offset = 0; |
| 1791 } | 1791 } |
| 1792 | 1792 |
| 1793 return CreateTextMarker(*object, offset); | 1793 return CreateTextMarker(*object, offset); |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 if ([attribute isEqualToString:@"AXPreviousTextMarkerForTextMarker"]) { | 1796 if ([attribute isEqualToString:@"AXPreviousTextMarkerForTextMarker"]) { |
| 1797 BrowserAccessibility* object; | 1797 BrowserAccessibility* object; |
| 1798 int offset; | 1798 int offset; |
| 1799 if (!GetTextMarkerData(parameter, &object, &offset)) | 1799 if (!GetTextMarkerData(parameter, &object, &offset)) |
| 1800 return nil; | 1800 return nil; |
| 1801 | 1801 |
| 1802 DCHECK(object); | 1802 DCHECK(object); |
| 1803 if (object->IsTextOnlyObject() && offset > 0) { | 1803 if ((object->IsSimpleTextControl() || object->IsTextOnlyObject()) && |
| 1804 offset > 0) { |
| 1804 --offset; | 1805 --offset; |
| 1805 } else { | 1806 } else { |
| 1806 while (object && | 1807 do { |
| 1807 !(object->IsTextOnlyObject() && object->GetText().length() == 0)) { | |
| 1808 object = BrowserAccessibilityManager::PreviousTextOnlyObject(object); | 1808 object = BrowserAccessibilityManager::PreviousTextOnlyObject(object); |
| 1809 } | 1809 } while ( |
| 1810 object && |
| 1811 !(object->IsTextOnlyObject() && object->GetText().length() == 0)); |
| 1810 if (!object) | 1812 if (!object) |
| 1811 return nil; | 1813 return nil; |
| 1812 | 1814 |
| 1813 offset = object->GetText().length() - 1; | 1815 offset = object->GetText().length() - 1; |
| 1814 } | 1816 } |
| 1815 | 1817 |
| 1816 return CreateTextMarker(*object, offset); | 1818 return CreateTextMarker(*object, offset); |
| 1817 } | 1819 } |
| 1818 | 1820 |
| 1819 if ([attribute | 1821 if ([attribute |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 if (!browserAccessibility_) | 2326 if (!browserAccessibility_) |
| 2325 return [super hash]; | 2327 return [super hash]; |
| 2326 return browserAccessibility_->GetId(); | 2328 return browserAccessibility_->GetId(); |
| 2327 } | 2329 } |
| 2328 | 2330 |
| 2329 - (BOOL)accessibilityShouldUseUniqueId { | 2331 - (BOOL)accessibilityShouldUseUniqueId { |
| 2330 return YES; | 2332 return YES; |
| 2331 } | 2333 } |
| 2332 | 2334 |
| 2333 @end | 2335 @end |
| OLD | NEW |