| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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_COM_WIN_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 // It's okay for input to be the same as output. | 781 // It's okay for input to be the same as output. |
| 782 CONTENT_EXPORT static void SanitizeStringAttributeForIA2( | 782 CONTENT_EXPORT static void SanitizeStringAttributeForIA2( |
| 783 const base::string16& input, | 783 const base::string16& input, |
| 784 base::string16* output); | 784 base::string16* output); |
| 785 FRIEND_TEST_ALL_PREFIXES(BrowserAccessibilityTest, | 785 FRIEND_TEST_ALL_PREFIXES(BrowserAccessibilityTest, |
| 786 TestSanitizeStringAttributeForIA2); | 786 TestSanitizeStringAttributeForIA2); |
| 787 | 787 |
| 788 // Sets the selection given a start and end offset in IA2 Hypertext. | 788 // Sets the selection given a start and end offset in IA2 Hypertext. |
| 789 void SetIA2HypertextSelection(LONG start_offset, LONG end_offset); | 789 void SetIA2HypertextSelection(LONG start_offset, LONG end_offset); |
| 790 | 790 |
| 791 // If the string attribute |attribute| is present, add its value as an | |
| 792 // IAccessible2 attribute with the name |ia2_attr|. | |
| 793 void StringAttributeToIA2(ui::AXStringAttribute attribute, | |
| 794 const char* ia2_attr); | |
| 795 | |
| 796 // If the bool attribute |attribute| is present, add its value as an | |
| 797 // IAccessible2 attribute with the name |ia2_attr|. | |
| 798 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, const char* ia2_attr); | |
| 799 | |
| 800 // If the int attribute |attribute| is present, add its value as an | |
| 801 // IAccessible2 attribute with the name |ia2_attr|. | |
| 802 void IntAttributeToIA2(ui::AXIntAttribute attribute, const char* ia2_attr); | |
| 803 | |
| 804 // | 791 // |
| 805 // Helper methods for IA2 hyperlinks. | 792 // Helper methods for IA2 hyperlinks. |
| 806 // | 793 // |
| 807 // Hyperlink is an IA2 misnomer. It refers to objects embedded within other | 794 // Hyperlink is an IA2 misnomer. It refers to objects embedded within other |
| 808 // objects, such as a numbered list within a contenteditable div. | 795 // objects, such as a numbered list within a contenteditable div. |
| 809 // Also, in IA2, text that includes embedded objects is called hypertext. | 796 // Also, in IA2, text that includes embedded objects is called hypertext. |
| 810 | 797 |
| 811 // Returns true if the current object is an IA2 hyperlink. | 798 // Returns true if the current object is an IA2 hyperlink. |
| 812 bool IsHyperlink() const; | 799 bool IsHyperlink() const; |
| 813 // Returns the hyperlink at the given text position, or nullptr if no | 800 // Returns the hyperlink at the given text position, or nullptr if no |
| (...skipping 29 matching lines...) Expand all Loading... |
| 843 // If not found they retrieve the global selection found on the current frame. | 830 // If not found they retrieve the global selection found on the current frame. |
| 844 int GetSelectionAnchor() const; | 831 int GetSelectionAnchor() const; |
| 845 int GetSelectionFocus() const; | 832 int GetSelectionFocus() const; |
| 846 // Retrieves the selection offsets in the way required by the IA2 APIs. | 833 // Retrieves the selection offsets in the way required by the IA2 APIs. |
| 847 // selection_start and selection_end are -1 when there is no selection active | 834 // selection_start and selection_end are -1 when there is no selection active |
| 848 // on this object. | 835 // on this object. |
| 849 // The greatest of the two offsets is one past the last character of the | 836 // The greatest of the two offsets is one past the last character of the |
| 850 // selection.) | 837 // selection.) |
| 851 void GetSelectionOffsets(int* selection_start, int* selection_end) const; | 838 void GetSelectionOffsets(int* selection_start, int* selection_end) const; |
| 852 | 839 |
| 853 // Get the range value text, which might come from aria-valuetext or | |
| 854 // a floating-point value. This is different from the value string | |
| 855 // attribute used in input controls such as text boxes and combo boxes. | |
| 856 base::string16 GetRangeValueText(); | |
| 857 | |
| 858 // Return true for roles that support the value interface | |
| 859 bool IsRangeValueSupported(); | |
| 860 | 840 |
| 861 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); | 841 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); |
| 862 void ComputeHypertextRemovedAndInserted(int* start, | 842 void ComputeHypertextRemovedAndInserted(int* start, |
| 863 int* old_len, | 843 int* old_len, |
| 864 int* new_len); | 844 int* new_len); |
| 865 | 845 |
| 866 // If offset is a member of IA2TextSpecialOffsets this function updates the | 846 // If offset is a member of IA2TextSpecialOffsets this function updates the |
| 867 // value of offset and returns, otherwise offset remains unchanged. | 847 // value of offset and returns, otherwise offset remains unchanged. |
| 868 void HandleSpecialTextOffset(LONG* offset); | 848 void HandleSpecialTextOffset(LONG* offset); |
| 869 | 849 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 // Clears all the forward relations from this object to any other object and | 884 // Clears all the forward relations from this object to any other object and |
| 905 // the associated reverse relations on the other objects, but leaves any | 885 // the associated reverse relations on the other objects, but leaves any |
| 906 // reverse relations on this object alone. | 886 // reverse relations on this object alone. |
| 907 void ClearOwnRelations(); | 887 void ClearOwnRelations(); |
| 908 void RemoveBidirectionalRelationsOfType( | 888 void RemoveBidirectionalRelationsOfType( |
| 909 const base::string16& relation_type, | 889 const base::string16& relation_type, |
| 910 const base::string16& reverse_relation_type); | 890 const base::string16& reverse_relation_type); |
| 911 void RemoveTargetFromRelation(const base::string16& relation_type, | 891 void RemoveTargetFromRelation(const base::string16& relation_type, |
| 912 int target_id); | 892 int target_id); |
| 913 | 893 |
| 914 // Updates object attributes of IA2 with html attributes. | |
| 915 void UpdateRequiredAttributes(); | |
| 916 | |
| 917 // Fire a Windows-specific accessibility event notification on this node. | 894 // Fire a Windows-specific accessibility event notification on this node. |
| 918 void FireNativeEvent(LONG win_event_type) const; | 895 void FireNativeEvent(LONG win_event_type) const; |
| 919 struct WinAttributes { | 896 struct WinAttributes { |
| 920 WinAttributes(); | 897 WinAttributes(); |
| 921 ~WinAttributes(); | 898 ~WinAttributes(); |
| 922 | 899 |
| 923 // IAccessible role and state. | 900 // IAccessible role and state. |
| 924 int32_t ia_role; | 901 int32_t ia_role; |
| 925 int32_t ia_state; | 902 int32_t ia_state; |
| 926 base::string16 role_name; | 903 base::string16 role_name; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 | 953 |
| 977 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityComWin); | 954 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityComWin); |
| 978 }; | 955 }; |
| 979 | 956 |
| 980 CONTENT_EXPORT BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( | 957 CONTENT_EXPORT BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( |
| 981 BrowserAccessibility* obj); | 958 BrowserAccessibility* obj); |
| 982 | 959 |
| 983 } // namespace content | 960 } // namespace content |
| 984 | 961 |
| 985 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ | 962 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COM_WIN_H_ |
| OLD | NEW |