| 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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 // If the bool attribute |attribute| is present, add its value as an | 759 // If the bool attribute |attribute| is present, add its value as an |
| 760 // IAccessible2 attribute with the name |ia2_attr|. | 760 // IAccessible2 attribute with the name |ia2_attr|. |
| 761 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, | 761 void BoolAttributeToIA2(ui::AXBoolAttribute attribute, |
| 762 const char* ia2_attr); | 762 const char* ia2_attr); |
| 763 | 763 |
| 764 // If the int attribute |attribute| is present, add its value as an | 764 // If the int attribute |attribute| is present, add its value as an |
| 765 // IAccessible2 attribute with the name |ia2_attr|. | 765 // IAccessible2 attribute with the name |ia2_attr|. |
| 766 void IntAttributeToIA2(ui::AXIntAttribute attribute, | 766 void IntAttributeToIA2(ui::AXIntAttribute attribute, |
| 767 const char* ia2_attr); | 767 const char* ia2_attr); |
| 768 | 768 |
| 769 // Functions that help in retrieving hyperlinks. Return -1 in case of failure. |
| 770 // (Hyperlink is an IA2 misnomer. It refers to objects embedded within other |
| 771 // objects, such as a numbered list within a contenteditable div.) |
| 772 int32 GetHyperlinkIndexFromChild(const BrowserAccessibilityWin& child) const; |
| 773 int32 GetHypertextOffsetFromHyperlinkIndex(int32 hyperlink_index) const; |
| 774 int32 GetHypertextOffsetFromChild(const BrowserAccessibilityWin& child) const; |
| 775 int32 GetHypertextOffsetFromDescendant( |
| 776 const BrowserAccessibilityWin& descendant) const; |
| 777 |
| 778 // The following functions retrieve the endpoints of the current selection. |
| 779 // First they checks for a local selection found on the current control, e.g. |
| 780 // when querying the selection on a textarea. |
| 781 // If not found they retrieve the global selection found on the current frame. |
| 782 int GetSelectionAnchor() const; |
| 783 int GetSelectionFocus() const; |
| 784 // Retrieves the selection offsets in the way required by the IA2 APIs. |
| 785 // (Selection_start is always <= selection_end and |
| 786 // selection_end is one past the last character of the selection.) |
| 787 void GetSelectionOffsets(int* selection_start, int* selection_end) const; |
| 788 |
| 769 // Append the accessible name from this node and its children. | 789 // Append the accessible name from this node and its children. |
| 770 base::string16 GetNameRecursive() const; | 790 base::string16 GetNameRecursive() const; |
| 771 | 791 |
| 772 // Get the value text, which might come from the floating-point | 792 // Get the value text, which might come from the floating-point |
| 773 // value for some roles. | 793 // value for some roles. |
| 774 base::string16 GetValueText(); | 794 base::string16 GetValueText(); |
| 775 | 795 |
| 776 // Get the text of this node for the purposes of IAccessibleText - it may | 796 // Get the text of this node for the purposes of IAccessibleText - it may |
| 777 // be the name, it may be the value, etc. depending on the role. | 797 // be the name, it may be the value, etc. depending on the role. |
| 778 base::string16 TextForIAccessibleText(); | 798 base::string16 TextForIAccessibleText(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 int32 ia2_state; | 849 int32 ia2_state; |
| 830 | 850 |
| 831 // IAccessible2 attributes. | 851 // IAccessible2 attributes. |
| 832 std::vector<base::string16> ia2_attributes; | 852 std::vector<base::string16> ia2_attributes; |
| 833 | 853 |
| 834 // Hypertext. | 854 // Hypertext. |
| 835 base::string16 hypertext; | 855 base::string16 hypertext; |
| 836 | 856 |
| 837 // Maps the |hypertext_| embedded character offset to an index in | 857 // Maps the |hypertext_| embedded character offset to an index in |
| 838 // |hyperlinks_|. | 858 // |hyperlinks_|. |
| 859 // TODO(nektar): Replace map with vector of offsets. |
| 839 std::map<int32, int32> hyperlink_offset_to_index; | 860 std::map<int32, int32> hyperlink_offset_to_index; |
| 840 | 861 |
| 841 // The id of a BrowserAccessibilityWin for each hyperlink. | 862 // The id of a BrowserAccessibilityWin for each hyperlink. |
| 863 // TODO(nektar): Replace object IDs with child indices. |
| 842 std::vector<int32> hyperlinks; | 864 std::vector<int32> hyperlinks; |
| 843 }; | 865 }; |
| 844 | 866 |
| 845 scoped_ptr<WinAttributes> win_attributes_; | 867 scoped_ptr<WinAttributes> win_attributes_; |
| 846 | 868 |
| 847 // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or | 869 // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or |
| 848 // IA2_EVENT_TEXT_INSERTED event. | 870 // IA2_EVENT_TEXT_INSERTED event. |
| 849 scoped_ptr<WinAttributes> old_win_attributes_; | 871 scoped_ptr<WinAttributes> old_win_attributes_; |
| 850 | 872 |
| 851 // Relationships between this node and other nodes. | 873 // Relationships between this node and other nodes. |
| 852 std::vector<BrowserAccessibilityRelation*> relations_; | 874 std::vector<BrowserAccessibilityRelation*> relations_; |
| 853 | 875 |
| 854 // The previous scroll position, so we can tell if this object scrolled. | 876 // The previous scroll position, so we can tell if this object scrolled. |
| 855 int previous_scroll_x_; | 877 int previous_scroll_x_; |
| 856 int previous_scroll_y_; | 878 int previous_scroll_y_; |
| 857 | 879 |
| 858 // The next unique id to use. | 880 // The next unique id to use. |
| 859 static LONG next_unique_id_win_; | 881 static LONG next_unique_id_win_; |
| 860 | 882 |
| 861 // Give BrowserAccessibility::Create access to our constructor. | 883 // Give BrowserAccessibility::Create access to our constructor. |
| 862 friend class BrowserAccessibility; | 884 friend class BrowserAccessibility; |
| 863 friend class BrowserAccessibilityRelation; | 885 friend class BrowserAccessibilityRelation; |
| 864 | 886 |
| 865 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); | 887 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); |
| 866 }; | 888 }; |
| 867 | 889 |
| 868 } // namespace content | 890 } // namespace content |
| 869 | 891 |
| 870 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ | 892 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ |
| OLD | NEW |