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

Side by Side Diff: ui/accessibility/ax_position.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
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 UI_ACCESSIBILITY_AX_POSITION_H_ 5 #ifndef UI_ACCESSIBILITY_AX_POSITION_H_
6 #define UI_ACCESSIBILITY_AX_POSITION_H_ 6 #define UI_ACCESSIBILITY_AX_POSITION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } else { 139 } else {
140 str_text_offset = base::IntToString(text_offset_); 140 str_text_offset = base::IntToString(text_offset_);
141 } 141 }
142 str = "TextPosition tree_id=" + base::IntToString(tree_id_) + 142 str = "TextPosition tree_id=" + base::IntToString(tree_id_) +
143 " anchor_id=" + base::IntToString(anchor_id_) + " text_offset=" + 143 " anchor_id=" + base::IntToString(anchor_id_) + " text_offset=" +
144 str_text_offset + " affinity=" + 144 str_text_offset + " affinity=" +
145 ui::ToString(static_cast<AXTextAffinity>(affinity_)); 145 ui::ToString(static_cast<AXTextAffinity>(affinity_));
146 } 146 }
147 } 147 }
148 148
149 if (!IsTextPosition() || text_offset() > MaxTextOffset()) 149 if (!IsTextPosition() || text_offset_ > MaxTextOffset())
150 return str; 150 return str;
151 151
152 std::string text = base::UTF16ToUTF8(GetInnerText()); 152 std::string text = base::UTF16ToUTF8(GetInnerText());
153 DCHECK_GE(text_offset_, 0); 153 DCHECK_GE(text_offset_, 0);
154 DCHECK_LE(text_offset_, static_cast<int>(text.length())); 154 DCHECK_LE(text_offset_, static_cast<int>(text.length()));
155 std::string annotated_text; 155 std::string annotated_text;
156 if (text_offset() == MaxTextOffset()) { 156 if (text_offset_ == MaxTextOffset()) {
157 annotated_text = text + "<>"; 157 annotated_text = text + "<>";
158 } else { 158 } else {
159 annotated_text = text.substr(0, text_offset()) + "<" + 159 annotated_text = text.substr(0, text_offset_) + "<" + text[text_offset_] +
160 text[text_offset()] + ">" + 160 ">" + text.substr(text_offset_ + 1);
161 text.substr(text_offset() + 1);
162 } 161 }
163 162
164 return str + " annotated_text=" + annotated_text; 163 return str + " annotated_text=" + annotated_text;
165 } 164 }
166 165
167 int tree_id() const { return tree_id_; } 166 int tree_id() const { return tree_id_; }
168 int32_t anchor_id() const { return anchor_id_; } 167 int32_t anchor_id() const { return anchor_id_; }
169 168
170 AXNodeType* GetAnchor() const { 169 AXNodeType* GetAnchor() const {
171 if (tree_id_ == INVALID_TREE_ID || anchor_id_ == INVALID_ANCHOR_ID) 170 if (tree_id_ == INVALID_TREE_ID || anchor_id_ == INVALID_ANCHOR_ID)
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 1134
1136 template <class AXPositionType, class AXNodeType> 1135 template <class AXPositionType, class AXNodeType>
1137 bool operator>=(const AXPosition<AXPositionType, AXNodeType>& first, 1136 bool operator>=(const AXPosition<AXPositionType, AXNodeType>& first,
1138 const AXPosition<AXPositionType, AXNodeType>& second) { 1137 const AXPosition<AXPositionType, AXNodeType>& second) {
1139 return first == second || first > second; 1138 return first == second || first > second;
1140 } 1139 }
1141 1140
1142 } // namespace ui 1141 } // namespace ui
1143 1142
1144 #endif // UI_ACCESSIBILITY_AX_POSITION_H_ 1143 #endif // UI_ACCESSIBILITY_AX_POSITION_H_
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698