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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: ui/accessibility/ax_action_data.cc
diff --git a/ui/accessibility/ax_action_data.cc b/ui/accessibility/ax_action_data.cc
new file mode 100644
index 0000000000000000000000000000000000000000..aad9db53ab35f40a9c64c1d0afacbe0270bd8cd4
--- /dev/null
+++ b/ui/accessibility/ax_action_data.cc
@@ -0,0 +1,61 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/accessibility/ax_action_data.h"
+
+#include <set>
+
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
+
+using base::IntToString;
+
+namespace ui {
+
+AXActionData::AXActionData()
+ : target_node_id(-1),
+ flags(0),
+ anchor_node_id(-1),
+ anchor_offset(-1),
+ focus_node_id(-1),
+ focus_offset(-1) {
+}
+
+AXActionData::AXActionData(const AXActionData& other) = default;
+
+AXActionData::~AXActionData() {
+}
+
+// Note that this includes an initial space character if nonempty, but
+// that works fine because this is normally printed by AXAction::ToString.
+std::string AXActionData::ToString() const {
+ std::string result;
+
+ if (target_node_id != -1)
+ result += " target_node_id=" + IntToString(target_node_id);
+
+ if (flags & (1 << ui::AX_ACTION_FLAGS_REQUEST_IMAGES))
+ result += " flag_request_images";
+
+ if (flags & (1 << ui::AX_ACTION_FLAGS_REQUEST_INLINE_TEXT_BOXES))
+ result += " flag_request_inline_text_boxes";
+
+ if (flags & (1 << ui::AX_ACTION_FLAGS_SET_SEQUENTIAL_FOCUS_NAVIGATION_POINT))
+ result += " flag_set_sequential_focus_navigation_point";
+
+ if (anchor_node_id != -1) {
+ result += " anchor_node_id=" + IntToString(anchor_node_id);
+ result += " anchor_offset=" + IntToString(anchor_offset);
+ }
+ if (focus_node_id != -1) {
+ result += " focus_node_id=" + IntToString(focus_node_id);
+ result += " focus_offset=" + IntToString(focus_offset);
+ }
+
+ return result;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698