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

Unified Diff: ui/accessibility/ax_action_data.cc

Issue 2426193003: Re-land: Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Rebase 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
« no previous file with comments | « ui/accessibility/ax_action_data.h ('k') | ui/accessibility/ax_enums.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..70ffcbba0902cbc7bcba524d03eb46dd29f793ae
--- /dev/null
+++ b/ui/accessibility/ax_action_data.cc
@@ -0,0 +1,62 @@
+// 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()
+ : action(AX_ACTION_NONE),
+ 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 = ui::ToString(action);
+
+ 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
« no previous file with comments | « ui/accessibility/ax_action_data.h ('k') | ui/accessibility/ax_enums.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698