0

Split AXContentTreeData and AXContentTreeUpdate to separate files

Currently, AXContentTreeData and AXContentTreeUpdate are defined in
the same source files than AXContentNodeData (ax_content_node_data.h),
which makes it a bit unconvenient now that we are in the process of
removing all these classes, in favour of those from //ui/accessibility.

While technically this is not a requirement for the process, it would
be convenient to have each definition on separate places so that we
can work in a more iterative way towards removing those three classes,
so this CL puts AXContentTreeData in ax_content_tree_data.{h|cc} and
AXContentTreeupdate in ax_content_tree_update.h, in preparation for
the removal of ax_content_node_data.h, which will be the first step.

Bug: 1094150
Change-Id: Ied779d527fdff7dddeac896084872f4c15b31683
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2250603
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Mario Sanchez Prada <mario@igalia.com>
Cr-Commit-Position: refs/heads/master@{#780243}
This commit is contained in:
Mario Sanchez Prada
2020-06-19 10:28:41 +00:00
committed by Commit Bot
parent f4f8701ed9
commit 1cf6275e45
15 changed files with 93 additions and 33 deletions

@ -45,6 +45,7 @@
#include "content/browser/site_instance_impl.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_update.h"
#include "content/common/buildflags.h"
#include "content/common/content_export.h"
#include "content/common/dom_automation_controller.mojom.h"

@ -57,6 +57,9 @@ source_set("common") {
"appcache_interfaces.h",
"ax_content_node_data.cc",
"ax_content_node_data.h",
"ax_content_tree_data.cc",
"ax_content_tree_data.h",
"ax_content_tree_update.h",
"ax_serialization_utils.cc",
"ax_serialization_utils.h",
"background_fetch/background_fetch_types.cc",

@ -25,15 +25,4 @@ std::string AXContentNodeData::ToString() const {
return result;
}
std::string AXContentTreeData::ToString() const {
std::string result = AXTreeData::ToString();
if (routing_id != MSG_ROUTING_NONE)
result += " routing_id=" + NumberToString(routing_id);
if (parent_routing_id != MSG_ROUTING_NONE)
result += " parent_routing_id=" + NumberToString(parent_routing_id);
return result;
}
} // namespace ui

@ -10,8 +10,6 @@
#include "content/common/content_export.h"
#include "ipc/ipc_message.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_tree_data.h"
#include "ui/accessibility/ax_tree_update.h"
namespace content {
@ -30,25 +28,6 @@ struct CONTENT_EXPORT AXContentNodeData : public ui::AXNodeData {
int32_t child_routing_id = MSG_ROUTING_NONE;
};
// A subclass of AXTreeData that contains extra fields for
// content-layer-specific AX attributes.
struct CONTENT_EXPORT AXContentTreeData : public ui::AXTreeData {
AXContentTreeData() = default;
~AXContentTreeData() override = default;
// Return a string representation of this data, for debugging.
std::string ToString() const override;
// The routing ID of this frame.
int routing_id = MSG_ROUTING_NONE;
// The routing ID of the parent frame.
int parent_routing_id = MSG_ROUTING_NONE;
};
typedef ui::AXTreeUpdateBase<content::AXContentNodeData,
content::AXContentTreeData> AXContentTreeUpdate;
} // namespace content
#endif // CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_

@ -0,0 +1,24 @@
// Copyright 2020 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 "content/common/ax_content_tree_data.h"
#include "base/strings/string_number_conversions.h"
using base::NumberToString;
namespace content {
std::string AXContentTreeData::ToString() const {
std::string result = AXTreeData::ToString();
if (routing_id != MSG_ROUTING_NONE)
result += " routing_id=" + NumberToString(routing_id);
if (parent_routing_id != MSG_ROUTING_NONE)
result += " parent_routing_id=" + NumberToString(parent_routing_id);
return result;
}
} // namespace content

@ -0,0 +1,34 @@
// Copyright 2020 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.
#ifndef CONTENT_COMMON_AX_CONTENT_TREE_DATA_H_
#define CONTENT_COMMON_AX_CONTENT_TREE_DATA_H_
#include <stdint.h>
#include "content/common/content_export.h"
#include "ipc/ipc_message.h"
#include "ui/accessibility/ax_tree_data.h"
namespace content {
// A subclass of AXTreeData that contains extra fields for
// content-layer-specific AX attributes.
struct CONTENT_EXPORT AXContentTreeData : public ui::AXTreeData {
AXContentTreeData() = default;
~AXContentTreeData() override = default;
// Return a string representation of this data, for debugging.
std::string ToString() const override;
// The routing ID of this frame.
int routing_id = MSG_ROUTING_NONE;
// The routing ID of the parent frame.
int parent_routing_id = MSG_ROUTING_NONE;
};
} // namespace content
#endif // CONTENT_COMMON_AX_CONTENT_TREE_DATA_H_

@ -5,7 +5,7 @@
#ifndef CONTENT_COMMON_AX_CONTENT_TREE_DATA_MOJOM_TRAITS_H_
#define CONTENT_COMMON_AX_CONTENT_TREE_DATA_MOJOM_TRAITS_H_
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_data.h"
#include "content/common/ax_content_tree_data.mojom-shared.h"
#include "ui/accessibility/ax_tree_data.h"

@ -0,0 +1,21 @@
// Copyright 2020 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.
#ifndef CONTENT_COMMON_AX_CONTENT_TREE_UPDATE_H_
#define CONTENT_COMMON_AX_CONTENT_TREE_UPDATE_H_
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_data.h"
#include "content/common/content_export.h"
#include "ui/accessibility/ax_tree_update.h"
namespace content {
typedef ui::AXTreeUpdateBase<content::AXContentNodeData,
content::AXContentTreeData>
AXContentTreeUpdate;
} // namespace content
#endif // CONTENT_COMMON_AX_CONTENT_TREE_UPDATE_H_

@ -7,7 +7,9 @@
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_node_data_mojom_traits.h"
#include "content/common/ax_content_tree_data.h"
#include "content/common/ax_content_tree_data_mojom_traits.h"
#include "content/common/ax_content_tree_update.h"
#include "content/common/ax_content_tree_update.mojom-shared.h"
#include "ui/accessibility/mojom/ax_event_intent_mojom_traits.h"

@ -7,6 +7,7 @@
#include <string>
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_update.h"
#include "content/renderer/accessibility/render_accessibility_impl.h"
#include "third_party/blink/public/web/web_ax_enums.h"
#include "ui/accessibility/ax_enum_util.h"

@ -12,6 +12,7 @@
#include "base/optional.h"
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_data.h"
#include "third_party/blink/public/web/web_ax_object.h"
#include "third_party/blink/public/web/web_document.h"
#include "ui/accessibility/ax_mode.h"

@ -12,6 +12,8 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_data.h"
#include "content/common/ax_content_tree_update.h"
#include "content/common/content_export.h"
#include "content/common/render_accessibility.mojom.h"
#include "content/public/renderer/plugin_ax_tree_source.h"

@ -17,6 +17,7 @@
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/common/ax_content_tree_update.h"
#include "content/common/frame_messages.h"
#include "content/common/render_accessibility.mojom-test-utils.h"
#include "content/common/render_accessibility.mojom.h"

@ -9,6 +9,7 @@
#include "base/macros.h"
#include "content/common/ax_content_node_data.h"
#include "content/common/ax_content_tree_update.h"
#include "content/common/content_export.h"
#include "content/common/render_accessibility.mojom.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"

@ -50,6 +50,7 @@
#include "build/build_config.h"
#include "cc/base/switches.h"
#include "content/common/associated_interfaces.mojom.h"
#include "content/common/ax_content_tree_update.h"
#include "content/common/content_constants_internal.h"
#include "content/common/content_navigation_policy.h"
#include "content/common/frame.mojom.h"