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 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
7 | 7 |
8 #include <atlbase.h> | 8 #include <atlbase.h> |
9 #include <atlcom.h> | 9 #include <atlcom.h> |
10 #include <oleacc.h> | 10 #include <oleacc.h> |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 const { | 736 const { |
737 return win_attributes_->offset_to_text_attributes; | 737 return win_attributes_->offset_to_text_attributes; |
738 } | 738 } |
739 std::map<int32_t, int32_t>& hyperlink_offset_to_index() const { | 739 std::map<int32_t, int32_t>& hyperlink_offset_to_index() const { |
740 return win_attributes_->hyperlink_offset_to_index; | 740 return win_attributes_->hyperlink_offset_to_index; |
741 } | 741 } |
742 std::vector<int32_t>& hyperlinks() const { | 742 std::vector<int32_t>& hyperlinks() const { |
743 return win_attributes_->hyperlinks; | 743 return win_attributes_->hyperlinks; |
744 } | 744 } |
745 | 745 |
| 746 protected: |
| 747 // |offset| could either be a text character or a child index in case of |
| 748 // non-text objects. |
| 749 AXPlatformPositionInstance CreatePositionAt(int offset) const override; |
| 750 |
746 private: | 751 private: |
747 // Returns the IA2 text attributes for this object. | 752 // Returns the IA2 text attributes for this object. |
748 std::vector<base::string16> ComputeTextAttributes() const; | 753 std::vector<base::string16> ComputeTextAttributes() const; |
749 | 754 |
750 // Add one to the reference count and return the same object. Always | 755 // Add one to the reference count and return the same object. Always |
751 // use this method when returning a BrowserAccessibilityWin object as | 756 // use this method when returning a BrowserAccessibilityWin object as |
752 // an output parameter to a COM interface, never use it otherwise. | 757 // an output parameter to a COM interface, never use it otherwise. |
753 BrowserAccessibilityWin* NewReference(); | 758 BrowserAccessibilityWin* NewReference(); |
754 | 759 |
755 // Returns a list of IA2 attributes indicating the offsets in the text of a | 760 // Returns a list of IA2 attributes indicating the offsets in the text of a |
(...skipping 20 matching lines...) Expand all Loading... |
776 BSTR* value_bstr); | 781 BSTR* value_bstr); |
777 | 782 |
778 // Escapes characters in string attributes as required by the IA2 Spec. | 783 // Escapes characters in string attributes as required by the IA2 Spec. |
779 // It's okay for input to be the same as output. | 784 // It's okay for input to be the same as output. |
780 CONTENT_EXPORT static void SanitizeStringAttributeForIA2( | 785 CONTENT_EXPORT static void SanitizeStringAttributeForIA2( |
781 const base::string16& input, | 786 const base::string16& input, |
782 base::string16* output); | 787 base::string16* output); |
783 FRIEND_TEST_ALL_PREFIXES(BrowserAccessibilityTest, | 788 FRIEND_TEST_ALL_PREFIXES(BrowserAccessibilityTest, |
784 TestSanitizeStringAttributeForIA2); | 789 TestSanitizeStringAttributeForIA2); |
785 | 790 |
| 791 // Sets the selection given a start and end offset in IA2 Hypertext. |
| 792 void SetIA2HypertextSelection(LONG start_offset, LONG end_offset); |
| 793 |
786 // If the string attribute |attribute| is present, add its value as an | 794 // If the string attribute |attribute| is present, add its value as an |
787 // IAccessible2 attribute with the name |ia2_attr|. | 795 // IAccessible2 attribute with the name |ia2_attr|. |
788 void StringAttributeToIA2(ui::AXStringAttribute attribute, | 796 void StringAttributeToIA2(ui::AXStringAttribute attribute, |
789 const char* ia2_attr); | 797 const char* ia2_attr); |
790 | 798 |
791 // If the bool attribute |attribute| is present, add its value as an | 799 // If the bool attribute |attribute| is present, add its value as an |
792 // IAccessible2 attribute with the name |ia2_attr|. | 800 // IAccessible2 attribute with the name |ia2_attr|. |
793 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, | 801 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, |
794 const char* ia2_attr); | 802 const char* ia2_attr); |
795 | 803 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 // Get the value text, which might come from the floating-point | 859 // Get the value text, which might come from the floating-point |
852 // value for some roles. | 860 // value for some roles. |
853 base::string16 GetValueText(); | 861 base::string16 GetValueText(); |
854 | 862 |
855 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); | 863 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); |
856 void ComputeHypertextRemovedAndInserted( | 864 void ComputeHypertextRemovedAndInserted( |
857 int* start, int* old_len, int* new_len); | 865 int* start, int* old_len, int* new_len); |
858 | 866 |
859 // If offset is a member of IA2TextSpecialOffsets this function updates the | 867 // If offset is a member of IA2TextSpecialOffsets this function updates the |
860 // value of offset and returns, otherwise offset remains unchanged. | 868 // value of offset and returns, otherwise offset remains unchanged. |
861 void HandleSpecialTextOffset(const base::string16& text, LONG* offset); | 869 void HandleSpecialTextOffset(LONG* offset); |
862 | 870 |
863 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. | 871 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. |
864 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); | 872 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); |
865 | 873 |
866 // Search forwards (direction == 1) or backwards (direction == -1) | 874 // Search forwards (direction == 1) or backwards (direction == -1) |
867 // from the given offset until the given boundary is found, and | 875 // from the given offset until the given boundary is found, and |
868 // return the offset of that boundary. | 876 // return the offset of that boundary. |
869 LONG FindBoundary(const base::string16& text, | 877 LONG FindBoundary(const base::string16& text, |
870 IA2TextBoundaryType ia2_boundary, | 878 IA2TextBoundaryType ia2_boundary, |
871 LONG start_offset, | 879 LONG start_offset, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 976 |
969 CONTENT_EXPORT BrowserAccessibilityWin* | 977 CONTENT_EXPORT BrowserAccessibilityWin* |
970 ToBrowserAccessibilityWin(BrowserAccessibility* obj); | 978 ToBrowserAccessibilityWin(BrowserAccessibility* obj); |
971 | 979 |
972 CONTENT_EXPORT const BrowserAccessibilityWin* | 980 CONTENT_EXPORT const BrowserAccessibilityWin* |
973 ToBrowserAccessibilityWin(const BrowserAccessibility* obj); | 981 ToBrowserAccessibilityWin(const BrowserAccessibility* obj); |
974 | 982 |
975 } // namespace content | 983 } // namespace content |
976 | 984 |
977 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 985 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
OLD | NEW |