mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 07:01:24 +00:00
!42096 【无障碍(六)】三方平台接入无障碍使能
Merge pull request !42096 from dujingcheng/master
This commit is contained in:
commit
460bcbacf5
@ -126,7 +126,11 @@ template("ace_osal_ohos_source_set") {
|
||||
]
|
||||
if (defined(config.accessibility_support) &&
|
||||
config.accessibility_support) {
|
||||
sources += [ "js_accessibility_manager.cpp" ]
|
||||
sources += [
|
||||
"js_accessibility_manager.cpp",
|
||||
"js_third_accessibility_hover_ng.cpp",
|
||||
"js_third_provider_interaction_operation.cpp",
|
||||
]
|
||||
deps += [ "$ace_root/frameworks/bridge/common/accessibility:bridge_accessibility_$platform" ]
|
||||
external_deps += [
|
||||
"accessibility:accessibility_common",
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#include "frameworks/bridge/common/dom/dom_type.h"
|
||||
#include "frameworks/core/components_ng/pattern/web/web_pattern.h"
|
||||
#include "js_third_provider_interaction_operation.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
@ -69,34 +70,6 @@ constexpr int32_t CARD_BASE = 100000;
|
||||
const std::string ACTION_ARGU_SCROLL_STUB = "scrolltype"; // wait for change
|
||||
const std::string ACTION_DEFAULT_PARAM = "ACCESSIBILITY_ACTION_INVALID";
|
||||
|
||||
struct ActionTable {
|
||||
AceAction aceAction;
|
||||
ActionType action;
|
||||
};
|
||||
|
||||
struct ActionStrTable {
|
||||
ActionType action;
|
||||
std::string actionStr;
|
||||
};
|
||||
|
||||
struct FillEventInfoParam {
|
||||
int64_t elementId;
|
||||
int64_t stackNodeId;
|
||||
uint32_t windowId;
|
||||
};
|
||||
|
||||
struct AccessibilityActionParam {
|
||||
RefPtr<NG::AccessibilityProperty> accessibilityProperty;
|
||||
std::string setTextArgument = "";
|
||||
int32_t setSelectionStart = -1;
|
||||
int32_t setSelectionEnd = -1;
|
||||
bool setSelectionDir = false;
|
||||
int32_t setCursorIndex = -1;
|
||||
TextMoveUnit moveUnit = TextMoveUnit::STEP_CHARACTER;
|
||||
AccessibilityScrollType scrollType = AccessibilityScrollType::SCROLL_DEFAULT;
|
||||
int32_t spanId = -1;
|
||||
};
|
||||
|
||||
const std::map<Accessibility::ActionType, std::function<bool(const AccessibilityActionParam& param)>> ACTIONS = {
|
||||
{ ActionType::ACCESSIBILITY_ACTION_SCROLL_FORWARD,
|
||||
[](const AccessibilityActionParam& param) {
|
||||
@ -1295,6 +1268,7 @@ void UpdateChildrenOfAccessibilityElementInfo(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void JsAccessibilityManager::UpdateVirtualNodeChildAccessibilityElementInfo(
|
||||
@ -1909,7 +1883,61 @@ inline void DumpSpanListNG(const AccessibilityElementInfo& nodeInfo)
|
||||
DumpLog::GetInstance().AddDesc("span list: ", spans);
|
||||
}
|
||||
|
||||
static void DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo)
|
||||
inline string ChildrenToString(const vector<int64_t>& children, int32_t treeId)
|
||||
{
|
||||
std::string ids;
|
||||
for (auto child : children) {
|
||||
if (!ids.empty()) {
|
||||
ids.append(",");
|
||||
}
|
||||
int64_t childId = child;
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(treeId, childId);
|
||||
ids.append(std::to_string(childId));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
inline void DumpRectNG(const Accessibility::Rect& rect)
|
||||
{
|
||||
DumpLog::GetInstance().AddDesc(
|
||||
"width: ", std::to_string(rect.GetRightBottomXScreenPostion() - rect.GetLeftTopXScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc(
|
||||
"height: ", std::to_string(rect.GetRightBottomYScreenPostion() - rect.GetLeftTopYScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("left: ", std::to_string(rect.GetLeftTopXScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("top: ", std::to_string(rect.GetLeftTopYScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("right: ", std::to_string(rect.GetRightBottomXScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("bottom: ", std::to_string(rect.GetRightBottomYScreenPostion()));
|
||||
}
|
||||
|
||||
void GenerateAccessibilityEventInfo(const AccessibilityEvent& accessibilityEvent, AccessibilityEventInfo& eventInfo)
|
||||
{
|
||||
Accessibility::EventType type = Accessibility::EventType::TYPE_VIEW_INVALID;
|
||||
if (accessibilityEvent.type != AccessibilityEventType::UNKNOWN) {
|
||||
type = ConvertAceEventType(accessibilityEvent.type);
|
||||
} else {
|
||||
type = ConvertStrToEventType(accessibilityEvent.eventType);
|
||||
}
|
||||
|
||||
if (type == Accessibility::EventType::TYPE_VIEW_INVALID) {
|
||||
return;
|
||||
}
|
||||
|
||||
eventInfo.SetTimeStamp(GetMicroTickCount());
|
||||
eventInfo.SetBeforeText(accessibilityEvent.beforeText);
|
||||
eventInfo.SetLatestContent(accessibilityEvent.latestContent);
|
||||
eventInfo.SetTextAnnouncedForAccessibility(accessibilityEvent.textAnnouncedForAccessibility);
|
||||
eventInfo.SetWindowChangeTypes(static_cast<Accessibility::WindowUpdateType>(accessibilityEvent.windowChangeTypes));
|
||||
eventInfo.SetWindowContentChangeTypes(
|
||||
static_cast<Accessibility::WindowsContentChangeTypes>(accessibilityEvent.windowContentChangeTypes));
|
||||
eventInfo.SetSource(accessibilityEvent.nodeId);
|
||||
eventInfo.SetEventType(type);
|
||||
eventInfo.SetCurrentIndex(static_cast<int>(accessibilityEvent.currentItemIndex));
|
||||
eventInfo.SetItemCounts(static_cast<int>(accessibilityEvent.itemCount));
|
||||
eventInfo.SetBundleName(AceApplicationInfo::GetInstance().GetPackageName());
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void JsAccessibilityManager::DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo)
|
||||
{
|
||||
DumpLog::GetInstance().AddDesc("checked: ", BoolToString(nodeInfo.IsChecked()));
|
||||
DumpLog::GetInstance().AddDesc("selected: ", BoolToString(nodeInfo.IsSelected()));
|
||||
@ -1960,33 +1988,7 @@ static void DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo
|
||||
DumpLog::GetInstance().AddDesc("latest content: ", nodeInfo.GetLatestContent());
|
||||
}
|
||||
|
||||
inline string ChildernToString(const vector<int64_t>& children, int32_t treeId)
|
||||
{
|
||||
std::string ids;
|
||||
for (auto child : children) {
|
||||
if (!ids.empty()) {
|
||||
ids.append(",");
|
||||
}
|
||||
int64_t childId = child;
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(treeId, childId);
|
||||
ids.append(std::to_string(childId));
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
inline void DumpRectNG(const Accessibility::Rect& rect)
|
||||
{
|
||||
DumpLog::GetInstance().AddDesc(
|
||||
"width: ", std::to_string(rect.GetRightBottomXScreenPostion() - rect.GetLeftTopXScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc(
|
||||
"height: ", std::to_string(rect.GetRightBottomYScreenPostion() - rect.GetLeftTopYScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("left: ", std::to_string(rect.GetLeftTopXScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("top: ", std::to_string(rect.GetLeftTopYScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("right: ", std::to_string(rect.GetRightBottomXScreenPostion()));
|
||||
DumpLog::GetInstance().AddDesc("bottom: ", std::to_string(rect.GetRightBottomYScreenPostion()));
|
||||
}
|
||||
|
||||
static void DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32_t treeId)
|
||||
void JsAccessibilityManager::DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32_t treeId)
|
||||
{
|
||||
int64_t elementId = nodeInfo.GetAccessibilityId();
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(treeId, elementId);
|
||||
@ -1994,7 +1996,7 @@ static void DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32
|
||||
int64_t parentId = nodeInfo.GetParentNodeId();
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(treeId, parentId);
|
||||
DumpLog::GetInstance().AddDesc("parent ID: ", parentId);
|
||||
DumpLog::GetInstance().AddDesc("child IDs: ", ChildernToString(nodeInfo.GetChildIds(), treeId));
|
||||
DumpLog::GetInstance().AddDesc("child IDs: ", ChildrenToString(nodeInfo.GetChildIds(), treeId));
|
||||
DumpLog::GetInstance().AddDesc("component type: ", nodeInfo.GetComponentType());
|
||||
DumpLog::GetInstance().AddDesc("text: ", nodeInfo.GetContent());
|
||||
DumpLog::GetInstance().AddDesc("window id: " + std::to_string(nodeInfo.GetWindowId()));
|
||||
@ -2005,6 +2007,12 @@ static void DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32
|
||||
DumpLog::GetInstance().AddDesc("focused: ", BoolToString(nodeInfo.IsFocused()));
|
||||
DumpLog::GetInstance().AddDesc("visible: ", BoolToString(nodeInfo.IsVisible()));
|
||||
DumpLog::GetInstance().AddDesc("accessibility focused: ", BoolToString(nodeInfo.HasAccessibilityFocus()));
|
||||
DumpLog::GetInstance().AddDesc("accessibilityText: " + nodeInfo.GetAccessibilityText());
|
||||
DumpLog::GetInstance().AddDesc("accessibilityGroup: " + BoolToString(nodeInfo.GetAccessibilityGroup()));
|
||||
DumpLog::GetInstance().AddDesc("accessibilityLevel: " + nodeInfo.GetAccessibilityLevel());
|
||||
DumpLog::GetInstance().AddDesc("accessibilityDescription: " + nodeInfo.GetDescriptionInfo());
|
||||
DumpLog::GetInstance().AddDesc("hitTestBehavior: " + nodeInfo.GetHitTestBehavior());
|
||||
|
||||
DumpLog::GetInstance().AddDesc("inspector key: ", nodeInfo.GetInspectorKey());
|
||||
DumpLog::GetInstance().AddDesc("bundle name: ", nodeInfo.GetBundleName());
|
||||
DumpLog::GetInstance().AddDesc("page id: " + std::to_string(nodeInfo.GetPageId()));
|
||||
@ -2015,37 +2023,9 @@ static void DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32
|
||||
DumpLog::GetInstance().AddDesc("clickable: ", BoolToString(nodeInfo.IsClickable()));
|
||||
DumpLog::GetInstance().AddDesc("long clickable: ", BoolToString(nodeInfo.IsLongClickable()));
|
||||
DumpLog::GetInstance().AddDesc("popup supported: ", BoolToString(nodeInfo.IsPopupSupported()));
|
||||
DumpLog::GetInstance().AddDesc("zindex: ", std::to_string(nodeInfo.GetZIndex()));
|
||||
}
|
||||
|
||||
void GenerateAccessibilityEventInfo(const AccessibilityEvent& accessibilityEvent, AccessibilityEventInfo& eventInfo)
|
||||
{
|
||||
Accessibility::EventType type = Accessibility::EventType::TYPE_VIEW_INVALID;
|
||||
if (accessibilityEvent.type != AccessibilityEventType::UNKNOWN) {
|
||||
type = ConvertAceEventType(accessibilityEvent.type);
|
||||
} else {
|
||||
type = ConvertStrToEventType(accessibilityEvent.eventType);
|
||||
}
|
||||
|
||||
if (type == Accessibility::EventType::TYPE_VIEW_INVALID) {
|
||||
return;
|
||||
}
|
||||
|
||||
eventInfo.SetTimeStamp(GetMicroTickCount());
|
||||
eventInfo.SetBeforeText(accessibilityEvent.beforeText);
|
||||
eventInfo.SetLatestContent(accessibilityEvent.latestContent);
|
||||
eventInfo.SetTextAnnouncedForAccessibility(accessibilityEvent.textAnnouncedForAccessibility);
|
||||
eventInfo.SetWindowChangeTypes(static_cast<Accessibility::WindowUpdateType>(accessibilityEvent.windowChangeTypes));
|
||||
eventInfo.SetWindowContentChangeTypes(
|
||||
static_cast<Accessibility::WindowsContentChangeTypes>(accessibilityEvent.windowContentChangeTypes));
|
||||
eventInfo.SetSource(accessibilityEvent.nodeId);
|
||||
eventInfo.SetEventType(type);
|
||||
eventInfo.SetCurrentIndex(static_cast<int>(accessibilityEvent.currentItemIndex));
|
||||
eventInfo.SetItemCounts(static_cast<int>(accessibilityEvent.itemCount));
|
||||
eventInfo.SetBundleName(AceApplicationInfo::GetInstance().GetPackageName());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void JsAccessibilityManager::UpdateVirtualNodeFocus()
|
||||
{
|
||||
auto frameNode = lastFrameNode_.Upgrade();
|
||||
@ -4542,6 +4522,60 @@ void JsAccessibilityManager::UpdateWebCacheInfo(std::list<AccessibilityElementIn
|
||||
}
|
||||
#endif //WEB_SUPPORTED
|
||||
|
||||
bool JsAccessibilityManager::RegisterInteractionOperationAsChildTree(
|
||||
const Registration& registration)
|
||||
{
|
||||
bool ret = false;
|
||||
switch (registration.operatorType) {
|
||||
case OperatorType::JS_THIRD_PROVIDER:
|
||||
ret = RegisterThirdProviderInteractionOperationAsChildTree(registration);
|
||||
break;
|
||||
default:
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"RegisterInteractionOperationAsChildTree operatorType: %{public}d",
|
||||
static_cast<int32_t>(registration.operatorType));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool JsAccessibilityManager::RegisterThirdProviderInteractionOperationAsChildTree(
|
||||
const Registration& registration)
|
||||
{
|
||||
std::shared_ptr<AccessibilitySystemAbilityClient> instance =
|
||||
AccessibilitySystemAbilityClient::GetInstance();
|
||||
CHECK_NULL_RETURN(instance, false);
|
||||
Accessibility::Registration innerRegistration {
|
||||
.windowId = registration.windowId,
|
||||
.parentWindowId = registration.parentWindowId,
|
||||
.parentTreeId = registration.parentTreeId,
|
||||
.elementId = registration.elementId,
|
||||
};
|
||||
|
||||
auto provider = registration.accessibilityProvider.Upgrade();
|
||||
CHECK_NULL_RETURN(provider, false);
|
||||
auto interactionOperation = std::make_shared<JsThirdProviderInteractionOperation>(
|
||||
registration.accessibilityProvider, WeakClaim(this), registration.hostNode);
|
||||
provider->SendThirdAccessibilityProvider(interactionOperation);
|
||||
interactionOperation->Initialize();
|
||||
RegisterJsThirdProviderInteractionOperation(registration.elementId,
|
||||
interactionOperation);
|
||||
Accessibility::RetError retReg = instance->RegisterElementOperator(
|
||||
innerRegistration, interactionOperation);
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"RegisterWebInteractionOperationAsChildTree result: %{public}d", retReg);
|
||||
return retReg == RET_OK;
|
||||
}
|
||||
|
||||
bool JsAccessibilityManager::DeregisterInteractionOperationAsChildTree(
|
||||
uint32_t windowId, int32_t treeId)
|
||||
{
|
||||
std::shared_ptr<AccessibilitySystemAbilityClient> instance =
|
||||
AccessibilitySystemAbilityClient::GetInstance();
|
||||
CHECK_NULL_RETURN(instance, false);
|
||||
Accessibility::RetError retReg = instance->DeregisterElementOperator(windowId, treeId);
|
||||
return retReg == RET_OK;
|
||||
}
|
||||
|
||||
int JsAccessibilityManager::RegisterInteractionOperation(int windowId)
|
||||
{
|
||||
if (IsRegister()) {
|
||||
@ -5612,4 +5646,34 @@ void JsAccessibilityManager::DumpTreeNodeInfoInJson(
|
||||
std::string fulljson = prefix.append(content);
|
||||
DumpLog::GetInstance().PrintJson(fulljson);
|
||||
}
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
||||
|
||||
void JsAccessibilityManager::TransferThirdProviderHoverEvent(
|
||||
int64_t hostElementId, const NG::PointF &point, SourceType source,
|
||||
NG::AccessibilityHoverEventType eventType, TimeStamp time)
|
||||
{
|
||||
auto pipelineContext = GetPipelineContext().Upgrade();
|
||||
auto ngPipeline = AceType::DynamicCast<NG::PipelineContext>(pipelineContext);
|
||||
CHECK_NULL_VOID(ngPipeline);
|
||||
auto frameNode = GetFramenodeByAccessibilityId(
|
||||
ngPipeline->GetRootElement(), hostElementId);
|
||||
AccessibilityHoverForThirdConfig config;
|
||||
config.hostElementId = hostElementId;
|
||||
config.point = point;
|
||||
config.sourceType = source;
|
||||
config.eventType = eventType;
|
||||
config.time = time;
|
||||
config.hostNode = frameNode;
|
||||
config.context = ngPipeline;
|
||||
HandleAccessibilityHoverForThird(config);
|
||||
}
|
||||
|
||||
bool JsAccessibilityManager::OnDumpChildInfoForThird(
|
||||
int64_t hostElementId,
|
||||
const std::vector<std::string>& params,
|
||||
std::vector<std::string>& info)
|
||||
{
|
||||
return OnDumpChildInfoForThirdRecursive(hostElementId, params, info, WeakClaim(this));
|
||||
}
|
||||
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "core/accessibility/accessibility_utils.h"
|
||||
#include "frameworks/bridge/common/accessibility/accessibility_node_manager.h"
|
||||
|
||||
#include "js_third_accessibility_hover_ng.h"
|
||||
|
||||
namespace OHOS::NWeb {
|
||||
class NWebAccessibilityNodeInfo;
|
||||
} // namespace OHOS::NWeb::NWebAccessibilityNodeInfo
|
||||
@ -50,7 +52,41 @@ struct CommonProperty {
|
||||
std::string pagePath;
|
||||
};
|
||||
|
||||
class JsAccessibilityManager : public AccessibilityNodeManager {
|
||||
struct ActionTable {
|
||||
AceAction aceAction;
|
||||
ActionType action;
|
||||
};
|
||||
|
||||
struct ActionStrTable {
|
||||
ActionType action;
|
||||
std::string actionStr;
|
||||
};
|
||||
|
||||
struct FillEventInfoParam {
|
||||
int64_t elementId;
|
||||
int64_t stackNodeId;
|
||||
uint32_t windowId;
|
||||
};
|
||||
|
||||
struct AccessibilityActionParam {
|
||||
RefPtr<NG::AccessibilityProperty> accessibilityProperty;
|
||||
std::string setTextArgument = "";
|
||||
int32_t setSelectionStart = -1;
|
||||
int32_t setSelectionEnd = -1;
|
||||
bool setSelectionDir = false;
|
||||
int32_t setCursorIndex = -1;
|
||||
TextMoveUnit moveUnit = TextMoveUnit::STEP_CHARACTER;
|
||||
AccessibilityScrollType scrollType = AccessibilityScrollType::SCROLL_DEFAULT;
|
||||
int32_t spanId = -1;
|
||||
};
|
||||
|
||||
struct ActionParam {
|
||||
Accessibility::ActionType action;
|
||||
std::map<std::string, std::string> actionArguments;
|
||||
};
|
||||
|
||||
class JsAccessibilityManager : public AccessibilityNodeManager,
|
||||
public AccessibilityHoverManagerForThirdNG {
|
||||
DECLARE_ACE_TYPE(JsAccessibilityManager, AccessibilityNodeManager);
|
||||
|
||||
public:
|
||||
@ -65,6 +101,8 @@ public:
|
||||
void HandleComponentPostBinding() override;
|
||||
void RegisterSubWindowInteractionOperation(int windowId) override;
|
||||
void SetPipelineContext(const RefPtr<PipelineBase>& context) override;
|
||||
void UpdateElementInfosTreeId(std::list<Accessibility::AccessibilityElementInfo>& infos);
|
||||
void UpdateElementInfoTreeId(Accessibility::AccessibilityElementInfo& info);
|
||||
|
||||
void UpdateViewScale();
|
||||
|
||||
@ -116,10 +154,7 @@ public:
|
||||
Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId);
|
||||
void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId,
|
||||
Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId);
|
||||
struct ActionParam {
|
||||
Accessibility::ActionType action;
|
||||
std::map<std::string, std::string> actionArguments;
|
||||
};
|
||||
|
||||
void ExecuteAction(const int64_t accessibilityId, const ActionParam& param, const int32_t requestId,
|
||||
Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId);
|
||||
bool ClearCurrentFocus();
|
||||
@ -190,6 +225,20 @@ public:
|
||||
void SendEventToAccessibilityWithNode(const AccessibilityEvent& accessibilityEvent,
|
||||
const RefPtr<AceType>& node, const RefPtr<PipelineBase>& context) override;
|
||||
|
||||
bool RegisterInteractionOperationAsChildTree(const Registration& registration) override;
|
||||
bool DeregisterInteractionOperationAsChildTree(uint32_t windowId, int32_t treeId) override;
|
||||
|
||||
void TransferThirdProviderHoverEvent(
|
||||
int64_t elementId, const NG::PointF &point, SourceType source,
|
||||
NG::AccessibilityHoverEventType eventType, TimeStamp time) override;
|
||||
|
||||
void DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo);
|
||||
void DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32_t treeId);
|
||||
bool OnDumpChildInfoForThird(
|
||||
int64_t hostElementId,
|
||||
const std::vector<std::string>& params,
|
||||
std::vector<std::string>& info) override;
|
||||
|
||||
protected:
|
||||
void OnDumpInfoNG(const std::vector<std::string>& params, uint32_t windowId, bool hasJson = false) override;
|
||||
void DumpHandleEvent(const std::vector<std::string>& params) override;
|
||||
@ -369,6 +418,7 @@ private:
|
||||
const std::map<std::string, std::string>& actionArguments,
|
||||
Accessibility::ActionType& action, int64_t uiExtensionOffset);
|
||||
RefPtr<NG::FrameNode> FindNodeFromRootByExtensionId(const RefPtr<NG::FrameNode>& root, const int64_t uiExtensionId);
|
||||
bool RegisterThirdProviderInteractionOperationAsChildTree(const Registration& registration);
|
||||
|
||||
void DumpProperty(const RefPtr<AccessibilityNode>& node);
|
||||
void DumpPropertyNG(int64_t nodeID);
|
||||
@ -453,10 +503,6 @@ private:
|
||||
bool CheckIsChildElement(
|
||||
int64_t &elementId, const std::vector<std::string>& params, std::vector<std::string>& info);
|
||||
|
||||
void UpdateElementInfoTreeId(Accessibility::AccessibilityElementInfo& info);
|
||||
|
||||
void UpdateElementInfosTreeId(std::list<Accessibility::AccessibilityElementInfo>& infos);
|
||||
|
||||
bool NeedRegisterChildTree(uint32_t parentWindowId, int32_t parentTreeId, int64_t parentElementId);
|
||||
|
||||
void FillEventInfoWithNode(
|
||||
|
@ -12,16 +12,13 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "js_accessibility_manager.h"
|
||||
#include "core/accessibility/accessibility_manager_ng.h"
|
||||
#include "js_third_provider_interaction_operation.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "accessibility_constants.h"
|
||||
#include "accessibility_event_info.h"
|
||||
#include "accessibility_system_ability_client.h"
|
||||
|
||||
#include "adapter/ohos/entrance/ace_application_info.h"
|
||||
#include "adapter/ohos/entrance/ace_container.h"
|
||||
#include "base/log/ace_trace.h"
|
||||
@ -31,12 +28,15 @@
|
||||
#include "base/utils/linear_map.h"
|
||||
#include "base/utils/string_utils.h"
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/accessibility/accessibility_manager_ng.h"
|
||||
#include "core/components_ng/base/inspector.h"
|
||||
#include "core/components_v2/inspector/inspector_constants.h"
|
||||
#include "core/pipeline/pipeline_context.h"
|
||||
#include "core/pipeline_ng/pipeline_context.h"
|
||||
#include "frameworks/bridge/common/dom/dom_type.h"
|
||||
#include "frameworks/core/components_ng/pattern/web/web_pattern.h"
|
||||
#include "js_accessibility_manager.h"
|
||||
#include "js_third_accessibility_hover_ng.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
@ -44,36 +44,37 @@ using namespace OHOS::AccessibilityConfig;
|
||||
using namespace std;
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
|
||||
constexpr int32_t ACCESSIBILITY_FOCUS_WITHOUT_EVENT = -2100001;
|
||||
AccessibilityElementInfo nodeInfo_[9];
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::GetElementInfoForThird(
|
||||
bool AccessibilityHoverManagerForThirdNG::GetElementInfoForThird(
|
||||
int64_t elementId,
|
||||
AccessibilityElementInfo &info)
|
||||
{}
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::SendAccessibilityEventForThird(
|
||||
int64_t elementId,
|
||||
AccessibilityEventType eventType,
|
||||
WindowsContentChangeTypes windowsContentChangeType,
|
||||
RefPtr<NG::FrameNode> &hostNode,
|
||||
RefPtr<NG::PipelineContext> &context)
|
||||
AccessibilityElementInfo& info,
|
||||
int64_t hostElementId)
|
||||
{
|
||||
auto accessibilityManager = context->GetAccessibilityManager();
|
||||
auto jsAccessibilityManager =
|
||||
AceType::DynamicCast<JsAccessibilityManager>(accessibilityManager);;
|
||||
CHECK_NULL_VOID(jsAccessibilityManager);
|
||||
auto jsThirdProviderOperator =
|
||||
GetJsThirdProviderInteractionOperation(hostElementId).lock();
|
||||
if (jsThirdProviderOperator == nullptr) {
|
||||
TAG_LOGE(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"third jsThirdProviderOperator ptr is null, hostElementId %{public}" PRId64,
|
||||
hostElementId);
|
||||
return false;
|
||||
}
|
||||
|
||||
AccessibilityEvent event;
|
||||
event.type = eventType;
|
||||
event.windowContentChangeTypes = windowsContentChangeType;
|
||||
event.nodeId = elementId;
|
||||
SendThirdAccessibilityAsyncEvent(event, hostNode);
|
||||
std::list<Accessibility::AccessibilityElementInfo> infos;
|
||||
bool ret = jsThirdProviderOperator->FindAccessibilityNodeInfosByIdFromProvider(
|
||||
elementId, 0, 0, infos);
|
||||
if ((!ret) || (infos.size() == 0)) {
|
||||
TAG_LOGE(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"cannot get third elementinfo :%{public}" PRId64 ", ret: %{public}d",
|
||||
elementId, ret);
|
||||
return false;
|
||||
}
|
||||
info = infos.front();
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::UpdateSearchStrategyByHitTestModeStr(
|
||||
std::string &hitTestMode,
|
||||
std::string& hitTestMode,
|
||||
bool& shouldSearchSelf,
|
||||
bool& shouldSearchChildren)
|
||||
{
|
||||
@ -142,7 +143,8 @@ bool AccessibilityHoverManagerForThirdNG::HoverPathForThirdRecursive(
|
||||
const int64_t hostElementId,
|
||||
const NG::PointF& hoverPoint,
|
||||
const AccessibilityElementInfo& nodeInfo,
|
||||
AccessibilityHoverTestPathForThird& path)
|
||||
AccessibilityHoverTestPathForThird& path,
|
||||
NG::OffsetF hostOffset)
|
||||
{
|
||||
bool hitTarget = false;
|
||||
auto [shouldSearchSelf, shouldSearchChildren]
|
||||
@ -153,18 +155,25 @@ bool AccessibilityHoverManagerForThirdNG::HoverPathForThirdRecursive(
|
||||
auto width = rectInScreen.GetRightBottomXScreenPostion() - rectInScreen.GetLeftTopXScreenPostion();
|
||||
auto height = rectInScreen.GetRightBottomYScreenPostion() - rectInScreen.GetLeftTopYScreenPostion();
|
||||
NG::RectF rect { left, right, width, height };
|
||||
rect = rect - hostOffset;
|
||||
bool hitSelf = rect.IsInnerRegion(hoverPoint);
|
||||
if (hitSelf && shouldSearchSelf) {
|
||||
hitTarget = true;
|
||||
path.push_back(nodeInfo.GetAccessibilityId());
|
||||
}
|
||||
|
||||
TAG_LOGD(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"third hover elementId :%{public}" PRId64\
|
||||
", shouldSearchSelf: %{public}d shouldSearchChildren: %{public}d hitTarget: %{public}d ",
|
||||
nodeInfo.GetAccessibilityId(), shouldSearchSelf, shouldSearchChildren, hitTarget);
|
||||
if (shouldSearchChildren) {
|
||||
auto childrenIds = nodeInfo.GetChildIds();
|
||||
for (auto childId = childrenIds.rbegin(); childId != childrenIds.rend(); ++childId) {
|
||||
AccessibilityElementInfo childInfo;
|
||||
GetElementInfoForThird(*childId, childInfo);
|
||||
if (HoverPathForThirdRecursive(hostElementId, hoverPoint, childInfo, path)) {
|
||||
if (GetElementInfoForThird(*childId, childInfo, hostElementId) == false) {
|
||||
break;
|
||||
}
|
||||
if (HoverPathForThirdRecursive(
|
||||
hostElementId, hoverPoint, childInfo, path, hostOffset)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -175,10 +184,12 @@ bool AccessibilityHoverManagerForThirdNG::HoverPathForThirdRecursive(
|
||||
AccessibilityHoverTestPathForThird AccessibilityHoverManagerForThirdNG::HoverPathForThird(
|
||||
const int64_t hostElementId,
|
||||
const NG::PointF& point,
|
||||
AccessibilityElementInfo& rootInfo)
|
||||
AccessibilityElementInfo& rootInfo,
|
||||
NG::OffsetF hostOffset)
|
||||
{
|
||||
AccessibilityHoverTestPathForThird path;
|
||||
HoverPathForThirdRecursive(hostElementId, point, rootInfo, path);
|
||||
HoverPathForThirdRecursive(
|
||||
hostElementId, point, rootInfo, path, hostOffset);
|
||||
return path;
|
||||
}
|
||||
|
||||
@ -189,61 +200,65 @@ void AccessibilityHoverManagerForThirdNG::ResetHoverForThirdState()
|
||||
}
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::HandleAccessibilityHoverForThird(
|
||||
int64_t hostElementId,
|
||||
const NG::PointF& point,
|
||||
SourceType sourceType,
|
||||
NG::AccessibilityHoverEventType eventType,
|
||||
TimeStamp time,
|
||||
RefPtr<NG::FrameNode> &hostNode,
|
||||
RefPtr<NG::PipelineContext> &context)
|
||||
const AccessibilityHoverForThirdConfig& config)
|
||||
{
|
||||
if (eventType == NG::AccessibilityHoverEventType::ENTER) {
|
||||
CHECK_NULL_VOID(config.hostNode);
|
||||
if (config.eventType == NG::AccessibilityHoverEventType::ENTER) {
|
||||
ResetHoverForThirdState();
|
||||
}
|
||||
|
||||
std::vector<int64_t> currentNodesHovering;
|
||||
std::vector<int64_t> lastNodesHovering = hoverForThirdState_.nodesHovering;
|
||||
if (eventType != NG::AccessibilityHoverEventType::EXIT) {
|
||||
if (config.eventType != NG::AccessibilityHoverEventType::EXIT) {
|
||||
AccessibilityElementInfo rootInfo;
|
||||
GetElementInfoForThird(-1, rootInfo);
|
||||
if (GetElementInfoForThird(-1, rootInfo, config.hostElementId) == false) {
|
||||
return;
|
||||
}
|
||||
auto [displayOffset, err] = config.hostNode->GetPaintRectGlobalOffsetWithTranslate();
|
||||
AccessibilityHoverTestPathForThird path =
|
||||
HoverPathForThird(hostElementId, point, rootInfo);
|
||||
HoverPathForThird(config.hostElementId, config.point, rootInfo, displayOffset);
|
||||
for (const auto& node: path) {
|
||||
currentNodesHovering.push_back(node);
|
||||
}
|
||||
}
|
||||
|
||||
static constexpr int64_t INVALID_NODE_ID = -1;
|
||||
int64_t lastHoveringId = INVALID_NODE_ID;
|
||||
if (!lastNodesHovering.empty()) {
|
||||
lastHoveringId = lastNodesHovering.back();
|
||||
}
|
||||
|
||||
int64_t currentHoveringId = INVALID_NODE_ID;
|
||||
if (!currentNodesHovering.empty()) {
|
||||
currentHoveringId = currentNodesHovering.back();
|
||||
}
|
||||
|
||||
auto jsThirdProviderOperator = GetJsThirdProviderInteractionOperation(
|
||||
config.hostElementId).lock();
|
||||
if (jsThirdProviderOperator == nullptr) {
|
||||
TAG_LOGE(AceLogTag::ACE_ACCESSIBILITY, "jsThirdProviderOperator is null, "
|
||||
"hostElementId %{public}" PRId64, config.hostElementId);
|
||||
return;
|
||||
}
|
||||
if (lastHoveringId != INVALID_NODE_ID && lastHoveringId != currentHoveringId) {
|
||||
SendAccessibilityEventForThird(lastHoveringId, AccessibilityEventType::HOVER_EXIT_EVENT,
|
||||
WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_INVALID, hostNode, context);
|
||||
jsThirdProviderOperator->SendAccessibilityAsyncEventForThird(lastHoveringId,
|
||||
Accessibility::EventType::TYPE_VIEW_HOVER_EXIT_EVENT);
|
||||
}
|
||||
|
||||
if ((currentHoveringId != INVALID_NODE_ID) && (currentHoveringId != lastHoveringId)) {
|
||||
SendAccessibilityEventForThird(currentHoveringId, AccessibilityEventType::HOVER_ENTER_EVENT,
|
||||
WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_INVALID, hostNode, context);
|
||||
jsThirdProviderOperator->SendAccessibilityAsyncEventForThird(currentHoveringId,
|
||||
Accessibility::EventType::TYPE_VIEW_HOVER_ENTER_EVENT);
|
||||
}
|
||||
|
||||
hoverForThirdState_.nodesHovering = std::move(currentNodesHovering);
|
||||
hoverForThirdState_.time = time;
|
||||
hoverForThirdState_.source = sourceType;
|
||||
hoverForThirdState_.idle = eventType == NG::AccessibilityHoverEventType::EXIT;
|
||||
hoverForThirdState_.time = config.time;
|
||||
hoverForThirdState_.source = config.sourceType;
|
||||
hoverForThirdState_.idle = config.eventType == NG::AccessibilityHoverEventType::EXIT;
|
||||
}
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::SendThirdAccessibilityAsyncEvent(
|
||||
const AccessibilityEvent& accessibilityEvent,
|
||||
bool AccessibilityHoverManagerForThirdNG::ClearThirdAccessibilityFocus(
|
||||
const RefPtr<NG::FrameNode>& hostNode)
|
||||
{}
|
||||
{
|
||||
CHECK_NULL_RETURN(hostNode, false);
|
||||
RefPtr<NG::RenderContext> renderContext = hostNode->GetRenderContext();
|
||||
CHECK_NULL_RETURN(renderContext, false);
|
||||
renderContext->UpdateAccessibilityFocus(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AccessibilityHoverManagerForThirdNG::ActThirdAccessibilityFocus(
|
||||
int64_t elementId,
|
||||
@ -258,6 +273,9 @@ bool AccessibilityHoverManagerForThirdNG::ActThirdAccessibilityFocus(
|
||||
CHECK_NULL_RETURN(renderContext, false);
|
||||
if (isNeedClear) {
|
||||
renderContext->UpdateAccessibilityFocus(false);
|
||||
TAG_LOGD(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"third act Accessibility element Id %{public}" PRId64 "Focus clear",
|
||||
nodeInfo.GetAccessibilityId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -272,6 +290,142 @@ bool AccessibilityHoverManagerForThirdNG::ActThirdAccessibilityFocus(
|
||||
|
||||
renderContext->UpdateAccessibilityFocusRect(rectInt);
|
||||
renderContext->UpdateAccessibilityFocus(true, ACCESSIBILITY_FOCUS_WITHOUT_EVENT);
|
||||
TAG_LOGD(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"third act Accessibility element Id %{public}" PRId64 "Focus",
|
||||
nodeInfo.GetAccessibilityId());
|
||||
return true;
|
||||
}
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::RegisterJsThirdProviderInteractionOperation(
|
||||
int64_t hostElementId,
|
||||
const std::shared_ptr<JsThirdProviderInteractionOperation>& jsThirdProviderOperator)
|
||||
{
|
||||
jsThirdProviderOperator_[hostElementId] = jsThirdProviderOperator;
|
||||
}
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::DeregisterJsThirdProviderInteractionOperation(
|
||||
int64_t hostElementId)
|
||||
{
|
||||
jsThirdProviderOperator_.erase(hostElementId);
|
||||
}
|
||||
|
||||
namespace {
|
||||
enum class DumpMode {
|
||||
TREE,
|
||||
NODE,
|
||||
HANDLE_EVENT,
|
||||
HOVER_TEST
|
||||
};
|
||||
|
||||
struct DumpInfoArgument {
|
||||
bool useWindowId = false;
|
||||
DumpMode mode = DumpMode::TREE;
|
||||
bool isDumpSimplify = false;
|
||||
bool verbose = false;
|
||||
int64_t rootId = -1;
|
||||
int32_t pointX = 0;
|
||||
int32_t pointY = 0;
|
||||
int64_t nodeId = -1;
|
||||
int32_t action = 0;
|
||||
};
|
||||
|
||||
bool GetDumpInfoArgument(const std::vector<std::string>& params, DumpInfoArgument& argument)
|
||||
{
|
||||
argument.isDumpSimplify = params[0].compare("-simplify") == 0;
|
||||
for (auto arg = params.begin() + 1; arg != params.end(); ++arg) {
|
||||
if (*arg == "-w") {
|
||||
argument.useWindowId = true;
|
||||
} else if (*arg == "--root") {
|
||||
++arg;
|
||||
if (arg == params.end()) {
|
||||
DumpLog::GetInstance().Print(std::string("Error: --root is used to set the root node, ") +
|
||||
"e.g. '--root ${AccessibilityId}'!");
|
||||
return false;
|
||||
}
|
||||
argument.rootId = StringUtils::StringToLongInt(*arg);
|
||||
} else if (*arg == "--hover-test") {
|
||||
argument.mode = DumpMode::HOVER_TEST;
|
||||
static constexpr int32_t NUM_POINT_DIMENSION = 2;
|
||||
if (std::distance(arg, params.end()) <= NUM_POINT_DIMENSION) {
|
||||
DumpLog::GetInstance().Print(std::string("Error: --hover-test is used to get nodes at a point ") +
|
||||
"relative to the root node, e.g. '--hover-test ${x} ${y}'!");
|
||||
return false;
|
||||
}
|
||||
++arg;
|
||||
argument.pointX = StringUtils::StringToInt(*arg);
|
||||
++arg;
|
||||
argument.pointY = StringUtils::StringToInt(*arg);
|
||||
} else if (*arg == "-v") {
|
||||
argument.verbose = true;
|
||||
} else if (*arg == "-json") {
|
||||
argument.mode = DumpMode::TREE;
|
||||
} else {
|
||||
if (argument.mode == DumpMode::NODE) {
|
||||
argument.mode = DumpMode::HANDLE_EVENT;
|
||||
argument.action = StringUtils::StringToInt(*arg);
|
||||
break;
|
||||
} else {
|
||||
argument.mode = DumpMode::NODE;
|
||||
argument.nodeId = StringUtils::StringToLongInt(*arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void AccessibilityHoverManagerForThirdNG::DumpPropertyForThird(
|
||||
int64_t elementId,
|
||||
const WeakPtr<JsAccessibilityManager>& jsAccessibilityManager,
|
||||
const std::shared_ptr<JsThirdProviderInteractionOperation>& jsThirdProviderOperator)
|
||||
{
|
||||
auto jsAccessibilityManagerTemp = jsAccessibilityManager.Upgrade();
|
||||
CHECK_NULL_VOID(jsAccessibilityManagerTemp);
|
||||
int64_t splitElementId = AccessibilityElementInfo::UNDEFINED_ACCESSIBILITY_ID;
|
||||
int32_t splitTreeId = AccessibilityElementInfo::UNDEFINED_TREE_ID;
|
||||
AccessibilitySystemAbilityClient::GetTreeIdAndElementIdBySplitElementId(
|
||||
elementId, splitElementId, splitTreeId);
|
||||
std::list<Accessibility::AccessibilityElementInfo> infos;
|
||||
bool ret = jsThirdProviderOperator->FindAccessibilityNodeInfosByIdFromProvider(
|
||||
splitElementId, 0, 0, infos);
|
||||
if ((!ret) || (infos.size() == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Accessibility::AccessibilityElementInfo info = infos.front();
|
||||
jsAccessibilityManagerTemp->DumpCommonPropertyNG(info, splitTreeId);
|
||||
jsAccessibilityManagerTemp->DumpAccessibilityPropertyNG(info);
|
||||
DumpLog::GetInstance().Print(0, info.GetComponentType(), info.GetChildCount());
|
||||
}
|
||||
|
||||
bool AccessibilityHoverManagerForThirdNG::OnDumpChildInfoForThirdRecursive(
|
||||
int64_t hostElementId,
|
||||
const std::vector<std::string>& params,
|
||||
std::vector<std::string>& info,
|
||||
const WeakPtr<JsAccessibilityManager>& jsAccessibilityManager)
|
||||
{
|
||||
DumpInfoArgument argument;
|
||||
if (GetDumpInfoArgument(params, argument) == false) {
|
||||
return true;
|
||||
}
|
||||
auto jsThirdProviderOperator =
|
||||
GetJsThirdProviderInteractionOperation(hostElementId).lock();
|
||||
if (jsThirdProviderOperator == nullptr) {
|
||||
return true;
|
||||
}
|
||||
switch (argument.mode) {
|
||||
case DumpMode::NODE:
|
||||
DumpPropertyForThird(argument.nodeId, jsAccessibilityManager, jsThirdProviderOperator);
|
||||
break;
|
||||
case DumpMode::TREE:
|
||||
case DumpMode::HANDLE_EVENT:
|
||||
case DumpMode::HOVER_TEST:
|
||||
default:
|
||||
DumpLog::GetInstance().Print("Error: invalid arguments!");
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace OHOS::Ace::Framework
|
||||
|
@ -38,6 +38,7 @@ namespace Framework {
|
||||
class FrameNode;
|
||||
class JsAccessibilityManager;
|
||||
struct ActionParam;
|
||||
class JsThirdProviderInteractionOperation;
|
||||
|
||||
using namespace OHOS::Accessibility;
|
||||
|
||||
@ -48,6 +49,16 @@ struct AccessibilityHoverForThirdState {
|
||||
bool idle = true;
|
||||
};
|
||||
|
||||
struct AccessibilityHoverForThirdConfig {
|
||||
int64_t hostElementId = -1;
|
||||
NG::PointF point;
|
||||
SourceType sourceType = SourceType::NONE;
|
||||
NG::AccessibilityHoverEventType eventType = NG::AccessibilityHoverEventType::ENTER;
|
||||
TimeStamp time = std::chrono::high_resolution_clock::now();
|
||||
RefPtr<NG::FrameNode> hostNode;
|
||||
RefPtr<NG::PipelineContext> context;
|
||||
};
|
||||
|
||||
using AccessibilityHoverTestPathForThird = std::vector<int64_t>;
|
||||
|
||||
class AccessibilityHoverManagerForThirdNG : public AceType {
|
||||
@ -55,44 +66,11 @@ class AccessibilityHoverManagerForThirdNG : public AceType {
|
||||
|
||||
public:
|
||||
void HandleAccessibilityHoverForThird(
|
||||
int64_t hostElementId,
|
||||
const NG::PointF& point,
|
||||
SourceType sourceType,
|
||||
NG::AccessibilityHoverEventType eventType,
|
||||
TimeStamp time,
|
||||
RefPtr<NG::FrameNode> &hostNode,
|
||||
RefPtr<NG::PipelineContext> &context);
|
||||
|
||||
void SendAccessibilityEventForThird(
|
||||
const AccessibilityHoverForThirdConfig& config);
|
||||
bool GetElementInfoForThird(
|
||||
int64_t elementId,
|
||||
AccessibilityEventType eventType,
|
||||
WindowsContentChangeTypes windowsContentChangeType,
|
||||
RefPtr<NG::FrameNode> &hostNode,
|
||||
RefPtr<NG::PipelineContext> &context);
|
||||
void GetElementInfoForThird(int64_t elementId, AccessibilityElementInfo &info);
|
||||
void SendThirdAccessibilityAsyncEvent(
|
||||
const AccessibilityEvent& accessibilityEvent,
|
||||
const RefPtr<NG::FrameNode>& hostNode);
|
||||
|
||||
void SetHandlerForThird(const WeakPtr<JsAccessibilityManager>& jsAccessibilityManager)
|
||||
{
|
||||
jsAccessibilityManager_ = jsAccessibilityManager;
|
||||
}
|
||||
|
||||
const WeakPtr<JsAccessibilityManager>& GetHandlerForThird() const
|
||||
{
|
||||
return jsAccessibilityManager_;
|
||||
}
|
||||
|
||||
void SetTreeIdForTest(int32_t treeId)
|
||||
{
|
||||
xcomponentTreeId_ = treeId;
|
||||
}
|
||||
|
||||
int32_t GetTreeIdForTest()
|
||||
{
|
||||
return xcomponentTreeId_;
|
||||
}
|
||||
AccessibilityElementInfo& info,
|
||||
int64_t hostElementId);
|
||||
|
||||
bool ActThirdAccessibilityFocus(
|
||||
int64_t elementId,
|
||||
@ -100,30 +78,52 @@ public:
|
||||
const RefPtr<NG::FrameNode>& hostNode,
|
||||
const RefPtr<NG::PipelineContext>& context,
|
||||
bool isNeedClear);
|
||||
void RegisterJsThirdProviderInteractionOperation(
|
||||
int64_t hostElementId,
|
||||
const std::shared_ptr<JsThirdProviderInteractionOperation>& jsThirdProviderOperator);
|
||||
void DeregisterJsThirdProviderInteractionOperation(int64_t hostElementId);
|
||||
std::weak_ptr<JsThirdProviderInteractionOperation> &GetJsThirdProviderInteractionOperation(
|
||||
int64_t hostElementId)
|
||||
{
|
||||
return jsThirdProviderOperator_[hostElementId];
|
||||
}
|
||||
|
||||
bool OnDumpChildInfoForThirdRecursive(
|
||||
int64_t hostElementId,
|
||||
const std::vector<std::string>& params,
|
||||
std::vector<std::string>& info,
|
||||
const WeakPtr<JsAccessibilityManager>& jsAccessibilityManager);
|
||||
bool ClearThirdAccessibilityFocus(const RefPtr<NG::FrameNode>& hostNode);
|
||||
|
||||
private:
|
||||
void ResetHoverForThirdState();
|
||||
AccessibilityHoverTestPathForThird HoverPathForThird(
|
||||
const int64_t hostElementId,
|
||||
const NG::PointF& point,
|
||||
AccessibilityElementInfo& rootInfo);
|
||||
AccessibilityElementInfo& rootInfo,
|
||||
NG::OffsetF hostOffset);
|
||||
bool HoverPathForThirdRecursive(
|
||||
const int64_t hostElementId,
|
||||
const NG::PointF& hoverPoint,
|
||||
const AccessibilityElementInfo& nodeInfo,
|
||||
AccessibilityHoverTestPathForThird& path);
|
||||
AccessibilityHoverTestPathForThird& path,
|
||||
NG::OffsetF hostOffset);
|
||||
std::pair<bool, bool> GetSearchStrategyForThird(
|
||||
const AccessibilityElementInfo& nodeInfo);
|
||||
bool IsAccessibilityFocusable(const AccessibilityElementInfo& nodeInfo);
|
||||
bool HasAccessibilityTextOrDescription(const AccessibilityElementInfo& nodeInfo);
|
||||
void UpdateSearchStrategyByHitTestModeStr(
|
||||
std::string &hitTestMode,
|
||||
std::string& hitTestMode,
|
||||
bool& shouldSearchSelf,
|
||||
bool& shouldSearchChildren);
|
||||
void DumpPropertyForThird(
|
||||
int64_t elementId,
|
||||
const WeakPtr<JsAccessibilityManager>& jsAccessibilityManager,
|
||||
const std::shared_ptr<JsThirdProviderInteractionOperation>& jsThirdProviderOperator);
|
||||
|
||||
AccessibilityHoverForThirdState hoverForThirdState_;
|
||||
WeakPtr<JsAccessibilityManager> jsAccessibilityManager_;
|
||||
int32_t xcomponentTreeId_ = 0;
|
||||
std::unordered_map<int64_t, std::weak_ptr<JsThirdProviderInteractionOperation>>
|
||||
jsThirdProviderOperator_;
|
||||
};
|
||||
} // namespace NG
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -33,6 +33,68 @@
|
||||
|
||||
namespace OHOS::Ace::Framework {
|
||||
namespace {
|
||||
void LogAccessibilityElementInfo(
|
||||
const std::string& tag, const Accessibility::AccessibilityElementInfo& info)
|
||||
{
|
||||
std::string printStr;
|
||||
printStr.append(tag).append(", info: [");
|
||||
printStr.append("accessibilityId: ").append(std::to_string(info.GetAccessibilityId()));
|
||||
printStr.append(", accessibilityText: ").append(info.GetAccessibilityText());
|
||||
printStr.append(", childCount: ").append(std::to_string(info.GetChildCount()));
|
||||
printStr.append(", windowId: ").append(std::to_string(info.GetWindowId()));
|
||||
printStr.append(", parentNodeId: ").append(std::to_string(info.GetParentNodeId()));
|
||||
printStr.append(", checkable: ").append(info.IsCheckable() ? "true" : "false");
|
||||
printStr.append(", checked: ").append(info.IsChecked() ? "true" : "false");
|
||||
printStr.append(", focusable: ").append(info.IsFocusable() ? "true" : "false");
|
||||
printStr.append(", focused: ").append(info.IsFocused() ? "true" : "false");
|
||||
printStr.append(", visible: ").append(info.IsVisible() ? "true" : "false");
|
||||
printStr.append(", hasAccessibilityFocus: ")
|
||||
.append(info.HasAccessibilityFocus() ? "true" : "false");
|
||||
printStr.append(", selected: ").append(info.IsSelected() ? "true" : "false");
|
||||
printStr.append(", clickable: ").append(info.IsClickable() ? "true" : "false");
|
||||
printStr.append(", longClickable: ").append(info.IsLongClickable() ? "true" : "false");
|
||||
printStr.append(", enabled: ").append(info.IsEnabled() ? "true" : "false");
|
||||
printStr.append(", componentType: ").append(info.GetComponentType());
|
||||
printStr.append(", content: ").append(info.GetContent());
|
||||
printStr.append(", pageId: ").append(std::to_string(info.GetPageId()));
|
||||
printStr.append(", triggerAction: ")
|
||||
.append(std::to_string(static_cast<int32_t>(info.GetTriggerAction())));
|
||||
printStr.append(", accessibilityText: ").append(info.GetAccessibilityText());
|
||||
printStr.append(", childTreeId: ").append(std::to_string(info.GetChildTreeId()));
|
||||
printStr.append(", belongTreeId: ").append(std::to_string(info.GetBelongTreeId()));
|
||||
printStr.append(", parentWindowId: ").append(std::to_string(info.GetParentWindowId()));
|
||||
printStr.append(", accessibilityGroup: ").append(info.GetAccessibilityGroup() ? "true" : "false");
|
||||
std::string actionStr;
|
||||
actionStr.append("{");
|
||||
for (const auto& action : info.GetActionList()) {
|
||||
actionStr.append(std::to_string(
|
||||
static_cast<int32_t>(action.GetActionType()))).append(" ");
|
||||
}
|
||||
actionStr.append("}");
|
||||
printStr.append(", action: ").append(actionStr);
|
||||
printStr.append("]");
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "%{public}s", printStr.c_str());
|
||||
}
|
||||
|
||||
void LogAccessibilityEventInfo(
|
||||
const std::string& tag, const Accessibility::AccessibilityEventInfo& info)
|
||||
{
|
||||
std::string printStr;
|
||||
printStr.append(tag).append(", info: [");
|
||||
printStr.append("accessibilityId: ").append(std::to_string(info.GetAccessibilityId()));
|
||||
printStr.append(", windowId: ").append(std::to_string(info.GetWindowId()));
|
||||
printStr.append(", viewId: ").append(std::to_string(info.GetViewId()));
|
||||
printStr.append(", componentType: ").append(info.GetComponentType());
|
||||
printStr.append(", pageId: ").append(std::to_string(info.GetPageId()));
|
||||
printStr.append(", eventType: ").append(
|
||||
std::to_string(static_cast<int32_t>(info.GetEventType())));
|
||||
printStr.append(", triggerAction: ").append(
|
||||
std::to_string(static_cast<int32_t>(info.GetTriggerAction())));
|
||||
printStr.append(", requestFocusElementId: ").append(
|
||||
std::to_string(info.GetRequestFocusElementId()));
|
||||
printStr.append("]");
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "%{public}s", printStr.c_str());
|
||||
}
|
||||
void FillNodeConfig(
|
||||
const NodeConfig& config, Accessibility::AccessibilityElementInfo& info)
|
||||
{
|
||||
@ -50,6 +112,9 @@ void FillNodeConfig(
|
||||
info.SetParentWindowId(config.parentWindowId);
|
||||
info.SetBundleName(config.bundleName);
|
||||
info.SetInspectorKey(config.inspectorKey);
|
||||
int64_t splitElementId = info.GetAccessibilityId();
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(config.belongTreeId, splitElementId);
|
||||
info.SetAccessibilityId(splitElementId);
|
||||
}
|
||||
|
||||
void CopyNativeInfoToAccessibilityElementInfo(
|
||||
@ -112,7 +177,11 @@ void JsThirdProviderInteractionOperation::SearchElementInfoByAccessibilityId(
|
||||
bool ret = FindAccessibilityNodeInfosByIdFromProvider(
|
||||
splitElementId, mode, requestId, infos);
|
||||
if (!ret) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"SearchElementInfoByAccessibilityId failed.");
|
||||
infos.clear();
|
||||
}
|
||||
|
||||
// 3. Return result
|
||||
SetSearchElementInfoByAccessibilityIdResult(callback, std::move(infos), requestId);
|
||||
}
|
||||
@ -176,6 +245,9 @@ void JsThirdProviderInteractionOperation::SearchElementInfosByText(
|
||||
bool ret = FindAccessibilityNodeInfosByTextFromProvider(
|
||||
splitElementId, text, requestId, infos);
|
||||
if (!ret) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"SearchElementInfosByText failed.");
|
||||
infos.clear();
|
||||
}
|
||||
|
||||
// 3. Return result
|
||||
@ -237,22 +309,38 @@ void JsThirdProviderInteractionOperation::FindFocusedElementInfo(
|
||||
elementId, splitElementId, splitTreeId);
|
||||
|
||||
// 2. FindFocusedAccessibilityNode from provider
|
||||
Accessibility::AccessibilityElementInfo info;
|
||||
bool ret = FindFocusedElementInfoFromProvider(
|
||||
splitElementId, focusType, requestId, info);
|
||||
if (!ret) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"SearchElementInfosByText failed.");
|
||||
info.SetValidElement(false);
|
||||
}
|
||||
|
||||
// 3. Return result
|
||||
SetFindFocusedElementInfoResult(callback, info, requestId);
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::FindFocusedElementInfoFromProvider(
|
||||
int64_t elementId, const int32_t focusType, const int32_t requestId,
|
||||
Accessibility::AccessibilityElementInfo& info)
|
||||
{
|
||||
auto provider = accessibilityProvider_.Upgrade();
|
||||
CHECK_NULL_VOID(provider);
|
||||
CHECK_NULL_RETURN(provider, false);
|
||||
ArkUI_AccessibilityElementInfo nativeInfo;
|
||||
int32_t code = provider->FindFocusedAccessibilityNode(
|
||||
splitElementId, focusType, requestId, nativeInfo);
|
||||
elementId, focusType, requestId, nativeInfo);
|
||||
if (code != 0) {
|
||||
return;
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"FindFocusedElementInfoFromProvider failed: %{public}d", code);
|
||||
return false;
|
||||
}
|
||||
|
||||
NodeConfig config;
|
||||
GetNodeConfig(config);
|
||||
Accessibility::AccessibilityElementInfo info;
|
||||
CopyNativeInfoToAccessibilityElementInfo(nativeInfo, config, info);
|
||||
|
||||
// 3. Return result
|
||||
SetFindFocusedElementInfoResult(callback, info, requestId);
|
||||
return true;
|
||||
}
|
||||
|
||||
void JsThirdProviderInteractionOperation::SetFindFocusedElementInfoResult(
|
||||
@ -277,22 +365,38 @@ void JsThirdProviderInteractionOperation::FocusMoveSearch(
|
||||
elementId, splitElementId, splitTreeId);
|
||||
|
||||
// 2. FindNextFocusAccessibilityNode from provider
|
||||
Accessibility::AccessibilityElementInfo info;
|
||||
bool ret = FocusMoveSearchProvider(
|
||||
splitElementId, direction, requestId, info);
|
||||
if (!ret) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"FocusMoveSearch failed.");
|
||||
info.SetValidElement(false);
|
||||
}
|
||||
|
||||
// 3. Return result
|
||||
SetFocusMoveSearchResult(callback, info, requestId);
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::FocusMoveSearchProvider(
|
||||
int64_t elementId, const int32_t direction, const int32_t requestId,
|
||||
Accessibility::AccessibilityElementInfo& info)
|
||||
{
|
||||
auto provider = accessibilityProvider_.Upgrade();
|
||||
CHECK_NULL_VOID(provider);
|
||||
CHECK_NULL_RETURN(provider, false);
|
||||
ArkUI_AccessibilityElementInfo nativeInfo;
|
||||
int32_t code = provider->FindNextFocusAccessibilityNode(
|
||||
splitElementId, direction, requestId, nativeInfo);
|
||||
elementId, direction, requestId, nativeInfo);
|
||||
if (code != 0) {
|
||||
return;
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"FocusMoveSearchProvider failed: %{public}d", code);
|
||||
return false;
|
||||
}
|
||||
|
||||
NodeConfig config;
|
||||
GetNodeConfig(config);
|
||||
Accessibility::AccessibilityElementInfo info;
|
||||
CopyNativeInfoToAccessibilityElementInfo(nativeInfo, config, info);
|
||||
|
||||
// 3. Return result
|
||||
SetFocusMoveSearchResult(callback, info, requestId);
|
||||
return true;
|
||||
}
|
||||
|
||||
void JsThirdProviderInteractionOperation::SetFocusMoveSearchResult(
|
||||
@ -317,11 +421,17 @@ void JsThirdProviderInteractionOperation::ExecuteAction(
|
||||
AccessibilitySystemAbilityClient::GetTreeIdAndElementIdBySplitElementId(
|
||||
elementId, splitElementId, splitTreeId);
|
||||
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "ExecuteAction elementId: %{public}" PRId64 ","
|
||||
" action: %{public}d, requestId: %{public}d, splitElementId: %{public}" PRId64 ","
|
||||
" splitTreeId: %{public}d",
|
||||
elementId, action, requestId, splitElementId, splitTreeId);
|
||||
// 2. FindNextFocusAccessibilityNode from provider
|
||||
std::list<Accessibility::AccessibilityElementInfo> infos;
|
||||
bool ret = FindAccessibilityNodeInfosByIdFromProvider(
|
||||
splitElementId, 0, requestId, infos);
|
||||
if (!ret || infos.size() == 0) {
|
||||
if (!ret) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "Find info failed when ExecuteAction.");
|
||||
SetExecuteActionResult(callback, false, requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -329,16 +439,30 @@ void JsThirdProviderInteractionOperation::ExecuteAction(
|
||||
ExecuteActionForThird(splitElementId, infos.front(), action);
|
||||
|
||||
//4. ExecuteAccessibilityAction To provider
|
||||
auto provider = accessibilityProvider_.Upgrade();
|
||||
CHECK_NULL_VOID(provider);
|
||||
int32_t code = provider->ExecuteAccessibilityAction(
|
||||
splitElementId, action, requestId, actionArguments);
|
||||
if (code != 0) {
|
||||
return;
|
||||
ret = ExecuteActionFromProvider(splitElementId, action, actionArguments, requestId);
|
||||
if (!ret) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "ExecuteAccessibilityAction failed.");
|
||||
}
|
||||
|
||||
// 5. Return result
|
||||
SetExecuteActionResult(callback, code == 0, requestId);
|
||||
SetExecuteActionResult(callback, ret, requestId);
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::ExecuteActionFromProvider(
|
||||
int64_t elementId, const int32_t action,
|
||||
const std::map<std::string, std::string>& actionArguments, const int32_t requestId)
|
||||
{
|
||||
auto provider = accessibilityProvider_.Upgrade();
|
||||
CHECK_NULL_RETURN(provider, false);
|
||||
int32_t code = provider->ExecuteAccessibilityAction(
|
||||
elementId, action, requestId, actionArguments);
|
||||
if (code != 0) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"ExecuteActionFromProvider failed: %{public}d", code);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::ExecuteActionForThird(
|
||||
@ -372,13 +496,33 @@ void JsThirdProviderInteractionOperation::SetExecuteActionResult(
|
||||
}
|
||||
|
||||
void JsThirdProviderInteractionOperation::ClearFocus()
|
||||
{
|
||||
// 1. Clear focus from provider
|
||||
ClearFocusFromProvider();
|
||||
// 2. Clear DrawBound
|
||||
ClearDrawBound();
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::ClearFocusFromProvider()
|
||||
{
|
||||
auto provider = accessibilityProvider_.Upgrade();
|
||||
CHECK_NULL_VOID(provider);
|
||||
CHECK_NULL_RETURN(provider, false);
|
||||
int32_t code = provider->ClearFocusedAccessibilityNode();
|
||||
if (code != 0) {
|
||||
return;
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY,
|
||||
"ExecuteActionFromProvider failed: %{public}d", code);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::ClearDrawBound()
|
||||
{
|
||||
auto jsAccessibilityManager = jsAccessibilityManager_.Upgrade();
|
||||
CHECK_NULL_RETURN(jsAccessibilityManager, false);
|
||||
auto hostNode = GetHost();
|
||||
CHECK_NULL_RETURN(hostNode, false);
|
||||
return jsAccessibilityManager->ClearThirdAccessibilityFocus(hostNode);
|
||||
}
|
||||
|
||||
void JsThirdProviderInteractionOperation::OutsideTouch()
|
||||
@ -429,9 +573,44 @@ void JsThirdProviderInteractionOperation::SetBelongTreeId(const int32_t treeId)
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "SetBelongTreeId treeId: %{public}d", treeId);
|
||||
belongTreeId_ = treeId;
|
||||
}
|
||||
|
||||
int32_t JsThirdProviderInteractionOperation::SendAccessibilityAsyncEventForThird(
|
||||
int64_t thirdElementId,
|
||||
Accessibility::EventType eventType)
|
||||
{
|
||||
// 1. generate event
|
||||
Accessibility::AccessibilityEventInfo event;
|
||||
event.SetTimeStamp(GetMicroTickCount());
|
||||
event.SetWindowChangeTypes(
|
||||
Accessibility::WindowUpdateType::WINDOW_UPDATE_INVALID);
|
||||
event.SetWindowContentChangeTypes(
|
||||
Accessibility::WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_INVALID);
|
||||
event.SetSource(thirdElementId);
|
||||
event.SetEventType(eventType);
|
||||
event.SetBundleName(AceApplicationInfo::GetInstance().GetPackageName());
|
||||
|
||||
// 2. get element from third
|
||||
std::list<Accessibility::AccessibilityElementInfo> infos;
|
||||
bool ret = FindAccessibilityNodeInfosByIdFromProvider(
|
||||
thirdElementId, 0, 0, infos);
|
||||
if ((!ret) || (infos.size() == 0)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
auto jsAccessibilityManager = GetHandler().Upgrade();
|
||||
CHECK_NULL_VOID(jsAccessibilityManager);
|
||||
jsAccessibilityManager->SetTreeIdForTest(treeId);
|
||||
CHECK_NULL_RETURN(jsAccessibilityManager, -1);
|
||||
jsAccessibilityManager->UpdateElementInfosTreeId(infos);
|
||||
event.SetElementInfo(infos.front());
|
||||
|
||||
// 3. change event info by host info
|
||||
GetAccessibilityEventInfoFromNativeEvent(event);
|
||||
|
||||
// 4. SendEvent
|
||||
auto host = host_.Upgrade();
|
||||
CHECK_NULL_RETURN(host, -1);
|
||||
SendAccessibilitySyncEventToService(event, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t JsThirdProviderInteractionOperation::SendAccessibilityAsyncEvent(
|
||||
@ -450,10 +629,35 @@ int32_t JsThirdProviderInteractionOperation::SendAccessibilityAsyncEvent(
|
||||
CHECK_NULL_RETURN(host, -1);
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "Inner SendAccessibilityAsyncEvent");
|
||||
SendAccessibilitySyncEventToService(accessibilityEventInfo, callback);
|
||||
callback(880);
|
||||
callback(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void JsThirdProviderInteractionOperation::GetAccessibilityEventInfoFromNativeEvent(
|
||||
OHOS::Accessibility::AccessibilityEventInfo& accessibilityEventInfo)
|
||||
{
|
||||
// 1. Fill node config
|
||||
NodeConfig config;
|
||||
GetNodeConfig(config);
|
||||
|
||||
// 1.1. Fill elementInfo config
|
||||
auto elementInfo = accessibilityEventInfo.GetElementInfo();
|
||||
FillNodeConfig(config, elementInfo);
|
||||
int64_t elementId = elementInfo.GetAccessibilityId();
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(belongTreeId_, elementId);
|
||||
elementInfo.SetAccessibilityId(elementId);
|
||||
|
||||
// 1.2. Fill eventInfo config
|
||||
accessibilityEventInfo.SetPageId(config.pageId);
|
||||
accessibilityEventInfo.SetWindowId(config.windowId);
|
||||
accessibilityEventInfo.SetSource(elementId);
|
||||
accessibilityEventInfo.SetComponentType(elementInfo.GetComponentType());
|
||||
accessibilityEventInfo.AddContent(elementInfo.GetContent());
|
||||
accessibilityEventInfo.SetElementInfo(elementInfo);
|
||||
LogAccessibilityElementInfo("sendEvent", elementInfo);
|
||||
LogAccessibilityEventInfo("sendEvent", accessibilityEventInfo);
|
||||
}
|
||||
|
||||
void JsThirdProviderInteractionOperation::GetAccessibilityEventInfoFromNativeEvent(
|
||||
const ArkUI_AccessibilityEventInfo& nativeEventInfo,
|
||||
OHOS::Accessibility::AccessibilityEventInfo& accessibilityEventInfo)
|
||||
@ -462,22 +666,8 @@ void JsThirdProviderInteractionOperation::GetAccessibilityEventInfoFromNativeEve
|
||||
TransformAccessbilityEventInfo(
|
||||
nativeEventInfo, accessibilityEventInfo);
|
||||
|
||||
// 2. Fill node config
|
||||
NodeConfig config;
|
||||
GetNodeConfig(config);
|
||||
|
||||
// 2.1. Fill elementInfo config
|
||||
auto elementInfo = accessibilityEventInfo.GetElementInfo();
|
||||
FillNodeConfig(config, elementInfo);
|
||||
int64_t elementId = elementInfo.GetAccessibilityId();
|
||||
AccessibilitySystemAbilityClient::SetSplicElementIdTreeId(belongTreeId_, elementId);
|
||||
elementInfo.SetAccessibilityId(elementId);
|
||||
|
||||
// 2.2. Fill eventInfo config
|
||||
accessibilityEventInfo.SetPageId(config.pageId);
|
||||
accessibilityEventInfo.SetComponentType(elementInfo.GetComponentType());
|
||||
accessibilityEventInfo.AddContent(elementInfo.GetContent());
|
||||
accessibilityEventInfo.SetElementInfo(elementInfo);
|
||||
// 2. Transform Accessibility::AccessibilityEventInfo with host info
|
||||
GetAccessibilityEventInfoFromNativeEvent(accessibilityEventInfo);
|
||||
}
|
||||
|
||||
bool JsThirdProviderInteractionOperation::SendAccessibilitySyncEventToService(
|
||||
|
@ -71,7 +71,12 @@ public:
|
||||
int32_t SendAccessibilityAsyncEvent(
|
||||
const ArkUI_AccessibilityEventInfo& nativeAccessibilityEvent,
|
||||
void (*callback)(int32_t errorCode)) override;
|
||||
|
||||
int32_t SendAccessibilityAsyncEventForThird(
|
||||
int64_t thirdElementId,
|
||||
Accessibility::EventType eventType);
|
||||
bool FindAccessibilityNodeInfosByIdFromProvider(
|
||||
const int64_t splitElementId, const int32_t mode, const int32_t requestId,
|
||||
std::list<Accessibility::AccessibilityElementInfo>& infos);
|
||||
const WeakPtr<JsAccessibilityManager>& GetHandler() const
|
||||
{
|
||||
return jsAccessibilityManager_;
|
||||
@ -103,9 +108,6 @@ private:
|
||||
void SetExecuteActionResult(
|
||||
AccessibilityElementOperatorCallback& callback,
|
||||
const bool succeeded, const int32_t requestId);
|
||||
bool FindAccessibilityNodeInfosByIdFromProvider(
|
||||
const int64_t splitElementId, const int32_t mode, const int32_t requestId,
|
||||
std::list<Accessibility::AccessibilityElementInfo>& infos);
|
||||
bool FindAccessibilityNodeInfosByTextFromProvider(
|
||||
const int64_t splitElementId, const std::string& text, const int32_t requestId,
|
||||
std::list<Accessibility::AccessibilityElementInfo>& infos);
|
||||
@ -114,9 +116,22 @@ private:
|
||||
void GetAccessibilityEventInfoFromNativeEvent(
|
||||
const ArkUI_AccessibilityEventInfo& nativeEventInfo,
|
||||
OHOS::Accessibility::AccessibilityEventInfo& accessibilityEventInfo);
|
||||
void GetAccessibilityEventInfoFromNativeEvent(
|
||||
OHOS::Accessibility::AccessibilityEventInfo& accessibilityEventInfo);
|
||||
bool SendAccessibilitySyncEventToService(
|
||||
const OHOS::Accessibility::AccessibilityEventInfo& eventInfo,
|
||||
void (*callback)(int32_t errorCode));
|
||||
bool FindFocusedElementInfoFromProvider(
|
||||
int64_t elementId, const int32_t focusType, const int32_t requestId,
|
||||
Accessibility::AccessibilityElementInfo& info);
|
||||
bool ExecuteActionFromProvider(
|
||||
int64_t elementId, const int32_t action,
|
||||
const std::map<std::string, std::string>& actionArguments, const int32_t requestId);
|
||||
bool FocusMoveSearchProvider(
|
||||
int64_t elementId, const int32_t direction, const int32_t requestId,
|
||||
Accessibility::AccessibilityElementInfo& info);
|
||||
bool ClearFocusFromProvider();
|
||||
bool ClearDrawBound();
|
||||
|
||||
WeakPtr<AccessibilityProvider> accessibilityProvider_;
|
||||
WeakPtr<JsAccessibilityManager> jsAccessibilityManager_;
|
||||
|
@ -26,8 +26,6 @@ void TransformAccessbilityElementInfo(
|
||||
const ArkUI_AccessibilityElementInfo& nativeInfo,
|
||||
OHOS::Accessibility::AccessibilityElementInfo& accessibilityElementInfo)
|
||||
{
|
||||
accessibilityElementInfo.SetPageId(nativeInfo.GetPageId());
|
||||
accessibilityElementInfo.SetComponentId(nativeInfo.GetComponentId());
|
||||
accessibilityElementInfo.SetParent(nativeInfo.GetParentId());
|
||||
accessibilityElementInfo.SetComponentType(nativeInfo.GetComponentType());
|
||||
accessibilityElementInfo.SetContent(nativeInfo.GetContents());
|
||||
@ -105,7 +103,6 @@ void TransformAccessbilityEventInfo(
|
||||
{
|
||||
accessibilityEventInfo.SetEventType(
|
||||
static_cast<OHOS::Accessibility::EventType>(nativeEventInfo.GetEventType()));
|
||||
accessibilityEventInfo.SetPageId(nativeEventInfo.GetPageId());
|
||||
OHOS::Accessibility::AccessibilityElementInfo elementInfo;
|
||||
auto info = nativeEventInfo.GetElementInfo();
|
||||
if (info != nullptr) {
|
||||
|
@ -77,6 +77,8 @@ template("ace_core_source_set") {
|
||||
"accessibility/accessibility_node.cpp",
|
||||
"accessibility/accessibility_session_adapter.cpp",
|
||||
"accessibility/accessibility_utils.cpp",
|
||||
"accessibility/native_interface_accessibility_impl.cpp",
|
||||
"accessibility/native_interface_accessibility_provider.cpp",
|
||||
|
||||
# animation
|
||||
"animation/animatable_data.cpp",
|
||||
@ -661,6 +663,8 @@ template("ace_core_ng_source_set") {
|
||||
"accessibility/accessibility_node.cpp",
|
||||
"accessibility/accessibility_session_adapter.cpp",
|
||||
"accessibility/accessibility_utils.cpp",
|
||||
"accessibility/native_interface_accessibility_impl.cpp",
|
||||
"accessibility/native_interface_accessibility_provider.cpp",
|
||||
|
||||
# animation
|
||||
"animation/animatable_data.cpp",
|
||||
|
@ -16,14 +16,18 @@
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_ACCESSIBILITY_ACCESSIBILITY_MANAGER_H
|
||||
|
||||
#include "base/geometry/ng/point_t.h"
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "core/accessibility/accessibility_node.h"
|
||||
#include "core/accessibility/accessibility_constants.h"
|
||||
#include "core/accessibility/accessibility_provider.h"
|
||||
#include "core/accessibility/accessibility_utils.h"
|
||||
#include "core/pipeline/base/base_composed_component.h"
|
||||
|
||||
namespace OHOS::Accessibility {
|
||||
class AccessibilityElementInfo;
|
||||
class AccessibilityEventInfo;
|
||||
class AccessibilityElementOperator;
|
||||
} // namespace OHOS::Accessibility
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
@ -48,6 +52,23 @@ struct AccessibilityEvent {
|
||||
AccessibilityEventType type = AccessibilityEventType::UNKNOWN;
|
||||
};
|
||||
|
||||
enum class OperatorType {
|
||||
UNDEFINE = 1,
|
||||
JS_UIEXTENSION,
|
||||
JS_WEB,
|
||||
JS_THIRD_PROVIDER,
|
||||
};
|
||||
|
||||
struct Registration {
|
||||
uint32_t windowId = 0;
|
||||
uint32_t parentWindowId = 0;
|
||||
int32_t parentTreeId = 0;
|
||||
int64_t elementId = 0;
|
||||
OperatorType operatorType = OperatorType::UNDEFINE;
|
||||
WeakPtr<NG::FrameNode> hostNode;
|
||||
WeakPtr<AccessibilityProvider> accessibilityProvider;
|
||||
};
|
||||
|
||||
enum class AccessibilityVersion {
|
||||
JS_VERSION = 1,
|
||||
JS_DECLARATIVE_VERSION,
|
||||
@ -196,6 +217,21 @@ public:
|
||||
|
||||
virtual void DeregisterAccessibilitySAObserverCallback(int64_t elementId) {};
|
||||
|
||||
virtual bool RegisterInteractionOperationAsChildTree(
|
||||
const Registration& registration) { return false; };
|
||||
virtual bool DeregisterInteractionOperationAsChildTree(
|
||||
uint32_t windowId, int32_t treeId) { return false; };
|
||||
|
||||
virtual void TransferThirdProviderHoverEvent(
|
||||
int64_t elementId, const NG::PointF &point, SourceType source,
|
||||
NG::AccessibilityHoverEventType eventType, TimeStamp time) {};
|
||||
|
||||
virtual bool OnDumpChildInfoForThird(
|
||||
int64_t hostElementId, const std::vector<std::string> ¶ms, std::vector<std::string> &info)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsRegister()
|
||||
{
|
||||
return isReg_;
|
||||
|
@ -18,12 +18,8 @@
|
||||
#include "core/components_ng/pattern/pattern.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
bool AccessibilitySessionAdapter::IgnoreHostNode() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<AccessibilitySessionAdapter> AccessibilitySessionAdapter::GetSessionAdapter(const RefPtr<FrameNode>& node)
|
||||
RefPtr<AccessibilitySessionAdapter> AccessibilitySessionAdapter::GetSessionAdapter(
|
||||
const RefPtr<FrameNode>& node)
|
||||
{
|
||||
auto pattern = node->GetPattern();
|
||||
CHECK_NULL_RETURN(pattern, nullptr);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
virtual void TransferHoverEvent(const PointF& point, SourceType source,
|
||||
AccessibilityHoverEventType eventType, TimeStamp time) { }
|
||||
|
||||
virtual bool IgnoreHostNode() const;
|
||||
virtual bool IgnoreHostNode() const { return false; };
|
||||
|
||||
/*
|
||||
* Get session adapter of node if node type is in ${SESSION_ADAPTER_MAP}
|
||||
|
@ -58,16 +58,6 @@ struct ArkUI_AccessibilityElementInfo {
|
||||
this->elementId = elementId;
|
||||
}
|
||||
|
||||
void SetComponentId(int64_t componentId)
|
||||
{
|
||||
this->componentId = componentId;
|
||||
}
|
||||
|
||||
int64_t GetComponentId() const
|
||||
{
|
||||
return componentId;
|
||||
}
|
||||
|
||||
void SetTextBeginSelected(int32_t textBeginSelected)
|
||||
{
|
||||
this->textBeginSelected = textBeginSelected;
|
||||
@ -458,7 +448,6 @@ private:
|
||||
int32_t zIndex = 0;
|
||||
float opacity = 0.0f;
|
||||
|
||||
int64_t componentId = 0;
|
||||
int64_t parentId = 0;
|
||||
int32_t elementId = 0;
|
||||
|
||||
@ -554,7 +543,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
ArkUI_AccessibilityEventType eventType = ARKUI_NATIVE_ACCESSIBILITY_TYPE_VIEW_INVALID;
|
||||
ArkUI_AccessibilityEventType eventType = ARKUI_ACCESSIBILITY_NATIVE_EVENT_TYPE_INVALID;
|
||||
int32_t pageId = 0;
|
||||
int32_t requestFocusId = 0;
|
||||
ArkUI_AccessibilityElementInfo* elementInfo = nullptr;
|
||||
|
@ -19,16 +19,64 @@ using namespace OHOS::Ace;
|
||||
namespace {
|
||||
constexpr int32_t NOT_REGISTERED = -1;
|
||||
constexpr int32_t COPY_FAILED = -2;
|
||||
constexpr int32_t SEND_EVENT_FAILED = -1;
|
||||
constexpr int32_t SEND_EVENT_SUCCESS = 0;
|
||||
|
||||
bool CheckProviderCallback(ArkUI_AccessibilityProviderCallbacks* callbacks)
|
||||
{
|
||||
if (callbacks == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "callbacks is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool result = true;
|
||||
if (callbacks->FindAccessibilityNodeInfosById == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "FindAccessibilityNodeInfosById is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (callbacks->FindAccessibilityNodeInfosByText == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "FindAccessibilityNodeInfosByText is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (callbacks->FindFocusedAccessibilityNode == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "FindFocusedAccessibilityNode is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (callbacks->FindNextFocusAccessibilityNode == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "FindNextFocusAccessibilityNode is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (callbacks->ExecuteAccessibilityAction == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "ExecuteAccessibilityAction is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (callbacks->ClearFocusedFocusAccessibilityNode == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "ClearFocusedFocusAccessibilityNode is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (callbacks->GetAccessibilityNodeCursorPosition == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "GetAccessibilityNodeCursorPosition is null");
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
int32_t ArkUI_AccessibilityProvider::AccessibilityProviderRegisterCallback(
|
||||
ArkUI_AccessibilityProviderCallbacks* callbacks)
|
||||
{
|
||||
if (callbacks == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "callbacks is null");
|
||||
if (!CheckProviderCallback(callbacks)) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "CheckProviderCallback failed.");
|
||||
if (registerCallback_) {
|
||||
registerCallback_(false);
|
||||
}
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
accessibilityProviderCallbacks_ = callbacks;
|
||||
@ -36,7 +84,7 @@ int32_t ArkUI_AccessibilityProvider::AccessibilityProviderRegisterCallback(
|
||||
registerCallback_(true);
|
||||
}
|
||||
TAG_LOGI(AceLogTag::ACE_ACCESSIBILITY, "AccessibilityProviderRegisterCallback success");
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t ArkUI_AccessibilityProvider::FindAccessibilityNodeInfosById(
|
||||
@ -163,22 +211,22 @@ int32_t ArkUI_AccessibilityProvider::SendAccessibilityAsyncEvent(
|
||||
if (accessibilityEvent == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "accessibilityEvent is null");
|
||||
if (callback) {
|
||||
callback(-1);
|
||||
callback(SEND_EVENT_FAILED);
|
||||
}
|
||||
return -1;
|
||||
return SEND_EVENT_FAILED;
|
||||
}
|
||||
|
||||
auto accessibilityProvider = accessibilityProvider_.Upgrade();
|
||||
if (accessibilityProvider == nullptr) {
|
||||
TAG_LOGW(AceLogTag::ACE_ACCESSIBILITY, "accessibilityProvider is null");
|
||||
if (callback) {
|
||||
callback(-1);
|
||||
callback(SEND_EVENT_FAILED);
|
||||
}
|
||||
return -1;
|
||||
return SEND_EVENT_FAILED;
|
||||
}
|
||||
|
||||
accessibilityProvider->SendAccessibilityAsyncEvent(*accessibilityEvent, callback);
|
||||
return 0;
|
||||
return SEND_EVENT_SUCCESS;
|
||||
}
|
||||
|
||||
void ArkUI_AccessibilityProvider::SetInnerAccessibilityProvider(
|
||||
|
@ -349,3 +349,13 @@ int32_t OH_NativeXComponent::GetSourceType(int32_t pointId, OH_NativeXComponent_
|
||||
? OH_NATIVEXCOMPONENT_RESULT_SUCCESS
|
||||
: OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
int32_t OH_NativeXComponent::GetAccessibilityProvider(ArkUI_AccessibilityProvider** handle)
|
||||
{
|
||||
if (xcomponentImpl_ == nullptr || handle == nullptr) {
|
||||
return OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
(*handle) = xcomponentImpl_->GetAccessbilityProvider().get();
|
||||
return OH_NATIVEXCOMPONENT_RESULT_SUCCESS;
|
||||
}
|
||||
|
@ -17,15 +17,18 @@
|
||||
#define _NATIVE_INTERFACE_XCOMPONENT_IMPL_
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#include "interfaces/native/native_interface_accessibility.h"
|
||||
#include "interfaces/native/native_interface_xcomponent.h"
|
||||
#include "interfaces/native/ui_input_event.h"
|
||||
|
||||
#include "base/memory/ace_type.h"
|
||||
#include "base/utils/utils.h"
|
||||
#include "core/accessibility/native_interface_accessibility_provider.h"
|
||||
#include "core/components_ng/event/gesture_event_hub.h"
|
||||
|
||||
using NativeXComponent_Surface_Callback = void (*)(OH_NativeXComponent*, void*);
|
||||
@ -65,7 +68,10 @@ class NativeXComponentImpl : public virtual AceType {
|
||||
using NativeNode_Callback = void (*)(void*, void*);
|
||||
|
||||
public:
|
||||
NativeXComponentImpl() {}
|
||||
NativeXComponentImpl()
|
||||
{
|
||||
accessbilityProvider_ = std::make_shared<ArkUI_AccessibilityProvider>();
|
||||
}
|
||||
|
||||
~NativeXComponentImpl() {}
|
||||
|
||||
@ -285,6 +291,11 @@ public:
|
||||
return &keyEvent_;
|
||||
}
|
||||
|
||||
std::shared_ptr<ArkUI_AccessibilityProvider> GetAccessbilityProvider()
|
||||
{
|
||||
return accessbilityProvider_;
|
||||
}
|
||||
|
||||
NativeXComponent_Callback GetFocusEventCallback() const
|
||||
{
|
||||
return focusEventCallback_;
|
||||
@ -433,6 +444,7 @@ private:
|
||||
OH_NativeXComponent_TouchEvent touchEvent_ {};
|
||||
OH_NativeXComponent_MouseEvent mouseEvent_ { .x = 0, .y = 0 };
|
||||
OH_NativeXComponent_KeyEvent keyEvent_;
|
||||
std::shared_ptr<ArkUI_AccessibilityProvider> accessbilityProvider_;
|
||||
OH_NativeXComponent_Callback* callback_ = nullptr;
|
||||
OH_NativeXComponent_MouseEvent_Callback* mouseEventCallback_ = nullptr;
|
||||
NativeXComponent_Surface_Callback surfaceShowCallback_ = nullptr;
|
||||
@ -492,6 +504,7 @@ struct OH_NativeXComponent {
|
||||
int32_t RegisterOnTouchInterceptCallback(
|
||||
HitTestMode (*callback)(OH_NativeXComponent* component, ArkUI_UIInputEvent* event));
|
||||
int32_t GetSourceType(int32_t pointId, OH_NativeXComponent_EventSourceType* sourceType);
|
||||
int32_t GetAccessibilityProvider(ArkUI_AccessibilityProvider** handle);
|
||||
|
||||
private:
|
||||
OHOS::Ace::NativeXComponentImpl* xcomponentImpl_ = nullptr;
|
||||
|
@ -16,6 +16,9 @@ import("$ace_root/frameworks/core/components_ng/components.gni")
|
||||
|
||||
build_component_ng("xcomponent_pattern_ng") {
|
||||
sources = [
|
||||
"xcomponent_accessibility_child_tree_callback.cpp",
|
||||
"xcomponent_accessibility_provider.cpp",
|
||||
"xcomponent_accessibility_session_adapter.cpp",
|
||||
"xcomponent_controller_ng.cpp",
|
||||
"xcomponent_ext_surface_callback_client.cpp",
|
||||
"xcomponent_layout_algorithm.cpp",
|
||||
|
@ -76,7 +76,16 @@ bool XComponentAccessibilityChildTreeCallback::OnSetChildTree(
|
||||
bool XComponentAccessibilityChildTreeCallback::OnDumpChildInfo(
|
||||
const std::vector<std::string>& params, std::vector<std::string>& info)
|
||||
{
|
||||
return false;
|
||||
auto pattern = weakPattern_.Upgrade();
|
||||
CHECK_NULL_RETURN(pattern, true);
|
||||
auto host = pattern->GetHost();
|
||||
CHECK_NULL_RETURN(host, true);
|
||||
auto pipeline = host->GetContext();
|
||||
CHECK_NULL_RETURN(pipeline, true);
|
||||
auto accessibilityManager = pipeline->GetAccessibilityManager();
|
||||
CHECK_NULL_RETURN(accessibilityManager, true);
|
||||
return accessibilityManager->OnDumpChildInfoForThird(
|
||||
host->GetAccessibilityId(), params, info);
|
||||
}
|
||||
|
||||
void XComponentAccessibilityChildTreeCallback::OnClearRegisterFlag()
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
namespace {
|
||||
constexpr int32_t SEND_EVENT_FAILED = -1;
|
||||
|
||||
std::shared_ptr<ArkUI_AccessibilityProvider> GetAccessbilityProvider(
|
||||
const WeakPtr<XComponentPattern>& weakPattern)
|
||||
{
|
||||
@ -142,9 +144,9 @@ int32_t XComponentAccessibilityProvider::SendAccessibilityAsyncEvent(
|
||||
auto thirdAccessibilityManager = thirdAccessibilityManager_.lock();
|
||||
if (thirdAccessibilityManager == nullptr) {
|
||||
if (callback) {
|
||||
callback(-2);
|
||||
callback(SEND_EVENT_FAILED);
|
||||
}
|
||||
return -2;
|
||||
return SEND_EVENT_FAILED;
|
||||
}
|
||||
|
||||
thirdAccessibilityManager->SendAccessibilityAsyncEvent(
|
||||
|
@ -16,16 +16,15 @@
|
||||
#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_XCOMPONENT_XCOMPONENT_ACCESSIBILITY_SESSION_ADAPTER_H
|
||||
#define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_XCOMPONENT_XCOMPONENT_ACCESSIBILITY_SESSION_ADAPTER_H
|
||||
|
||||
#include "core/components_ng/base/frame_node.h"
|
||||
#include "core/accessibility/accessibility_session_adapter.h"
|
||||
#include "core/components_ng/base/frame_node.h"
|
||||
|
||||
namespace OHOS::Ace::NG {
|
||||
|
||||
class XcomponentAccessibilitySessionAdapter : public AccessibilitySessionAdapter {
|
||||
DECLARE_ACE_TYPE(XcomponentAccessibilitySessionAdapter, AceType);
|
||||
DECLARE_ACE_TYPE(XcomponentAccessibilitySessionAdapter, AccessibilitySessionAdapter);
|
||||
public:
|
||||
explicit XcomponentAccessibilitySessionAdapter(
|
||||
const WeakPtr<FrameNode> host): host_(host) { }
|
||||
const WeakPtr<FrameNode> host): host_(host) {}
|
||||
~XcomponentAccessibilitySessionAdapter() override = default;
|
||||
|
||||
void TransferHoverEvent(const PointF& point, SourceType source,
|
||||
|
@ -47,6 +47,8 @@
|
||||
#endif
|
||||
|
||||
#include "core/components_ng/event/input_event.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_accessibility_child_tree_callback.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_accessibility_session_adapter.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_event_hub.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_ext_surface_callback_client.h"
|
||||
#include "core/event/key_event.h"
|
||||
@ -254,6 +256,8 @@ void XComponentPattern::Initialize()
|
||||
InitNativeNodeCallbacks();
|
||||
}
|
||||
}
|
||||
|
||||
InitializeAccessibility();
|
||||
}
|
||||
|
||||
void XComponentPattern::OnAttachToMainTree()
|
||||
@ -577,6 +581,7 @@ void XComponentPattern::OnRebuildFrame()
|
||||
void XComponentPattern::OnDetachFromFrameNode(FrameNode* frameNode)
|
||||
{
|
||||
CHECK_NULL_VOID(frameNode);
|
||||
UninitializeAccessibility();
|
||||
if (isTypedNode_) {
|
||||
if (isNativeXComponent_) {
|
||||
OnNativeUnload(frameNode);
|
||||
@ -858,6 +863,168 @@ void XComponentPattern::XComponentSizeChange(const RectF& surfaceRect, bool need
|
||||
OnSurfaceChanged(surfaceRect);
|
||||
}
|
||||
|
||||
RefPtr<AccessibilitySessionAdapter> XComponentPattern::GetAccessibilitySessionAdapter()
|
||||
{
|
||||
return accessibilitySessionAdapter_;
|
||||
}
|
||||
|
||||
void XComponentPattern::InitializeAccessibility()
|
||||
{
|
||||
if (accessibilityChildTreeCallback_) {
|
||||
return;
|
||||
}
|
||||
|
||||
InitializeAccessibilityCallback();
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
int64_t accessibilityId = host->GetAccessibilityId();
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT,
|
||||
"InitializeAccessibility accessibilityId: %{public}" PRId64 "", accessibilityId);
|
||||
auto pipeline = host->GetContextRefPtr();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto accessibilityManager = pipeline->GetAccessibilityManager();
|
||||
CHECK_NULL_VOID(accessibilityManager);
|
||||
accessibilityChildTreeCallback_ = std::make_shared<XComponentAccessibilityChildTreeCallback>(
|
||||
WeakClaim(this), host->GetAccessibilityId());
|
||||
accessibilityManager->RegisterAccessibilityChildTreeCallback(
|
||||
accessibilityId, accessibilityChildTreeCallback_);
|
||||
if (accessibilityManager->IsRegister()) {
|
||||
accessibilityChildTreeCallback_->OnRegister(
|
||||
pipeline->GetWindowId(), accessibilityManager->GetTreeId());
|
||||
}
|
||||
}
|
||||
|
||||
void XComponentPattern::UninitializeAccessibility()
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "UninitializeAccessibility");
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
int64_t accessibilityId = host->GetAccessibilityId();
|
||||
auto pipeline = host->GetContextRefPtr();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto accessibilityManager = pipeline->GetAccessibilityManager();
|
||||
CHECK_NULL_VOID(accessibilityManager);
|
||||
if (accessibilityManager->IsRegister() && accessibilityChildTreeCallback_) {
|
||||
accessibilityChildTreeCallback_->OnDeregister();
|
||||
}
|
||||
accessibilityManager->DeregisterAccessibilityChildTreeCallback(accessibilityId);
|
||||
accessibilityChildTreeCallback_ = nullptr;
|
||||
}
|
||||
|
||||
bool XComponentPattern::OnAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId)
|
||||
{
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_RETURN(host, false);
|
||||
auto pipeline = host->GetContextRefPtr();
|
||||
CHECK_NULL_RETURN(pipeline, false);
|
||||
auto accessibilityManager = pipeline->GetAccessibilityManager();
|
||||
CHECK_NULL_RETURN(accessibilityManager, false);
|
||||
if (accessibilityProvider_ == nullptr) {
|
||||
accessibilityProvider_ =
|
||||
AceType::MakeRefPtr<XComponentAccessibilityProvider>(WeakClaim(this));
|
||||
}
|
||||
|
||||
auto pair = GetNativeXComponent();
|
||||
auto nativeXComponentImpl = pair.first;
|
||||
CHECK_NULL_RETURN(nativeXComponentImpl, false);
|
||||
auto nativeProvider = nativeXComponentImpl->GetAccessbilityProvider();
|
||||
CHECK_NULL_RETURN(nativeProvider, false);
|
||||
if (!nativeProvider->IsRegister()) {
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "Not register native accessibility");
|
||||
return false;
|
||||
}
|
||||
|
||||
nativeProvider->SetInnerAccessibilityProvider(accessibilityProvider_);
|
||||
if (accessibilitySessionAdapter_ == nullptr) {
|
||||
accessibilitySessionAdapter_ =
|
||||
AceType::MakeRefPtr<XcomponentAccessibilitySessionAdapter>(host);
|
||||
}
|
||||
Registration registration;
|
||||
registration.windowId = windowId;
|
||||
registration.parentWindowId = windowId;
|
||||
registration.parentTreeId = treeId;
|
||||
registration.elementId = host->GetAccessibilityId();
|
||||
registration.operatorType = OperatorType::JS_THIRD_PROVIDER;
|
||||
registration.hostNode = WeakClaim(RawPtr(host));
|
||||
registration.accessibilityProvider = WeakClaim(RawPtr(accessibilityProvider_));
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "OnAccessibilityChildTreeRegister, "
|
||||
"windowId: %{public}d, treeId: %{public}d.", windowId, treeId);
|
||||
return accessibilityManager->RegisterInteractionOperationAsChildTree(registration);
|
||||
}
|
||||
|
||||
bool XComponentPattern::OnAccessibilityChildTreeDeregister()
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "OnAccessibilityChildTreeDeregister, "
|
||||
"windowId: %{public}u, treeId: %{public}d.", windowId_, treeId_);
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_RETURN(host, false);
|
||||
auto pipeline = host->GetContextRefPtr();
|
||||
CHECK_NULL_RETURN(pipeline, false);
|
||||
auto accessibilityManager = pipeline->GetAccessibilityManager();
|
||||
CHECK_NULL_RETURN(accessibilityManager, false);
|
||||
auto pair = GetNativeXComponent();
|
||||
auto nativeXComponentImpl = pair.first;
|
||||
CHECK_NULL_RETURN(nativeXComponentImpl, false);
|
||||
auto nativeProvider = nativeXComponentImpl->GetAccessbilityProvider();
|
||||
CHECK_NULL_RETURN(nativeProvider, false);
|
||||
nativeProvider->SetInnerAccessibilityProvider(nullptr);
|
||||
accessibilitySessionAdapter_ = nullptr;
|
||||
accessibilityProvider_ = nullptr;
|
||||
return accessibilityManager->DeregisterInteractionOperationAsChildTree(windowId_, treeId_);
|
||||
}
|
||||
|
||||
void XComponentPattern::OnSetAccessibilityChildTree(
|
||||
int32_t childWindowId, int32_t childTreeId)
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "OnAccessibilityChildTreeDeregister, "
|
||||
"windowId: %{public}d, treeId: %{public}d.", childWindowId, childTreeId);
|
||||
windowId_ = static_cast<uint32_t>(childWindowId);
|
||||
treeId_ = childTreeId;
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
auto accessibilityProperty = host->GetAccessibilityProperty<AccessibilityProperty>();
|
||||
if (accessibilityProperty != nullptr) {
|
||||
accessibilityProperty->SetChildWindowId(childWindowId);
|
||||
accessibilityProperty->SetChildTreeId(childTreeId);
|
||||
}
|
||||
}
|
||||
|
||||
void XComponentPattern::InitializeAccessibilityCallback()
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "InitializeAccessibilityCallback");
|
||||
CHECK_NULL_VOID(nativeXComponentImpl_);
|
||||
auto nativeProvider = nativeXComponentImpl_->GetAccessbilityProvider();
|
||||
CHECK_NULL_VOID(nativeProvider);
|
||||
nativeProvider->SetRegisterCallback(
|
||||
[weak = WeakClaim(this)] (bool isRegister) {
|
||||
auto pattern = weak.Upgrade();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
pattern->HandleRegisterAccessibilityEvent(isRegister);
|
||||
});
|
||||
}
|
||||
|
||||
void XComponentPattern::HandleRegisterAccessibilityEvent(bool isRegister)
|
||||
{
|
||||
TAG_LOGI(AceLogTag::ACE_XCOMPONENT, "HandleRegisterAccessibilityEvent, "
|
||||
"isRegister: %{public}d.", isRegister);
|
||||
CHECK_NULL_VOID(accessibilityChildTreeCallback_);
|
||||
auto host = GetHost();
|
||||
CHECK_NULL_VOID(host);
|
||||
auto pipeline = host->GetContextRefPtr();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto accessibilityManager = pipeline->GetAccessibilityManager();
|
||||
CHECK_NULL_VOID(accessibilityManager);
|
||||
if (!isRegister) {
|
||||
accessibilityChildTreeCallback_->OnDeregister();
|
||||
return;
|
||||
}
|
||||
|
||||
if (accessibilityManager->IsRegister()) {
|
||||
accessibilityChildTreeCallback_->OnRegister(
|
||||
pipeline->GetWindowId(), accessibilityManager->GetTreeId());
|
||||
}
|
||||
}
|
||||
|
||||
void XComponentPattern::InitNativeNodeCallbacks()
|
||||
{
|
||||
CHECK_NULL_VOID(nativeXComponent_);
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "core/components_ng/event/input_event.h"
|
||||
#include "core/components_ng/pattern/pattern.h"
|
||||
#include "core/components_ng/pattern/xcomponent/inner_xcomponent_controller.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_accessibility_provider.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_event_hub.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_layout_algorithm.h"
|
||||
#include "core/components_ng/pattern/xcomponent/xcomponent_layout_property.h"
|
||||
@ -295,6 +296,17 @@ public:
|
||||
const std::string& componentId, const uint32_t nodeId, const bool isDestroy);
|
||||
void ConfigSurface(uint32_t surfaceWidth, uint32_t surfaceHeight);
|
||||
|
||||
// accessibility
|
||||
void InitializeAccessibility();
|
||||
void UninitializeAccessibility();
|
||||
bool OnAccessibilityChildTreeRegister(uint32_t windowId, int32_t treeId);
|
||||
bool OnAccessibilityChildTreeDeregister();
|
||||
void OnSetAccessibilityChildTree(int32_t childWindowId, int32_t childTreeId);
|
||||
void SetAccessibilityState(bool state) {}
|
||||
RefPtr<AccessibilitySessionAdapter> GetAccessibilitySessionAdapter() override;
|
||||
void InitializeAccessibilityCallback();
|
||||
void HandleRegisterAccessibilityEvent(bool isRegister);
|
||||
|
||||
void SetIdealSurfaceWidth(float surfaceWidth);
|
||||
void SetIdealSurfaceHeight(float surfaceHeight);
|
||||
void SetIdealSurfaceOffsetX(float offsetX);
|
||||
@ -442,6 +454,11 @@ private:
|
||||
void* nativeWindow_ = nullptr;
|
||||
|
||||
bool isSurfaceLock_ = false;
|
||||
uint32_t windowId_ = 0;
|
||||
int32_t treeId_ = 0;
|
||||
std::shared_ptr<AccessibilityChildTreeCallback> accessibilityChildTreeCallback_;
|
||||
RefPtr<XComponentAccessibilityProvider> accessibilityProvider_;
|
||||
RefPtr<AccessibilitySessionAdapter> accessibilitySessionAdapter_;
|
||||
|
||||
// for export texture
|
||||
NodeRenderType renderType_ = NodeRenderType::RENDER_TYPE_DISPLAY;
|
||||
|
@ -107,6 +107,7 @@ constexpr int32_t RIGHT_ANGLE = 90;
|
||||
constexpr int32_t STRAIGHT_ANGLE = 180;
|
||||
constexpr int32_t REFLEX_ANGLE = 270;
|
||||
constexpr int32_t FULL_ROTATION = 360;
|
||||
constexpr int32_t ACCESSIBILITY_FOCUS_WITHOUT_EVENT = -2100001;
|
||||
const Color MASK_COLOR = Color::FromARGB(25, 0, 0, 0);
|
||||
const Color DEFAULT_MASK_COLOR = Color::FromARGB(0, 0, 0, 0);
|
||||
constexpr Dimension DASH_GEP_WIDTH = -1.0_px;
|
||||
@ -2547,6 +2548,11 @@ void RosenRenderContext::OnAccessibilityFocusUpdate(
|
||||
} else {
|
||||
ClearAccessibilityFocus();
|
||||
}
|
||||
|
||||
if (accessibilityIdForVirtualNode == ACCESSIBILITY_FOCUS_WITHOUT_EVENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (accessibilityIdForVirtualNode == INVALID_PARENT_ID) {
|
||||
uiNode->OnAccessibilityEvent(isAccessibilityFocus ? AccessibilityEventType::ACCESSIBILITY_FOCUSED
|
||||
: AccessibilityEventType::ACCESSIBILITY_FOCUS_CLEARED);
|
||||
|
@ -51,10 +51,13 @@ ohos_shared_library("ace_ndk") {
|
||||
public_configs = [ ":ace_ndk_public_configs" ]
|
||||
|
||||
sources = [
|
||||
"//foundation/arkui/ace_engine/frameworks/core/accessibility/native_interface_accessibility_impl.cpp",
|
||||
"//foundation/arkui/ace_engine/frameworks/core/accessibility/native_interface_accessibility_provider.cpp",
|
||||
"//foundation/arkui/ace_engine/frameworks/core/components/common/properties/color.cpp",
|
||||
"//foundation/arkui/ace_engine/frameworks/core/components/xcomponent/native_interface_xcomponent_impl.cpp",
|
||||
"event/drag_and_drop_impl.cpp",
|
||||
"event/ui_input_event.cpp",
|
||||
"native_interface_accessibility.cpp",
|
||||
"native_interface_xcomponent.cpp",
|
||||
"node/animate_impl.cpp",
|
||||
"node/dialog_model.cpp",
|
||||
|
@ -2138,5 +2138,225 @@
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_ArkUI_CustomSpanDrawInfo_GetBaseline"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityProviderRegisterCallback"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_SendAccessibilityAsyncEvent"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AddAndGetAccessibilityElementInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetParentId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetComponentType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetContents"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetHintText"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityText"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityDescription"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetChildNodeIds"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetOperationActions"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetScreenRect"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetCheckable"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetChecked"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetFocusable"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetFocused"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetVisible"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityFocused"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetSelected"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetClickable"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetLongClickable"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetEnabled"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetIsPassword"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetScrollable"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetEditable"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetIsHint"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetRangeInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetGridInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetGridItemInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetSelectedTextStart"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetSelectedTextEnd"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetCurrentItemIndex"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetStartItemIndex"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetEndItemIndex"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetItemCount"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityOffset"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityGroup"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityLevel"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetZIndex"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetAccessibilityOpacity"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetBackgroundColor"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetBackgroundImage"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetBlur"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetHitTestBehavior"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_CreateAccessibilityEventInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_DestoryAccessibilityEventInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityEventSetEventType"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityEventSetTextAnnouncedForAccessibility"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityEventSetRequestFocusId"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityEventSetElementInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_FindAccessibilityActionArgumentByKey"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_CreateAccessibilityElementInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_DestoryAccessibilityElementInfo"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_NativeXComponent_GetNativeAccessibilityProvider"
|
||||
},
|
||||
{
|
||||
"first_introduced": "13",
|
||||
"name": "OH_ArkUI_AccessibilityElementInfoSetElementId"
|
||||
}
|
||||
]
|
||||
|
@ -36,7 +36,7 @@ int32_t OH_ArkUI_AccessibilityProviderRegisterCallback(
|
||||
ArkUI_AccessibilityProvider* provider, ArkUI_AccessibilityProviderCallbacks* callbacks)
|
||||
{
|
||||
if ((provider == nullptr) || (callbacks == nullptr)) {
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
return provider->AccessibilityProviderRegisterCallback(callbacks);
|
||||
}
|
||||
@ -93,422 +93,414 @@ void OH_ArkUI_DestoryAccessibilityEventInfo(ArkUI_AccessibilityEventInfo* eventI
|
||||
delete eventInfo;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoElementId(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetElementId(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t elementId)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetElementId(elementId);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoComponentId(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t componentId)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetComponentId(componentId);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoParentId(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetParentId(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t parentId)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetParentId(parentId);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoComponentType(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetComponentType(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* componentType)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(componentType, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(componentType, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetComponentType(componentType);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoContents(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetContents(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* contents)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(contents, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(contents, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetContents(contents);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoHintText(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetHintText(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* hintText)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(hintText, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(hintText, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetHintText(hintText);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityText(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityText(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* accessibilityText)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(accessibilityText, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(accessibilityText, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetAccessibilityText(accessibilityText);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityDescription(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityDescription(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* accessibilityDescription)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(accessibilityDescription, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(accessibilityDescription, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetAccessibilityDescription(accessibilityDescription);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoChildNodeIds(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetChildNodeIds(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t childCount, int64_t* childNodeIds)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(childNodeIds, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(childNodeIds, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
if (childCount <= 0) {
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
elementInfo->ClearChildNodeIds();
|
||||
for (int32_t i = 0; i < childCount; i++) {
|
||||
elementInfo->AddChildNodeId(childNodeIds[i]);
|
||||
}
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoOperationActions(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetOperationActions(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t operationCount,
|
||||
ArkUI_AccessibleAction* operationActions)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(operationActions, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(operationActions, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
if (operationCount <= 0) {
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
elementInfo->ClearChildNodeIds();
|
||||
for (int32_t i = 0; i < operationCount; i++) {
|
||||
elementInfo->AddOperationAction(operationActions[i]);
|
||||
}
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoScreenRect(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetScreenRect(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, ArkUI_AccessibleRect* screenRect)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(screenRect, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(screenRect, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetRect(*screenRect);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoCheckable(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetCheckable(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool checkable)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetCheckable(checkable);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoChecked(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetChecked(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool checked)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetChecked(checked);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoFocusable(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetFocusable(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool focusable)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetFocusable(focusable);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoFocused(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetFocused(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool isFocused)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetFocused(isFocused);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoVisible(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetVisible(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool isVisible)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetVisible(isVisible);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityFocused(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityFocused(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool accessibilityFocused)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetAccessibilityFocused(accessibilityFocused);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoSelected(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetSelected(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool selected)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetSelected(selected);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoClickable(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetClickable(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool clickable)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetClickable(clickable);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoLongClickable(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetLongClickable(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool longClickable)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetLongClickable(longClickable);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoEnabled(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetEnabled(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool isEnabled)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetEnabled(isEnabled);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoIsPassword(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetIsPassword(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool isPassword)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetPassword(isPassword);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoScrollable(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetScrollable(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool scrollable)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetScrollable(scrollable);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoEditable(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetEditable(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool editable)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetEditable(editable);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoIsHint(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetIsHint(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool isHint)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetHint(isHint);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoRangeInfo(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetRangeInfo(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, ArkUI_AccessibleRangeInfo* rangeInfo)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(rangeInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(rangeInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetRangeInfo(*rangeInfo);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoGridInfo(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetGridInfo(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, ArkUI_AccessibleGridInfo* gridInfo)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(gridInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(gridInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetGridInfo(*gridInfo);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoGridItemInfo(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetGridItemInfo(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, ArkUI_AccessibleGridItemInfo* gridItem)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(gridItem, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(gridItem, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetGridItemInfo(*gridItem);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoTextBeginSelected(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t textBeginSelected)
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetSelectedTextStart(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t selectedTextStart)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetTextBeginSelected(textBeginSelected);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetTextBeginSelected(selectedTextStart);
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoTextEndSelected(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t textEndSelected)
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetSelectedTextEnd(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t selectedTextEnd)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetTextEndSelected(textEndSelected);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetTextEndSelected(selectedTextEnd);
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoCurrentItemIndex(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetCurrentItemIndex(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t currentItemIndex)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetCurrentIndex(currentItemIndex);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoBeginItemIndex(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t beginItemIndex)
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetStartItemIndex(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t startItemIndex)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetBeginIndex(beginItemIndex);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetBeginIndex(startItemIndex);
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoEndItemIndex(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetEndItemIndex(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t endItemIndex)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetEndIndex(endItemIndex);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoItemCount(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetItemCount(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t itemCount)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetItemCount(itemCount);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityOffset(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityOffset(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t offset)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetOffset(offset);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityGroup(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityGroup(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, bool accessibilityGroup)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetAccessibilityGroup(accessibilityGroup);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityLevel(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityLevel(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* accessibilityLevel)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(accessibilityLevel, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(accessibilityLevel, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetAccessibilityLevel(accessibilityLevel);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoZIndex(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetZIndex(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, int32_t zIndex)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetZIndex(zIndex);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoAccessibilityOpacity(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetAccessibilityOpacity(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, float opacity)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
if (std::isnan(opacity)) {
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
elementInfo->SetOpacity(opacity);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoBackgroundColor(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetBackgroundColor(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* backgroundColor)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(backgroundColor, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(backgroundColor, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetBackgroundColor(backgroundColor);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoBackgroundImage(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetBackgroundImage(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* backgroundImage)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(backgroundImage, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(backgroundImage, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetBackgroundImage(backgroundImage);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoBlur(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetBlur(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* blur)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(blur, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(blur, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetBlur(blur);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityElementInfoHitTestBehavior(
|
||||
int32_t OH_ArkUI_AccessibilityElementInfoSetHitTestBehavior(
|
||||
ArkUI_AccessibilityElementInfo* elementInfo, const char* hitTestBehavior)
|
||||
{
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(hitTestBehavior, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(hitTestBehavior, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
elementInfo->SetHitTestBehavior(hitTestBehavior);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityEventEventType(
|
||||
int32_t OH_ArkUI_AccessibilityEventSetEventType(
|
||||
ArkUI_AccessibilityEventInfo* eventInfo, ArkUI_AccessibilityEventType eventType)
|
||||
{
|
||||
CHECK_NULL_RETURN(eventInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(eventInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
eventInfo->SetEventType(eventType);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityEventTextAnnouncedForAccessibility(
|
||||
int32_t OH_ArkUI_AccessibilityEventSetTextAnnouncedForAccessibility(
|
||||
ArkUI_AccessibilityEventInfo* eventInfo, const char* textAnnouncedForAccessibility)
|
||||
{
|
||||
CHECK_NULL_RETURN(eventInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(eventInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
eventInfo->SetTextAnnouncedForAccessibility(textAnnouncedForAccessibility);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityEventRequestFocusId(
|
||||
int32_t OH_ArkUI_AccessibilityEventSetRequestFocusId(
|
||||
ArkUI_AccessibilityEventInfo* eventInfo, int32_t requestFocusId)
|
||||
{
|
||||
CHECK_NULL_RETURN(eventInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(eventInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
eventInfo->SetRequestFocusId(requestFocusId);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_SetAccessibilityEventElementInfo(
|
||||
int32_t OH_ArkUI_AccessibilityEventSetElementInfo(
|
||||
ArkUI_AccessibilityEventInfo* eventInfo, ArkUI_AccessibilityElementInfo* elementInfo)
|
||||
{
|
||||
CHECK_NULL_RETURN(eventInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(eventInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(elementInfo, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
eventInfo->SetElementInfo(elementInfo);
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
int32_t OH_ArkUI_FindAccessibilityActionArgumentByKey(
|
||||
ArkUI_AccessibilityActionArguments* arguments, const char* key, char** value)
|
||||
{
|
||||
CHECK_NULL_RETURN(arguments, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(key, OH_ARKUI_ACCESSIBILITY_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(arguments, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
CHECK_NULL_RETURN(key, ARKUI_ACCESSIBILITY_NATIVE_RESULT_BAD_PARAMETER);
|
||||
*value = const_cast<char*>(arguments->FindValueByKey(key));
|
||||
return OH_ARKUI_ACCESSIBILITY_RESULT_SUCCESS;
|
||||
return ARKUI_ACCESSIBILITY_NATIVE_RESULT_SUCCESSFUL;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -339,6 +339,17 @@ OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent(ArkUI_NodeHandle no
|
||||
nodeModifiers->getXComponentModifier()->getNativeXComponent(node->uiNodeHandle));
|
||||
}
|
||||
|
||||
int32_t OH_NativeXComponent_GetNativeAccessibilityProvider(
|
||||
OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle)
|
||||
{
|
||||
if ((component == nullptr) || (handle == nullptr)) {
|
||||
return OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
return component->GetAccessibilityProvider(handle);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "native_type.h"
|
||||
#include "native_xcomponent_key_event.h"
|
||||
#include "ui_input_event.h"
|
||||
#include "native_interface_accessibility.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -804,6 +805,19 @@ int32_t OH_NativeXComponent_GetTouchEventSourceType(
|
||||
*/
|
||||
OH_NativeXComponent* OH_NativeXComponent_GetNativeXComponent(ArkUI_NodeHandle node);
|
||||
|
||||
/**
|
||||
* @brief Obtains the pointer to the <b> ArkUI_AccessibilityProvider</b>
|
||||
* instance of this <b>OH_NativeXComponent</b> instance.
|
||||
*
|
||||
* @param component Indicates the pointer to the <b>OH_NativeXComponent</b> instance.
|
||||
* @param handle Indicates the pointer to the <b>ArkUI_AccessibilityProvider</b> instance.
|
||||
* @return Returns <b>OH_NATIVEXCOMPONENT_RESULT_SUCCESS</b> if the operation is successful.
|
||||
* Returns <b>OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER</b> if a parameter error occurs.
|
||||
* @since 13
|
||||
*/
|
||||
int32_t OH_NativeXComponent_GetNativeAccessibilityProvider(
|
||||
OH_NativeXComponent* component, ArkUI_AccessibilityProvider** handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
@ -416,6 +416,8 @@ ohos_source_set("ace_core_extra") {
|
||||
"$ace_root/frameworks/base/thread/background_task_executor.cpp",
|
||||
"$ace_root/frameworks/core/accessibility/accessibility_node.cpp",
|
||||
"$ace_root/frameworks/core/accessibility/accessibility_utils.cpp",
|
||||
"$ace_root/frameworks/core/accessibility/native_interface_accessibility_impl.cpp",
|
||||
"$ace_root/frameworks/core/accessibility/native_interface_accessibility_provider.cpp",
|
||||
"$ace_root/frameworks/core/common/agingadapation/aging_adapation_dialog_util.cpp",
|
||||
"$ace_root/frameworks/core/common/container_scope.cpp",
|
||||
"$ace_root/frameworks/core/common/event_dump.cpp",
|
||||
@ -1132,6 +1134,9 @@ ohos_source_set("ace_components_pattern") {
|
||||
"$ace_root/frameworks/core/components_ng/pattern/waterflow/water_flow_paint_method.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/waterflow/water_flow_pattern.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/waterflow/water_flow_sections.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_accessibility_child_tree_callback.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_accessibility_provider.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_accessibility_session_adapter.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_controller_ng.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_ext_surface_callback_client.cpp",
|
||||
"$ace_root/frameworks/core/components_ng/pattern/xcomponent/xcomponent_layout_algorithm.cpp",
|
||||
|
Loading…
Reference in New Issue
Block a user