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

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

Issue 1377733002: Fixes for contenteditable caret and selection handling in Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed some more corner cases, updated tests to make them more resilient and added comments to the c… Created 5 years, 2 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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 768
769 // Functions that help in retrieving hyperlinks. Return -1 in case of failure. 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 770 // (Hyperlink is an IA2 misnomer. It refers to objects embedded within other
771 // objects, such as a numbered list within a contenteditable div.) 771 // objects, such as a numbered list within a contenteditable div.)
772 int32 GetHyperlinkIndexFromChild(const BrowserAccessibilityWin& child) const; 772 int32 GetHyperlinkIndexFromChild(const BrowserAccessibilityWin& child) const;
773 int32 GetHypertextOffsetFromHyperlinkIndex(int32 hyperlink_index) const; 773 int32 GetHypertextOffsetFromHyperlinkIndex(int32 hyperlink_index) const;
774 int32 GetHypertextOffsetFromChild(const BrowserAccessibilityWin& child) const; 774 int32 GetHypertextOffsetFromChild(const BrowserAccessibilityWin& child) const;
775 int32 GetHypertextOffsetFromDescendant( 775 int32 GetHypertextOffsetFromDescendant(
776 const BrowserAccessibilityWin& descendant) const; 776 const BrowserAccessibilityWin& descendant) const;
777 777
778 // If the selection endpoint is either equal to or an ancestor of this object,
dmazzoni 2015/09/30 20:09:56 Comment should mention when it returns -1 and why
779 // returns endpoint_offset.
780 // If the selection endpoint is a descendant of this object, returns its
781 // embedded character offset. Otherwise, returns either 0 or the length of the
782 // hypertext, depending on the direction of the selection.
783 int GetHypertextOffsetFromEndpoint(
784 const BrowserAccessibilityWin& endpoint_object,
785 int endpoint_offset) const;
786
778 // The following functions retrieve the endpoints of the current selection. 787 // 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. 788 // First they checks for a local selection found on the current control, e.g.
780 // when querying the selection on a textarea. 789 // when querying the selection on a textarea.
781 // If not found they retrieve the global selection found on the current frame. 790 // If not found they retrieve the global selection found on the current frame.
782 int GetSelectionAnchor() const; 791 int GetSelectionAnchor() const;
783 int GetSelectionFocus() const; 792 int GetSelectionFocus() const;
784 // Retrieves the selection offsets in the way required by the IA2 APIs. 793 // Retrieves the selection offsets in the way required by the IA2 APIs.
785 // (Selection_start is always <= selection_end and 794 // (Selection_start is always <= selection_end and
786 // selection_end is one past the last character of the selection.) 795 // selection_end is one past the last character of the selection.)
787 void GetSelectionOffsets(int* selection_start, int* selection_end) const; 796 void GetSelectionOffsets(int* selection_start, int* selection_end) const;
788 797
789 // Append the accessible name from this node and its children. 798 // Append the accessible name from this node and its children.
790 base::string16 GetNameRecursive() const; 799 base::string16 GetNameRecursive() const;
791 800
792 // Get the value text, which might come from the floating-point 801 // Get the value text, which might come from the floating-point
793 // value for some roles. 802 // value for some roles.
794 base::string16 GetValueText(); 803 base::string16 GetValueText();
795 804
796 // Get the text of this node for the purposes of IAccessibleText - it may 805 // Get the text of this node for the purposes of IAccessibleText - it may
797 // be the name, it may be the value, etc. depending on the role. 806 // be the name, it may be the value, etc. depending on the role.
798 base::string16 TextForIAccessibleText(); 807 base::string16 TextForIAccessibleText() const;
799 808
800 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index); 809 bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index);
801 void ComputeHypertextRemovedAndInserted( 810 void ComputeHypertextRemovedAndInserted(
802 int* start, int* old_len, int* new_len); 811 int* start, int* old_len, int* new_len);
803 812
804 // If offset is a member of IA2TextSpecialOffsets this function updates the 813 // If offset is a member of IA2TextSpecialOffsets this function updates the
805 // value of offset and returns, otherwise offset remains unchanged. 814 // value of offset and returns, otherwise offset remains unchanged.
806 void HandleSpecialTextOffset(const base::string16& text, LONG* offset); 815 void HandleSpecialTextOffset(const base::string16& text, LONG* offset);
807 816
808 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType. 817 // Convert from a IA2TextBoundaryType to a ui::TextBoundaryType.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 // Give BrowserAccessibility::Create access to our constructor. 892 // Give BrowserAccessibility::Create access to our constructor.
884 friend class BrowserAccessibility; 893 friend class BrowserAccessibility;
885 friend class BrowserAccessibilityRelation; 894 friend class BrowserAccessibilityRelation;
886 895
887 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin); 896 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityWin);
888 }; 897 };
889 898
890 } // namespace content 899 } // namespace content
891 900
892 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_ 901 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698