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
Reads announcements
  • Loading branch information
yaakovschectman committed Oct 26, 2022
commit 1d3b910ab186bc5eb15ff695a18bd263205e3c34
15 changes: 9 additions & 6 deletions shell/platform/windows/accessibility_alert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ IFACEMETHODIMP AccessibilityAlert::get_accDefaultAction(VARIANT var_id,

// Retrieves the tooltip description.
IFACEMETHODIMP AccessibilityAlert::get_accDescription(VARIANT var_id, BSTR* desc) {
*desc = nullptr;
return E_NOTIMPL;
*desc = SysAllocString(text_.c_str());
return S_OK;
}

// Retrieves the object that has the keyboard focus.
Expand All @@ -91,10 +91,13 @@ IFACEMETHODIMP AccessibilityAlert::get_accName(VARIANT var_id, BSTR* name) {

// Retrieves the IDispatch interface of the object's parent.
IFACEMETHODIMP AccessibilityAlert::get_accParent(IDispatch** disp_parent) {
//*disp_parent = parent_;
//return S_OK;
*disp_parent = nullptr;
return E_NOTIMPL;
*disp_parent = parent_;
if (*disp_parent) {
(*disp_parent)->AddRef();
}
return S_OK;
//*disp_parent = nullptr;
//return E_NOTIMPL;
}

// Retrieves information describing the role of the specified object.
Expand Down
1 change: 1 addition & 0 deletions shell/platform/windows/accessibility_root_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ AccessibilityAlert* AccessibilityRootNode::GetOrCreateAlert() {
if (!SUCCEEDED(hr)) {
FML_LOG(FATAL) << "Failed to create alert accessible";
}
instance->AddRef();
instance->SetParent(this);
alert_accessible_ = instance;
}
Expand Down
1 change: 0 additions & 1 deletion shell/platform/windows/flutter_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ void FlutterWindow::SendInitialAccessibilityFeatures() {
}

AccessibilityRootNode* FlutterWindow::GetAccessibilityRootNode() {
FML_LOG(ERROR) << "Returning accessibility_root_";
return accessibility_root_;
}

Expand Down
36 changes: 0 additions & 36 deletions shell/platform/windows/flutter_windows_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -673,46 +673,10 @@ void FlutterWindowsEngine::HandleAccessibilityMessage(FlutterDesktopMessengerRef
auto data = codec.DecodeMessage(message->message, message->message_size);
EncodableMap map = std::get<EncodableMap>(*data);
std::string type = std::get<std::string>(map.at(EncodableValue("type")));
FML_LOG(ERROR) << "Handling a11y call of type " << type;
if (type.compare("announce") == 0) {
if (semantics_enabled_) {
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 = {
.struct_size = sizeof(FlutterSemanticsNode),
.id = -1,
.flags = static_cast<FlutterSemanticsFlag>(0),
.actions = static_cast<FlutterSemanticsAction>(0),
.text_selection_base = -1,
.text_selection_extent = -1,
.label = text.c_str(),
.hint = "",
.value = "",
.increased_value = "",
.decreased_value = "",
.child_count = 0,
.children_in_traversal_order = nullptr,
.custom_accessibility_actions_count = 0,
.tooltip = ""
};
accessibility_bridge_->AddFlutterSemanticsNodeUpdate(&announcement);
accessibility_bridge_->CommitUpdates();
auto root = std::static_pointer_cast<FlutterPlatformNodeDelegateWindows>(accessibility_bridge_->GetFlutterPlatformNodeDelegateFromID(AccessibilityBridge::kRootNodeId).lock());
FML_LOG(ERROR) << "Got root? " << (!!root);
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);*/
std::wstring wide_text = fml::Utf8ToWideString(text);
view_->AnnounceAlert(wide_text);
}
Expand Down
2 changes: 0 additions & 2 deletions shell/platform/windows/window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ LRESULT Window::OnGetObject(UINT const message,
}
instance->AddRef();
accessibility_root_ = instance;
FML_LOG(ERROR) << "Creating accessibility root";
}
// Return the IAccessible for the root view.
//Microsoft::WRL::ComPtr<IAccessible> root(root_view);
Expand Down Expand Up @@ -614,7 +613,6 @@ void Window::Destroy() {
}

if (accessibility_root_) {
FML_LOG(ERROR) << "Destroying accessibility_root_!!\n";
accessibility_root_->Release();
accessibility_root_ = nullptr;
}
Expand Down