| OLD | NEW |
| (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 : action(AX_ACTION_NONE), | |
| 20 target_node_id(-1), | |
| 21 flags(0), | |
| 22 anchor_node_id(-1), | |
| 23 anchor_offset(-1), | |
| 24 focus_node_id(-1), | |
| 25 focus_offset(-1) { | |
| 26 } | |
| 27 | |
| 28 AXActionData::AXActionData(const AXActionData& other) = default; | |
| 29 | |
| 30 AXActionData::~AXActionData() { | |
| 31 } | |
| 32 | |
| 33 // Note that this includes an initial space character if nonempty, but | |
| 34 // that works fine because this is normally printed by AXAction::ToString. | |
| 35 std::string AXActionData::ToString() const { | |
| 36 std::string result = ui::ToString(action); | |
| 37 | |
| 38 if (target_node_id != -1) | |
| 39 result += " target_node_id=" + IntToString(target_node_id); | |
| 40 | |
| 41 if (flags & (1 << ui::AX_ACTION_FLAGS_REQUEST_IMAGES)) | |
| 42 result += " flag_request_images"; | |
| 43 | |
| 44 if (flags & (1 << ui::AX_ACTION_FLAGS_REQUEST_INLINE_TEXT_BOXES)) | |
| 45 result += " flag_request_inline_text_boxes"; | |
| 46 | |
| 47 if (flags & (1 << ui::AX_ACTION_FLAGS_SET_SEQUENTIAL_FOCUS_NAVIGATION_POINT)) | |
| 48 result += " flag_set_sequential_focus_navigation_point"; | |
| 49 | |
| 50 if (anchor_node_id != -1) { | |
| 51 result += " anchor_node_id=" + IntToString(anchor_node_id); | |
| 52 result += " anchor_offset=" + IntToString(anchor_offset); | |
| 53 } | |
| 54 if (focus_node_id != -1) { | |
| 55 result += " focus_node_id=" + IntToString(focus_node_id); | |
| 56 result += " focus_offset=" + IntToString(focus_offset); | |
| 57 } | |
| 58 | |
| 59 return result; | |
| 60 } | |
| 61 | |
| 62 } // namespace ui | |
| OLD | NEW |