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

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

Issue 859133003: Fire AX text inserted event when embedded obj char changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 COM_INTERFACE_ENTRY(IRawElementProviderSimple) 75 COM_INTERFACE_ENTRY(IRawElementProviderSimple)
76 COM_INTERFACE_ENTRY(IServiceProvider) 76 COM_INTERFACE_ENTRY(IServiceProvider)
77 COM_INTERFACE_ENTRY(ISimpleDOMDocument) 77 COM_INTERFACE_ENTRY(ISimpleDOMDocument)
78 COM_INTERFACE_ENTRY(ISimpleDOMNode) 78 COM_INTERFACE_ENTRY(ISimpleDOMNode)
79 COM_INTERFACE_ENTRY(ISimpleDOMText) 79 COM_INTERFACE_ENTRY(ISimpleDOMText)
80 END_COM_MAP() 80 END_COM_MAP()
81 81
82 // Represents a non-static text node in IAccessibleHypertext. This character 82 // Represents a non-static text node in IAccessibleHypertext. This character
83 // is embedded in the response to IAccessibleText::get_text, indicating the 83 // is embedded in the response to IAccessibleText::get_text, indicating the
84 // position where a non-static text child object appears. 84 // position where a non-static text child object appears.
85 CONTENT_EXPORT static const base::char16 kEmbeddedCharacter[]; 85 CONTENT_EXPORT static const base::char16 kEmbeddedCharacter;
86 86
87 // Mappings from roles and states to human readable strings. Initialize 87 // Mappings from roles and states to human readable strings. Initialize
88 // with |InitializeStringMaps|. 88 // with |InitializeStringMaps|.
89 static std::map<int32, base::string16> role_string_map; 89 static std::map<int32, base::string16> role_string_map;
90 static std::map<int32, base::string16> state_string_map; 90 static std::map<int32, base::string16> state_string_map;
91 91
92 CONTENT_EXPORT BrowserAccessibilityWin(); 92 CONTENT_EXPORT BrowserAccessibilityWin();
93 93
94 CONTENT_EXPORT virtual ~BrowserAccessibilityWin(); 94 CONTENT_EXPORT virtual ~BrowserAccessibilityWin();
95 95
96 // The Windows-specific unique ID, used as the child ID for MSAA methods 96 // The Windows-specific unique ID, used as the child ID for MSAA methods
97 // like NotifyWinEvent, and as the unique ID for IAccessible2 and ISimpleDOM. 97 // like NotifyWinEvent, and as the unique ID for IAccessible2 and ISimpleDOM.
98 LONG unique_id_win() const { return unique_id_win_; } 98 LONG unique_id_win() const { return unique_id_win_; }
99 99
100 CONTENT_EXPORT void UpdateIAccessibleText(); 100 // Called after an atomic tree update completes. See
101 // BrowserAccessibilityManagerWin::OnAtomicUpdateFinished for more
102 // details on what these do.
103 CONTENT_EXPORT void UpdateStep1ComputeWinAttributes();
104 CONTENT_EXPORT void UpdateStep2ComputeHypertext();
105 CONTENT_EXPORT void UpdateStep3FireEvents(bool is_subtree_creation);
106 CONTENT_EXPORT void UpdateStep4DeleteOldWinAttributes();
101 107
102 // 108 //
103 // BrowserAccessibility methods. 109 // BrowserAccessibility methods.
104 // 110 //
105 CONTENT_EXPORT virtual void OnDataChanged() override;
106 CONTENT_EXPORT virtual void OnUpdateFinished() override;
107 CONTENT_EXPORT virtual void OnSubtreeWillBeDeleted() override; 111 CONTENT_EXPORT virtual void OnSubtreeWillBeDeleted() override;
108 CONTENT_EXPORT virtual void OnSubtreeCreationFinished() override;
109 CONTENT_EXPORT virtual void NativeAddReference() override; 112 CONTENT_EXPORT virtual void NativeAddReference() override;
110 CONTENT_EXPORT virtual void NativeReleaseReference() override; 113 CONTENT_EXPORT virtual void NativeReleaseReference() override;
111 CONTENT_EXPORT virtual bool IsNative() const override; 114 CONTENT_EXPORT virtual bool IsNative() const override;
112 CONTENT_EXPORT virtual void OnLocationChanged() override; 115 CONTENT_EXPORT virtual void OnLocationChanged() override;
113 116
114 // 117 //
115 // IAccessible methods. 118 // IAccessible methods.
116 // 119 //
117 120
118 // Performs the default action on a given object. 121 // Performs the default action on a given object.
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 const base::string16& role_name() const { return win_attributes_->role_name; } 787 const base::string16& role_name() const { return win_attributes_->role_name; }
785 int32 ia2_role() const { return win_attributes_->ia2_role; } 788 int32 ia2_role() const { return win_attributes_->ia2_role; }
786 int32 ia2_state() const { return win_attributes_->ia2_state; } 789 int32 ia2_state() const { return win_attributes_->ia2_state; }
787 const std::vector<base::string16>& ia2_attributes() const { 790 const std::vector<base::string16>& ia2_attributes() const {
788 return win_attributes_->ia2_attributes; 791 return win_attributes_->ia2_attributes;
789 } 792 }
790 base::string16 name() const { return win_attributes_->name; } 793 base::string16 name() const { return win_attributes_->name; }
791 base::string16 description() const { return win_attributes_->description; } 794 base::string16 description() const { return win_attributes_->description; }
792 base::string16 help() const { return win_attributes_->help; } 795 base::string16 help() const { return win_attributes_->help; }
793 base::string16 value() const { return win_attributes_->value; } 796 base::string16 value() const { return win_attributes_->value; }
797 base::string16 hypertext() const { return win_attributes_->hypertext; }
798 std::map<int32, int32>& hyperlink_offset_to_index() const {
799 return win_attributes_->hyperlink_offset_to_index;
800 }
801 std::vector<int32>& hyperlinks() const { return win_attributes_->hyperlinks; }
794 802
795 private: 803 private:
796 // Add one to the reference count and return the same object. Always 804 // Add one to the reference count and return the same object. Always
797 // use this method when returning a BrowserAccessibilityWin object as 805 // use this method when returning a BrowserAccessibilityWin object as
798 // an output parameter to a COM interface, never use it otherwise. 806 // an output parameter to a COM interface, never use it otherwise.
799 BrowserAccessibilityWin* NewReference(); 807 BrowserAccessibilityWin* NewReference();
800 808
801 // Many MSAA methods take a var_id parameter indicating that the operation 809 // Many MSAA methods take a var_id parameter indicating that the operation
802 // should be performed on a particular child ID, rather than this object. 810 // should be performed on a particular child ID, rather than this object.
803 // This method tries to figure out the target object from |var_id| and 811 // This method tries to figure out the target object from |var_id| and
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 base::string16 GetNameRecursive() const; 843 base::string16 GetNameRecursive() const;
836 844
837 // Get the value text, which might come from the floating-point 845 // Get the value text, which might come from the floating-point
838 // value for some roles. 846 // value for some roles.
839 base::string16 GetValueText(); 847 base::string16 GetValueText();
840 848
841 // Get the text of this node for the purposes of IAccessibleText - it may 849 // Get the text of this node for the purposes of IAccessibleText - it may
842 // be the name, it may be the value, etc. depending on the role. 850 // be the name, it may be the value, etc. depending on the role.
843 base::string16 TextForIAccessibleText(); 851 base::string16 TextForIAccessibleText();
844 852
853 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index);
845 void ComputeHypertextRemovedAndInserted( 854 void ComputeHypertextRemovedAndInserted(
846 int* start, int* old_len, int* new_len); 855 int* start, int* old_len, int* new_len);
847 856
848 // If offset is a member of IA2TextSpecialOffsets this function updates the 857 // If offset is a member of IA2TextSpecialOffsets this function updates the
849 // value of offset and returns, otherwise offset remains unchanged. 858 // value of offset and returns, otherwise offset remains unchanged.
850 void HandleSpecialTextOffset(const base::string16& text, LONG* offset); 859 void HandleSpecialTextOffset(const base::string16& text, LONG* offset);
851 860
852 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. 861 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType.
853 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type); 862 ui::TextBoundaryType IA2TextBoundaryToTextBoundary(IA2TextBoundaryType type);
854 863
(...skipping 27 matching lines...) Expand all
882 base::string16 description; 891 base::string16 description;
883 base::string16 help; 892 base::string16 help;
884 base::string16 value; 893 base::string16 value;
885 894
886 // IAccessible2 role and state. 895 // IAccessible2 role and state.
887 int32 ia2_role; 896 int32 ia2_role;
888 int32 ia2_state; 897 int32 ia2_state;
889 898
890 // IAccessible2 attributes. 899 // IAccessible2 attributes.
891 std::vector<base::string16> ia2_attributes; 900 std::vector<base::string16> ia2_attributes;
901
902 // Hypertext.
903 base::string16 hypertext;
904
905 // Maps the |hypertext_| embedded character offset to an index in
906 // |hyperlinks_|.
907 std::map<int32, int32> hyperlink_offset_to_index;
908
909 // The id of a BrowserAccessibilityWin for each hyperlink.
910 std::vector<int32> hyperlinks;
892 }; 911 };
893 912
894 scoped_ptr<WinAttributes> win_attributes_; 913 scoped_ptr<WinAttributes> win_attributes_;
895 914
896 // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or 915 // Only valid during the scope of a IA2_EVENT_TEXT_REMOVED or
897 // IA2_EVENT_TEXT_INSERTED event. 916 // IA2_EVENT_TEXT_INSERTED event.
898 scoped_ptr<WinAttributes> old_win_attributes_; 917 scoped_ptr<WinAttributes> old_win_attributes_;
899 918
900 // Relationships between this node and other nodes. 919 // Relationships between this node and other nodes.
901 std::vector<BrowserAccessibilityRelation*> relations_; 920 std::vector<BrowserAccessibilityRelation*> relations_;
902 921
903 // IAccessibleText text of this node including
904 // embedded hyperlink characters.
905 base::string16 old_hypertext_;
906 base::string16 hypertext_;
907
908 // Maps the |hypertext_| embedded character offset to an index in
909 // |hyperlinks_|.
910 std::map<int32, int32> hyperlink_offset_to_index_;
911
912 // Collection of non-static text child indicies, each of which corresponds to
913 // a hyperlink.
914 std::vector<int32> hyperlinks_;
915
916 // The previous scroll position, so we can tell if this object scrolled. 922 // The previous scroll position, so we can tell if this object scrolled.
917 int previous_scroll_x_; 923 int previous_scroll_x_;
918 int previous_scroll_y_; 924 int previous_scroll_y_;
919 925
920 // The next unique id to use. 926 // The next unique id to use.
921 static LONG next_unique_id_win_; 927 static LONG next_unique_id_win_;
922 928
923 // Give BrowserAccessibility::Create access to our constructor. 929 // Give BrowserAccessibility::Create access to our constructor.
924 friend class BrowserAccessibility; 930 friend class BrowserAccessibility;
925 friend class BrowserAccessibilityRelation; 931 friend class BrowserAccessibilityRelation;
926 932
927 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); 933 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin);
928 }; 934 };
929 935
930 } // namespace content 936 } // namespace content
931 937
932 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 938 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698