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

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

Issue 2410333005: Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Fix Android compile Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/accessibility/ax_action_data.h"
6
7 #include <set>
8
9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h"
11 #include "base/strings/stringprintf.h"
12 #include "base/strings/utf_string_conversions.h"
13
14 using base::IntToString;
15
16 namespace ui {
17
18 AXActionData::AXActionData()
19 : target_node_id(-1),
20 flags(0),
21 anchor_node_id(-1),
22 anchor_offset(-1),
23 focus_node_id(-1),
24 focus_offset(-1) {
25 }
26
27 AXActionData::AXActionData(const AXActionData& other) = default;
28
29 AXActionData::~AXActionData() {
30 }
31
32 // Note that this includes an initial space character if nonempty, but
33 // that works fine because this is normally printed by AXAction::ToString.
34 std::string AXActionData::ToString() const {
35 std::string result;
36
37 if (target_node_id != -1)
38 result += " target_node_id=" + IntToString(target_node_id);
39
40 if (flags & (1 << ui::AX_ACTION_FLAGS_REQUEST_IMAGES))
41 result += " flag_request_images";
42
43 if (flags & (1 << ui::AX_ACTION_FLAGS_REQUEST_INLINE_TEXT_BOXES))
44 result += " flag_request_inline_text_boxes";
45
46 if (flags & (1 << ui::AX_ACTION_FLAGS_SET_SEQUENTIAL_FOCUS_NAVIGATION_POINT))
47 result += " flag_set_sequential_focus_navigation_point";
48
49 if (anchor_node_id != -1) {
50 result += " anchor_node_id=" + IntToString(anchor_node_id);
51 result += " anchor_offset=" + IntToString(anchor_offset);
52 }
53 if (focus_node_id != -1) {
54 result += " focus_node_id=" + IntToString(focus_node_id);
55 result += " focus_offset=" + IntToString(focus_offset);
56 }
57
58 return result;
59 }
60
61 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698