Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: content/browser/accessibility/browser_accessibility_win.h

Issue 2692173003: Implemented SetSelection for the Web content on Windows. (Closed)
Patch Set: Fixed another compilation error on Windows. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 static CONTENT_EXPORT HRESULT WINAPI 711 static CONTENT_EXPORT HRESULT WINAPI
712 InternalQueryInterface(void* this_ptr, 712 InternalQueryInterface(void* this_ptr,
713 const _ATL_INTMAP_ENTRY* entries, 713 const _ATL_INTMAP_ENTRY* entries,
714 REFIID iid, 714 REFIID iid,
715 void** object); 715 void** object);
716 716
717 // Computes and caches the IA2 text style attributes for the text and other 717 // Computes and caches the IA2 text style attributes for the text and other
718 // embedded child objects. 718 // embedded child objects.
719 CONTENT_EXPORT void ComputeStylesIfNeeded(); 719 CONTENT_EXPORT void ComputeStylesIfNeeded();
720 720
721 // |offset| could either be a text character or a child index in case of
722 // non-text objects.
723 CONTENT_EXPORT AXPlatformPosition::AXPositionInstance CreatePositionAt(
724 int offset) const override;
725
721 CONTENT_EXPORT base::string16 GetText() const override; 726 CONTENT_EXPORT base::string16 GetText() const override;
722 727
723 // Accessors. 728 // Accessors.
724 int32_t ia_role() const { return win_attributes_->ia_role; } 729 int32_t ia_role() const { return win_attributes_->ia_role; }
725 int32_t ia_state() const { return win_attributes_->ia_state; } 730 int32_t ia_state() const { return win_attributes_->ia_state; }
726 const base::string16& role_name() const { return win_attributes_->role_name; } 731 const base::string16& role_name() const { return win_attributes_->role_name; }
727 int32_t ia2_role() const { return win_attributes_->ia2_role; } 732 int32_t ia2_role() const { return win_attributes_->ia2_role; }
728 int32_t ia2_state() const { return win_attributes_->ia2_state; } 733 int32_t ia2_state() const { return win_attributes_->ia2_state; }
729 const std::vector<base::string16>& ia2_attributes() const { 734 const std::vector<base::string16>& ia2_attributes() const {
730 return win_attributes_->ia2_attributes; 735 return win_attributes_->ia2_attributes;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 936
929 // IAccessible2 attributes. 937 // IAccessible2 attributes.
930 std::vector<base::string16> ia2_attributes; 938 std::vector<base::string16> ia2_attributes;
931 939
932 // Hypertext. 940 // Hypertext.
933 base::string16 hypertext; 941 base::string16 hypertext;
934 942
935 // Maps each style span to its start offset in hypertext. 943 // Maps each style span to its start offset in hypertext.
936 std::map<int, std::vector<base::string16>> offset_to_text_attributes; 944 std::map<int, std::vector<base::string16>> offset_to_text_attributes;
937 945
938 // Maps the |hypertext_| embedded character offset to an index in 946 // Maps an embedded character offset in |hypertext_| to an index in
939 // |hyperlinks_|. 947 // |hyperlinks_|.
940 std::map<int32_t, int32_t> hyperlink_offset_to_index; 948 std::map<int32_t, int32_t> hyperlink_offset_to_index;
941 949
942 // The unique id of a BrowserAccessibilityWin for each hyperlink. 950 // The unique id of a BrowserAccessibilityWin for each hyperlink.
943 // TODO(nektar): Replace object IDs with child indices if we decide that 951 // TODO(nektar): Replace object IDs with child indices if we decide that
944 // we are not implementing IA2 hyperlinks for anything other than IA2 952 // we are not implementing IA2 hyperlinks for anything other than IA2
945 // Hypertext. 953 // Hypertext.
946 std::vector<int32_t> hyperlinks; 954 std::vector<int32_t> hyperlinks;
947 }; 955 };
948 956
(...skipping 19 matching lines...) Expand all
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698