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

Side by Side Diff: ui/accessibility/ax_tree_data.cc

Issue 2191833003: Use text affinity to return correct accessible line boundaries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix bug in browser_accessibility_win.cc Created 4 years, 4 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 | « ui/accessibility/ax_tree_data.h ('k') | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "ui/accessibility/ax_tree_data.h" 5 #include "ui/accessibility/ax_tree_data.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 13
14 using base::DoubleToString; 14 using base::DoubleToString;
15 using base::IntToString; 15 using base::IntToString;
16 16
17 namespace ui { 17 namespace ui {
18 18
19 AXTreeData::AXTreeData() 19 AXTreeData::AXTreeData()
20 : tree_id(-1), 20 : tree_id(-1),
21 parent_tree_id(-1), 21 parent_tree_id(-1),
22 focused_tree_id(-1), 22 focused_tree_id(-1),
23 loaded(false), 23 loaded(false),
24 loading_progress(0.0), 24 loading_progress(0.0),
25 focus_id(-1), 25 focus_id(-1),
26 sel_anchor_object_id(-1), 26 sel_anchor_object_id(-1),
27 sel_anchor_offset(-1), 27 sel_anchor_offset(-1),
28 sel_anchor_affinity(AX_TEXT_AFFINITY_UPSTREAM),
28 sel_focus_object_id(-1), 29 sel_focus_object_id(-1),
29 sel_focus_offset(-1) { 30 sel_focus_offset(-1),
31 sel_focus_affinity(AX_TEXT_AFFINITY_DOWNSTREAM) {
30 } 32 }
31 33
32 AXTreeData::AXTreeData(const AXTreeData& other) = default; 34 AXTreeData::AXTreeData(const AXTreeData& other) = default;
33 35
34 AXTreeData::~AXTreeData() { 36 AXTreeData::~AXTreeData() {
35 } 37 }
36 38
37 // Note that this includes an initial space character if nonempty, but 39 // Note that this includes an initial space character if nonempty, but
38 // that works fine because this is normally printed by AXTree::ToString. 40 // that works fine because this is normally printed by AXTree::ToString.
39 std::string AXTreeData::ToString() const { 41 std::string AXTreeData::ToString() const {
(...skipping 18 matching lines...) Expand all
58 result += " url=" + url; 60 result += " url=" + url;
59 if (!title.empty()) 61 if (!title.empty())
60 result += " title=" + title; 62 result += " title=" + title;
61 63
62 if (focus_id != -1) 64 if (focus_id != -1)
63 result += " focus_id=" + IntToString(focus_id); 65 result += " focus_id=" + IntToString(focus_id);
64 66
65 if (sel_anchor_object_id != -1) { 67 if (sel_anchor_object_id != -1) {
66 result += " sel_anchor_object_id=" + IntToString(sel_anchor_object_id); 68 result += " sel_anchor_object_id=" + IntToString(sel_anchor_object_id);
67 result += " sel_anchor_offset=" + IntToString(sel_anchor_offset); 69 result += " sel_anchor_offset=" + IntToString(sel_anchor_offset);
70 result += " sel_anchor_affinity=" + ui::ToString(sel_anchor_affinity);
68 } 71 }
69 if (sel_focus_object_id != -1) { 72 if (sel_focus_object_id != -1) {
70 result += " sel_focus_object_id=" + IntToString(sel_focus_object_id); 73 result += " sel_focus_object_id=" + IntToString(sel_focus_object_id);
71 result += " sel_focus_offset=" + IntToString(sel_focus_offset); 74 result += " sel_focus_offset=" + IntToString(sel_focus_offset);
75 result += " sel_focus_affinity=" + ui::ToString(sel_focus_affinity);
72 } 76 }
73 77
74 return result; 78 return result;
75 } 79 }
76 80
77 bool operator==(const AXTreeData& lhs, const AXTreeData& rhs) { 81 bool operator==(const AXTreeData& lhs, const AXTreeData& rhs) {
78 return (lhs.tree_id == rhs.tree_id && 82 return (lhs.tree_id == rhs.tree_id &&
79 lhs.parent_tree_id == rhs.parent_tree_id && 83 lhs.parent_tree_id == rhs.parent_tree_id &&
80 lhs.focused_tree_id == rhs.focused_tree_id && 84 lhs.focused_tree_id == rhs.focused_tree_id &&
81 lhs.doctype == rhs.doctype && lhs.loaded == rhs.loaded && 85 lhs.doctype == rhs.doctype && lhs.loaded == rhs.loaded &&
82 lhs.loading_progress == rhs.loading_progress && 86 lhs.loading_progress == rhs.loading_progress &&
83 lhs.mimetype == rhs.mimetype && lhs.title == rhs.title && 87 lhs.mimetype == rhs.mimetype && lhs.title == rhs.title &&
84 lhs.url == rhs.url && lhs.focus_id == rhs.focus_id && 88 lhs.url == rhs.url && lhs.focus_id == rhs.focus_id &&
85 lhs.sel_anchor_object_id == rhs.sel_anchor_object_id && 89 lhs.sel_anchor_object_id == rhs.sel_anchor_object_id &&
86 lhs.sel_anchor_offset == rhs.sel_anchor_offset && 90 lhs.sel_anchor_offset == rhs.sel_anchor_offset &&
91 lhs.sel_anchor_affinity == rhs.sel_anchor_affinity &&
87 lhs.sel_focus_object_id == rhs.sel_focus_object_id && 92 lhs.sel_focus_object_id == rhs.sel_focus_object_id &&
88 lhs.sel_focus_offset == rhs.sel_focus_offset); 93 lhs.sel_focus_offset == rhs.sel_focus_offset &&
94 lhs.sel_focus_affinity == rhs.sel_focus_affinity);
89 } 95 }
90 96
91 bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs) { 97 bool operator!=(const AXTreeData& lhs, const AXTreeData& rhs) {
92 return !(lhs == rhs); 98 return !(lhs == rhs);
93 } 99 }
94 100
95 } // namespace ui 101 } // namespace ui
OLDNEW
« no previous file with comments | « ui/accessibility/ax_tree_data.h ('k') | ui/accessibility/platform/ax_platform_node_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698