Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Create files necessary for alert node
  • Loading branch information
yaakovschectman committed Oct 26, 2022
commit cc0913c1ad00c63039c086715154f3b1eabbbe6d
5 changes: 5 additions & 0 deletions shell/platform/windows/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ source_set("flutter_windows_headers") {
source_set("flutter_windows_source") {
# Common Windows sources.
sources = [
"accessibility_alert.cc",
"accessibility_alert.h",
"accessibility_bridge_delegate_windows.cc",
"accessibility_bridge_delegate_windows.h",
"accessibility_root_node.cc",
"accessibility_root_node.h",
"angle_surface_manager.cc",
"angle_surface_manager.h",
"cursor_handler.cc",
Expand Down Expand Up @@ -172,6 +176,7 @@ executable("flutter_windows_unittests") {
# Common Windows test sources.
sources = [
"accessibility_bridge_delegate_windows_unittests.cc",
"accessibility_root_node_unittests.cc",
"direct_manipulation_unittests.cc",
"dpi_utils_unittests.cc",
"flutter_project_bundle_unittests.cc",
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
18 changes: 15 additions & 3 deletions shell/platform/windows/flutter_windows_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "flutter/shell/platform/windows/flutter_windows_view.h"
#include "flutter/shell/platform/windows/system_utils.h"
#include "flutter/shell/platform/windows/task_runner.h"
#include "flutter/third_party/accessibility/ax/ax_node.h"

// winbase.h defines GetCurrentTime as a macro.
#undef GetCurrentTime
Expand Down Expand Up @@ -678,7 +679,7 @@ void FlutterWindowsEngine::HandleAccessibilityMessage(FlutterDesktopMessengerRef
EncodableMap data_map = std::get<EncodableMap>(map.at(EncodableValue("data")));
std::string text = std::get<std::string>(data_map.at(EncodableValue("message")));
FML_LOG(ERROR) << "Announcing " << text;
FlutterSemanticsNode announcement = {
/*FlutterSemanticsNode announcement = {
.struct_size = sizeof(FlutterSemanticsNode),
.id = -1,
.flags = static_cast<FlutterSemanticsFlag>(0),
Expand All @@ -696,11 +697,22 @@ void FlutterWindowsEngine::HandleAccessibilityMessage(FlutterDesktopMessengerRef
.tooltip = ""
};
accessibility_bridge_->AddFlutterSemanticsNodeUpdate(&announcement);
accessibility_bridge_->CommitUpdates();
accessibility_bridge_->CommitUpdates();*/
auto root = std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(accessibility_bridge_->GetFlutterPlatformNodeDelegateFromID(AccessibilityBridge::kRootNodeId).lock());
FML_LOG(ERROR) << "Got root? " << (!!root);
int32_t root_id = root->GetAXNode()->id();
auto root_node = root->GetAXNode();
int32_t root_id = root_node->id();
FML_LOG(ERROR) << "Root id = " << root_id;
for (auto it = root_node->UnignoredChildrenBegin(); it != root_node->UnignoredChildrenEnd(); ++it) {
FML_LOG(ERROR) << "ID of child: " << it->id();
}
auto owner_tree = root_node->tree();
auto siblings = root_node->children();
int32_t index_in_parent = siblings.size();
int32_t uindex = root_node->GetUnignoredChildCount();
ui::AXNode* node = new ui::AXNode(owner_tree, root_node, -1, index_in_parent, uindex);
siblings.push_back(node);
root_node->SwapChildren(&siblings);
}
}
SendPlatformMessageResponse(message->response_handle, reinterpret_cast<const uint8_t*>(""), 0);
Expand Down