mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
!38555 Feat:支持表格或网格控件传递行列信息给无障碍
Merge pull request !38555 from Zhang Jinyu/accessibility
This commit is contained in:
commit
bf6a0ed967
@ -1257,6 +1257,9 @@ void JsAccessibilityManager::UpdateAccessibilityElementInfo(
|
||||
GridInfo gridInfo(accessibilityProperty->GetCollectionInfo().rows,
|
||||
accessibilityProperty->GetCollectionInfo().columns, accessibilityProperty->GetCollectionInfo().selectMode);
|
||||
nodeInfo.SetGrid(gridInfo);
|
||||
ExtraElementInfo extraElementInfo {};
|
||||
accessibilityProperty->GetAllExtraElementInfo(extraElementInfo);
|
||||
nodeInfo.SetExtraElement(extraElementInfo);
|
||||
|
||||
int32_t row = accessibilityProperty->GetCollectionItemInfo().row;
|
||||
int32_t column = accessibilityProperty->GetCollectionItemInfo().column;
|
||||
@ -2009,6 +2012,23 @@ inline void DumpContentListNG(const AccessibilityElementInfo& nodeInfo)
|
||||
DumpLog::GetInstance().AddDesc("content list: ", contents);
|
||||
}
|
||||
|
||||
static void DumpExtraElementInfoNG(const AccessibilityElementInfo& nodeInfo)
|
||||
{
|
||||
ExtraElementInfo extraElementInfo = nodeInfo.GetExtraElement();
|
||||
if (!extraElementInfo.GetExtraElementInfoValueStr().empty()) {
|
||||
for (auto i = extraElementInfo.GetExtraElementInfoValueStr().begin();
|
||||
i != extraElementInfo.GetExtraElementInfoValueStr().end(); ++i) {
|
||||
DumpLog::GetInstance().AddDesc("extra element info: ", i->first, i->second);
|
||||
}
|
||||
}
|
||||
if (!extraElementInfo.GetExtraElementInfoValueInt().empty()) {
|
||||
for (auto i = extraElementInfo.GetExtraElementInfoValueInt().begin();
|
||||
i != extraElementInfo.GetExtraElementInfoValueInt().end(); ++i) {
|
||||
DumpLog::GetInstance().AddDesc("extra element info: ", i->first, i->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo)
|
||||
{
|
||||
DumpLog::GetInstance().AddDesc("checked: ", BoolToString(nodeInfo.IsChecked()));
|
||||
@ -2050,6 +2070,7 @@ static void DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo
|
||||
DumpLog::GetInstance().AddDesc("content description: ", nodeInfo.GetDescriptionInfo());
|
||||
DumpLog::GetInstance().AddDesc("content invalid: ", BoolToString(nodeInfo.GetContentInvalid()));
|
||||
DumpLog::GetInstance().AddDesc("accessibility label: ", nodeInfo.GetLabeledAccessibilityId());
|
||||
DumpExtraElementInfoNG(nodeInfo);
|
||||
DumpLog::GetInstance().AddDesc(
|
||||
"trigger action: ", static_cast<int32_t>(ConvertAccessibilityAction(nodeInfo.GetTriggerAction())));
|
||||
DumpLog::GetInstance().AddDesc("text move step: " + std::to_string(nodeInfo.GetTextMovementStep()));
|
||||
|
@ -26,6 +26,10 @@
|
||||
#include "core/components_ng/base/inspector_filter.h"
|
||||
#include "core/components_ng/base/ui_node.h"
|
||||
|
||||
namespace OHOS::Accessibility {
|
||||
class ExtraElementInfo;
|
||||
}
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
using ActionNoParam = std::function<void()>;
|
||||
using ActionSetTextImpl = std::function<void(const std::string&)>;
|
||||
@ -45,6 +49,7 @@ using ActionGetCursorIndexImpl = std::function<int32_t(void)>;
|
||||
using ActionClickImpl = ActionNoParam;
|
||||
using ActionLongClickImpl = ActionNoParam;
|
||||
using ActionsImpl = std::function<void((uint32_t actionType))>;
|
||||
using GetRelatedElementInfoImpl = std::function<void(Accessibility::ExtraElementInfo& extraElementInfo)>;
|
||||
using OnAccessibilityFocusCallbackImpl = std::function<void((bool isFocus))>;
|
||||
|
||||
class FrameNode;
|
||||
@ -605,6 +610,21 @@ public:
|
||||
*/
|
||||
static bool IsAccessibilityFocusableDebug(const RefPtr<FrameNode>& node, std::unique_ptr<JsonValue>& info);
|
||||
|
||||
virtual void GetExtraElementInfo(Accessibility::ExtraElementInfo& extraElementInfo) {}
|
||||
|
||||
void SetRelatedElementInfoCallback(const GetRelatedElementInfoImpl& getRelatedElementInfoImpl)
|
||||
{
|
||||
getRelatedElementInfoImpl_ = getRelatedElementInfoImpl;
|
||||
}
|
||||
|
||||
void GetAllExtraElementInfo(Accessibility::ExtraElementInfo& extraElementInfo)
|
||||
{
|
||||
if (getRelatedElementInfoImpl_) {
|
||||
getRelatedElementInfoImpl_(extraElementInfo);
|
||||
}
|
||||
GetExtraElementInfo(extraElementInfo);
|
||||
}
|
||||
|
||||
void SetAccessibilityActions(uint32_t actions);
|
||||
void ResetAccessibilityActions();
|
||||
bool HasAccessibilityActions();
|
||||
@ -704,6 +724,7 @@ protected:
|
||||
ActionClickImpl actionClickImpl_;
|
||||
ActionLongClickImpl actionLongClickImpl_;
|
||||
ActionsImpl actionsImpl_;
|
||||
GetRelatedElementInfoImpl getRelatedElementInfoImpl_;
|
||||
OnAccessibilityFocusCallbackImpl onAccessibilityFocusCallbackImpl_;
|
||||
bool accessibilityGroup_ = false;
|
||||
int32_t childTreeId_ = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user