123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_FRAMEWORKS_BRIDGE_COMMON_ACCESSIBILITY_JS_ACCESSIBILITY_MANAGER_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_COMMON_ACCESSIBILITY_JS_ACCESSIBILITY_MANAGER_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include <unordered_map> 2023b3eb3cSopenharmony_ci#include <unordered_set> 2123b3eb3cSopenharmony_ci#include <vector> 2223b3eb3cSopenharmony_ci 2323b3eb3cSopenharmony_ci#include "accessibility_config.h" 2423b3eb3cSopenharmony_ci#include "accessibility_element_operator.h" 2523b3eb3cSopenharmony_ci#include "accessibility_event_info.h" 2623b3eb3cSopenharmony_ci#include "accessibility_state_event.h" 2723b3eb3cSopenharmony_ci 2823b3eb3cSopenharmony_ci#include "core/accessibility/accessibility_manager.h" 2923b3eb3cSopenharmony_ci#include "core/accessibility/accessibility_utils.h" 3023b3eb3cSopenharmony_ci#include "frameworks/bridge/common/accessibility/accessibility_node_manager.h" 3123b3eb3cSopenharmony_ci 3223b3eb3cSopenharmony_ci#include "js_third_accessibility_hover_ng.h" 3323b3eb3cSopenharmony_ci 3423b3eb3cSopenharmony_cinamespace OHOS::NWeb { 3523b3eb3cSopenharmony_ciclass NWebAccessibilityNodeInfo; 3623b3eb3cSopenharmony_ci} // namespace OHOS::NWeb::NWebAccessibilityNodeInfo 3723b3eb3cSopenharmony_ci 3823b3eb3cSopenharmony_cinamespace OHOS::Ace::Framework { 3923b3eb3cSopenharmony_ci 4023b3eb3cSopenharmony_cistruct SearchParameter { 4123b3eb3cSopenharmony_ci int64_t nodeId; 4223b3eb3cSopenharmony_ci std::string text; 4323b3eb3cSopenharmony_ci int32_t mode; 4423b3eb3cSopenharmony_ci int64_t uiExtensionOffset; 4523b3eb3cSopenharmony_ci}; 4623b3eb3cSopenharmony_ci 4723b3eb3cSopenharmony_cistruct CommonProperty { 4823b3eb3cSopenharmony_ci int32_t windowId = 0; 4923b3eb3cSopenharmony_ci int32_t windowLeft = 0; 5023b3eb3cSopenharmony_ci int32_t windowTop = 0; 5123b3eb3cSopenharmony_ci int32_t pageId = 0; 5223b3eb3cSopenharmony_ci std::string pagePath; 5323b3eb3cSopenharmony_ci}; 5423b3eb3cSopenharmony_ci 5523b3eb3cSopenharmony_cistruct ActionTable { 5623b3eb3cSopenharmony_ci AceAction aceAction; 5723b3eb3cSopenharmony_ci ActionType action; 5823b3eb3cSopenharmony_ci}; 5923b3eb3cSopenharmony_ci 6023b3eb3cSopenharmony_cistruct ActionStrTable { 6123b3eb3cSopenharmony_ci ActionType action; 6223b3eb3cSopenharmony_ci std::string actionStr; 6323b3eb3cSopenharmony_ci}; 6423b3eb3cSopenharmony_ci 6523b3eb3cSopenharmony_cistruct FillEventInfoParam { 6623b3eb3cSopenharmony_ci int64_t elementId = 0; 6723b3eb3cSopenharmony_ci int64_t stackNodeId = 0; 6823b3eb3cSopenharmony_ci uint32_t windowId = 0; 6923b3eb3cSopenharmony_ci}; 7023b3eb3cSopenharmony_ci 7123b3eb3cSopenharmony_cistruct AccessibilityActionParam { 7223b3eb3cSopenharmony_ci RefPtr<NG::AccessibilityProperty> accessibilityProperty; 7323b3eb3cSopenharmony_ci std::string setTextArgument = ""; 7423b3eb3cSopenharmony_ci int32_t setSelectionStart = -1; 7523b3eb3cSopenharmony_ci int32_t setSelectionEnd = -1; 7623b3eb3cSopenharmony_ci bool setSelectionDir = false; 7723b3eb3cSopenharmony_ci int32_t setCursorIndex = -1; 7823b3eb3cSopenharmony_ci TextMoveUnit moveUnit = TextMoveUnit::STEP_CHARACTER; 7923b3eb3cSopenharmony_ci AccessibilityScrollType scrollType = AccessibilityScrollType::SCROLL_DEFAULT; 8023b3eb3cSopenharmony_ci int32_t spanId = -1; 8123b3eb3cSopenharmony_ci}; 8223b3eb3cSopenharmony_ci 8323b3eb3cSopenharmony_cistruct ActionParam { 8423b3eb3cSopenharmony_ci Accessibility::ActionType action; 8523b3eb3cSopenharmony_ci std::map<std::string, std::string> actionArguments; 8623b3eb3cSopenharmony_ci}; 8723b3eb3cSopenharmony_ci 8823b3eb3cSopenharmony_ciclass JsAccessibilityManager : public AccessibilityNodeManager, 8923b3eb3cSopenharmony_ci public AccessibilityHoverManagerForThirdNG { 9023b3eb3cSopenharmony_ci DECLARE_ACE_TYPE(JsAccessibilityManager, AccessibilityNodeManager); 9123b3eb3cSopenharmony_ci 9223b3eb3cSopenharmony_cipublic: 9323b3eb3cSopenharmony_ci JsAccessibilityManager() = default; 9423b3eb3cSopenharmony_ci ~JsAccessibilityManager() override; 9523b3eb3cSopenharmony_ci 9623b3eb3cSopenharmony_ci // JsAccessibilityManager overrides functions. 9723b3eb3cSopenharmony_ci void InitializeCallback() override; 9823b3eb3cSopenharmony_ci void SendAccessibilityAsyncEvent(const AccessibilityEvent& accessibilityEvent) override; 9923b3eb3cSopenharmony_ci void UpdateVirtualNodeFocus() override; 10023b3eb3cSopenharmony_ci void SetCardViewParams(const std::string& key, bool focus) override; 10123b3eb3cSopenharmony_ci void HandleComponentPostBinding() override; 10223b3eb3cSopenharmony_ci void RegisterSubWindowInteractionOperation(int windowId) override; 10323b3eb3cSopenharmony_ci void SetPipelineContext(const RefPtr<PipelineBase>& context) override; 10423b3eb3cSopenharmony_ci void UpdateElementInfosTreeId(std::list<Accessibility::AccessibilityElementInfo>& infos); 10523b3eb3cSopenharmony_ci void UpdateElementInfoTreeId(Accessibility::AccessibilityElementInfo& info); 10623b3eb3cSopenharmony_ci 10723b3eb3cSopenharmony_ci void UpdateViewScale(); 10823b3eb3cSopenharmony_ci 10923b3eb3cSopenharmony_ci float GetScaleX() const 11023b3eb3cSopenharmony_ci { 11123b3eb3cSopenharmony_ci return scaleX_; 11223b3eb3cSopenharmony_ci } 11323b3eb3cSopenharmony_ci 11423b3eb3cSopenharmony_ci float GetScaleY() const 11523b3eb3cSopenharmony_ci { 11623b3eb3cSopenharmony_ci return scaleY_; 11723b3eb3cSopenharmony_ci } 11823b3eb3cSopenharmony_ci 11923b3eb3cSopenharmony_ci uint32_t GetWindowId() const 12023b3eb3cSopenharmony_ci { 12123b3eb3cSopenharmony_ci return windowId_; 12223b3eb3cSopenharmony_ci } 12323b3eb3cSopenharmony_ci 12423b3eb3cSopenharmony_ci void SetWindowId(uint32_t windowId) 12523b3eb3cSopenharmony_ci { 12623b3eb3cSopenharmony_ci windowId_ = windowId; 12723b3eb3cSopenharmony_ci } 12823b3eb3cSopenharmony_ci 12923b3eb3cSopenharmony_ci void SaveLast(const int64_t elementId, const RefPtr<NG::FrameNode>& node) 13023b3eb3cSopenharmony_ci { 13123b3eb3cSopenharmony_ci lastElementId_ = elementId; 13223b3eb3cSopenharmony_ci lastFrameNode_ = node; 13323b3eb3cSopenharmony_ci } 13423b3eb3cSopenharmony_ci 13523b3eb3cSopenharmony_ci void SaveCurrentFocusNodeSize(const RefPtr<NG::FrameNode>& currentFocusNode) 13623b3eb3cSopenharmony_ci { 13723b3eb3cSopenharmony_ci if (currentFocusNode->IsAccessibilityVirtualNode()) { 13823b3eb3cSopenharmony_ci auto oldGeometryNode = currentFocusNode->GetGeometryNode(); 13923b3eb3cSopenharmony_ci CHECK_NULL_VOID(oldGeometryNode); 14023b3eb3cSopenharmony_ci oldGeometrySize_ = oldGeometryNode->GetFrameSize(); 14123b3eb3cSopenharmony_ci } 14223b3eb3cSopenharmony_ci } 14323b3eb3cSopenharmony_ci 14423b3eb3cSopenharmony_ci bool SubscribeToastObserver(); 14523b3eb3cSopenharmony_ci bool UnsubscribeToastObserver(); 14623b3eb3cSopenharmony_ci bool SubscribeStateObserver(int eventType); 14723b3eb3cSopenharmony_ci bool UnsubscribeStateObserver(int eventType); 14823b3eb3cSopenharmony_ci int RegisterInteractionOperation(int windowId); 14923b3eb3cSopenharmony_ci void DeregisterInteractionOperation(); 15023b3eb3cSopenharmony_ci bool SendAccessibilitySyncEvent( 15123b3eb3cSopenharmony_ci const AccessibilityEvent& accessibilityEvent, Accessibility::AccessibilityEventInfo eventInfo); 15223b3eb3cSopenharmony_ci bool TransferAccessibilityAsyncEvent( 15323b3eb3cSopenharmony_ci const Accessibility::AccessibilityEventInfo& eventInfo, 15423b3eb3cSopenharmony_ci int64_t uiExtensionOffset) override; 15523b3eb3cSopenharmony_ci void SendExtensionAccessibilityEvent( 15623b3eb3cSopenharmony_ci const Accessibility::AccessibilityEventInfo& eventInfo, 15723b3eb3cSopenharmony_ci int64_t uiExtensionOffset) override; 15823b3eb3cSopenharmony_ci void SearchElementInfoByAccessibilityId(const int64_t elementId, const int32_t requestId, 15923b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t mode, const int32_t windowId); 16023b3eb3cSopenharmony_ci void SearchElementInfosByText(const int64_t elementId, const std::string& text, const int32_t requestId, 16123b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId); 16223b3eb3cSopenharmony_ci void FindFocusedElementInfo(const int64_t elementId, const int32_t focusType, const int32_t requestId, 16323b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId); 16423b3eb3cSopenharmony_ci void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId, 16523b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId); 16623b3eb3cSopenharmony_ci 16723b3eb3cSopenharmony_ci void ExecuteAction(const int64_t accessibilityId, const ActionParam& param, const int32_t requestId, 16823b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId); 16923b3eb3cSopenharmony_ci bool ClearCurrentFocus(); 17023b3eb3cSopenharmony_ci void UpdateNodeChildIds(const RefPtr<AccessibilityNode>& node); 17123b3eb3cSopenharmony_ci void SendActionEvent(const Accessibility::ActionType& action, int64_t nodeId); 17223b3eb3cSopenharmony_ci void SearchElementInfoByAccessibilityIdNG(int64_t elementId, int32_t mode, 17323b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>& infos, const RefPtr<PipelineBase>& context, 17423b3eb3cSopenharmony_ci const int64_t uiExtensionOffset = 0) override; 17523b3eb3cSopenharmony_ci void SearchElementInfosByTextNG(int64_t elementId, const std::string& text, 17623b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>& infos, const RefPtr<PipelineBase>& context, 17723b3eb3cSopenharmony_ci const int64_t uiExtensionOffset = 0) override; 17823b3eb3cSopenharmony_ci void FindFocusedElementInfoNG(int64_t elementId, int32_t focusType, Accessibility::AccessibilityElementInfo& info, 17923b3eb3cSopenharmony_ci const RefPtr<PipelineBase>& context, const int64_t uiExtensionOffset = 0) override; 18023b3eb3cSopenharmony_ci void FocusMoveSearchNG(int64_t elementId, int32_t direction, Accessibility::AccessibilityElementInfo& info, 18123b3eb3cSopenharmony_ci const RefPtr<PipelineBase>& context, const int64_t uiExtensionOffset = 0) override; 18223b3eb3cSopenharmony_ci bool ExecuteExtensionActionNG(int64_t elementId, const std::map<std::string, std::string>& actionArguments, 18323b3eb3cSopenharmony_ci int32_t action, const RefPtr<PipelineBase>& context, int64_t uiExtensionOffset) override; 18423b3eb3cSopenharmony_ci#ifdef WEB_SUPPORTED 18523b3eb3cSopenharmony_ci void SendWebAccessibilityAsyncEvent(const AccessibilityEvent& accessibilityEvent, 18623b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern) override; 18723b3eb3cSopenharmony_ci void SearchWebElementInfoByAccessibilityId(const int64_t elementId, const int32_t requestId, 18823b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t mode, const int32_t windowId, 18923b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 19023b3eb3cSopenharmony_ci void SearchWebElementInfoByAccessibilityIdNG(int64_t elementId, int32_t mode, 19123b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>& infos, const RefPtr<PipelineBase>& context, 19223b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 19323b3eb3cSopenharmony_ci void FindWebFocusedElementInfo(const int64_t elementId, const int32_t focusType, 19423b3eb3cSopenharmony_ci const int32_t requestId, Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId, 19523b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 19623b3eb3cSopenharmony_ci void FindWebFocusedElementInfoNG(int64_t elementId, int32_t focusType, 19723b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& info, const RefPtr<PipelineBase>& context, 19823b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 19923b3eb3cSopenharmony_ci void WebFocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId, 20023b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId, 20123b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 20223b3eb3cSopenharmony_ci void WebFocusMoveSearchNG(int64_t elementId, int32_t direction, 20323b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& info, const RefPtr<PipelineBase>& context, 20423b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 20523b3eb3cSopenharmony_ci void ExecuteWebAction(const int64_t elementId, const ActionParam& param, const int32_t requestId, 20623b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t windowId, 20723b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 20823b3eb3cSopenharmony_ci bool ExecuteWebActionNG(int64_t elementId, Accessibility::ActionType action, 20923b3eb3cSopenharmony_ci const std::map<std::string, std::string>& actionArguments, const RefPtr<NG::WebPattern>& webPattern); 21023b3eb3cSopenharmony_ci 21123b3eb3cSopenharmony_ci bool DeregisterWebInteractionOperationAsChildTree(int32_t treeID) override; 21223b3eb3cSopenharmony_ci bool RegisterWebInteractionOperationAsChildTree(int64_t accessibilityId, 21323b3eb3cSopenharmony_ci const WeakPtr<NG::WebPattern>& webPattern) override; 21423b3eb3cSopenharmony_ci void GetWebCursorPosition(const int64_t elementId, const int32_t requestId, 21523b3eb3cSopenharmony_ci AccessibilityElementOperatorCallback& callback, const RefPtr<NG::WebPattern>& webPattern); 21623b3eb3cSopenharmony_ci#endif //WEB_SUPPORTED 21723b3eb3cSopenharmony_ci void GetResultOfFocusMoveSearchNG( 21823b3eb3cSopenharmony_ci int64_t elementId, int32_t direction, Accessibility::AccessibilityElementInfo& info); 21923b3eb3cSopenharmony_ci 22023b3eb3cSopenharmony_ci std::string GetPagePath(); 22123b3eb3cSopenharmony_ci 22223b3eb3cSopenharmony_ci void RegisterAccessibilityChildTreeCallback( 22323b3eb3cSopenharmony_ci int64_t elementId, const std::shared_ptr<AccessibilityChildTreeCallback> &callback) override; 22423b3eb3cSopenharmony_ci 22523b3eb3cSopenharmony_ci void DeregisterAccessibilityChildTreeCallback(int64_t elementId) override; 22623b3eb3cSopenharmony_ci 22723b3eb3cSopenharmony_ci void RegisterAccessibilitySAObserverCallback( 22823b3eb3cSopenharmony_ci int64_t elementId, const std::shared_ptr<AccessibilitySAObserverCallback> &callback) override; 22923b3eb3cSopenharmony_ci 23023b3eb3cSopenharmony_ci void DeregisterAccessibilitySAObserverCallback(int64_t elementId) override; 23123b3eb3cSopenharmony_ci 23223b3eb3cSopenharmony_ci void RegisterInteractionOperationAsChildTree(uint32_t parentWindowId, int32_t parentTreeId, 23323b3eb3cSopenharmony_ci int64_t parentElementId) override; 23423b3eb3cSopenharmony_ci void SetAccessibilityGetParentRectHandler(std::function<void(int32_t &, int32_t &)> &&callback) override; 23523b3eb3cSopenharmony_ci void SetAccessibilityGetParentRectHandler( 23623b3eb3cSopenharmony_ci std::function<void(AccessibilityParentRectInfo &)> &&callback) override; 23723b3eb3cSopenharmony_ci void DeregisterInteractionOperationAsChildTree() override; 23823b3eb3cSopenharmony_ci void SendEventToAccessibilityWithNode(const AccessibilityEvent& accessibilityEvent, 23923b3eb3cSopenharmony_ci const RefPtr<AceType>& node, const RefPtr<PipelineBase>& context) override; 24023b3eb3cSopenharmony_ci 24123b3eb3cSopenharmony_ci bool RegisterInteractionOperationAsChildTree(const Registration& registration) override; 24223b3eb3cSopenharmony_ci bool DeregisterInteractionOperationAsChildTree(uint32_t windowId, int32_t treeId) override; 24323b3eb3cSopenharmony_ci 24423b3eb3cSopenharmony_ci void TransferThirdProviderHoverEvent( 24523b3eb3cSopenharmony_ci const WeakPtr<NG::FrameNode>& hostNode, const NG::PointF& point, SourceType source, 24623b3eb3cSopenharmony_ci NG::AccessibilityHoverEventType eventType, TimeStamp time) override; 24723b3eb3cSopenharmony_ci 24823b3eb3cSopenharmony_ci void DumpAccessibilityPropertyNG(const AccessibilityElementInfo& nodeInfo); 24923b3eb3cSopenharmony_ci void DumpCommonPropertyNG(const AccessibilityElementInfo& nodeInfo, int32_t treeId); 25023b3eb3cSopenharmony_ci bool OnDumpChildInfoForThird( 25123b3eb3cSopenharmony_ci int64_t hostElementId, 25223b3eb3cSopenharmony_ci const std::vector<std::string>& params, 25323b3eb3cSopenharmony_ci std::vector<std::string>& info) override; 25423b3eb3cSopenharmony_ci 25523b3eb3cSopenharmony_ciprotected: 25623b3eb3cSopenharmony_ci void OnDumpInfoNG(const std::vector<std::string>& params, uint32_t windowId, bool hasJson = false) override; 25723b3eb3cSopenharmony_ci void DumpHandleEvent(const std::vector<std::string>& params) override; 25823b3eb3cSopenharmony_ci void DumpProperty(const std::vector<std::string>& params) override; 25923b3eb3cSopenharmony_ci void DumpTree(int32_t depth, int64_t nodeID, bool isDumpSimplify = false) override; 26023b3eb3cSopenharmony_ci 26123b3eb3cSopenharmony_ciprivate: 26223b3eb3cSopenharmony_ci static constexpr int32_t INVALID_PARENT_ID = -2100000; 26323b3eb3cSopenharmony_ci 26423b3eb3cSopenharmony_ci class JsInteractionOperation : public Accessibility::AccessibilityElementOperator { 26523b3eb3cSopenharmony_ci public: 26623b3eb3cSopenharmony_ci explicit JsInteractionOperation(int32_t windowId) : windowId_(windowId) {} 26723b3eb3cSopenharmony_ci virtual ~JsInteractionOperation() = default; 26823b3eb3cSopenharmony_ci // Accessibility override. 26923b3eb3cSopenharmony_ci void SearchElementInfoByAccessibilityId(const int64_t elementId, const int32_t requestId, 27023b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t mode) override; 27123b3eb3cSopenharmony_ci void SearchElementInfosByText(const int64_t elementId, const std::string& text, const int32_t requestId, 27223b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 27323b3eb3cSopenharmony_ci void FindFocusedElementInfo(const int64_t elementId, const int32_t focusType, const int32_t requestId, 27423b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 27523b3eb3cSopenharmony_ci void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId, 27623b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 27723b3eb3cSopenharmony_ci void ExecuteAction(const int64_t elementId, const int32_t action, 27823b3eb3cSopenharmony_ci const std::map<std::string, std::string>& actionArguments, const int32_t requestId, 27923b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 28023b3eb3cSopenharmony_ci void ClearFocus() override; 28123b3eb3cSopenharmony_ci void OutsideTouch() override; 28223b3eb3cSopenharmony_ci void GetCursorPosition(const int64_t elementId, const int32_t requestId, 28323b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback &callback) override; 28423b3eb3cSopenharmony_ci void SetChildTreeIdAndWinId(const int64_t nodeId, const int32_t treeId, const int32_t childWindowId) override; 28523b3eb3cSopenharmony_ci void SetBelongTreeId(const int32_t treeId) override; 28623b3eb3cSopenharmony_ci 28723b3eb3cSopenharmony_ci void SetHandler(const WeakPtr<JsAccessibilityManager>& js) 28823b3eb3cSopenharmony_ci { 28923b3eb3cSopenharmony_ci js_ = js; 29023b3eb3cSopenharmony_ci } 29123b3eb3cSopenharmony_ci 29223b3eb3cSopenharmony_ci const WeakPtr<JsAccessibilityManager>& GetHandler() const 29323b3eb3cSopenharmony_ci { 29423b3eb3cSopenharmony_ci return js_; 29523b3eb3cSopenharmony_ci } 29623b3eb3cSopenharmony_ci 29723b3eb3cSopenharmony_ci private: 29823b3eb3cSopenharmony_ci WeakPtr<JsAccessibilityManager> js_; 29923b3eb3cSopenharmony_ci uint32_t windowId_ = 0; 30023b3eb3cSopenharmony_ci }; 30123b3eb3cSopenharmony_ci#ifdef WEB_SUPPORTED 30223b3eb3cSopenharmony_ci 30323b3eb3cSopenharmony_ci class WebInteractionOperation : public Accessibility::AccessibilityElementOperator { 30423b3eb3cSopenharmony_ci public: 30523b3eb3cSopenharmony_ci explicit WebInteractionOperation(int32_t windowId) : windowId_(windowId) {} 30623b3eb3cSopenharmony_ci virtual ~WebInteractionOperation() = default; 30723b3eb3cSopenharmony_ci // Accessibility override. 30823b3eb3cSopenharmony_ci void SearchElementInfoByAccessibilityId(const int64_t elementId, const int32_t requestId, 30923b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const int32_t mode) override; 31023b3eb3cSopenharmony_ci void SearchElementInfosByText(const int64_t elementId, const std::string& text, const int32_t requestId, 31123b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 31223b3eb3cSopenharmony_ci void FindFocusedElementInfo(const int64_t elementId, const int32_t focusType, const int32_t requestId, 31323b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 31423b3eb3cSopenharmony_ci void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId, 31523b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 31623b3eb3cSopenharmony_ci void ExecuteAction(const int64_t elementId, const int32_t action, 31723b3eb3cSopenharmony_ci const std::map<std::string, std::string>& actionArguments, const int32_t requestId, 31823b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback) override; 31923b3eb3cSopenharmony_ci void ClearFocus() override; 32023b3eb3cSopenharmony_ci void OutsideTouch() override; 32123b3eb3cSopenharmony_ci void GetCursorPosition(const int64_t elementId, const int32_t requestId, 32223b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback &callback) override; 32323b3eb3cSopenharmony_ci void SetChildTreeIdAndWinId(const int64_t nodeId, const int32_t treeId, const int32_t childWindowId) override; 32423b3eb3cSopenharmony_ci void SetBelongTreeId(const int32_t treeId) override; 32523b3eb3cSopenharmony_ci 32623b3eb3cSopenharmony_ci void SetHandler(const WeakPtr<JsAccessibilityManager>& js) 32723b3eb3cSopenharmony_ci { 32823b3eb3cSopenharmony_ci js_ = js; 32923b3eb3cSopenharmony_ci } 33023b3eb3cSopenharmony_ci 33123b3eb3cSopenharmony_ci const WeakPtr<JsAccessibilityManager>& GetHandler() const 33223b3eb3cSopenharmony_ci { 33323b3eb3cSopenharmony_ci return js_; 33423b3eb3cSopenharmony_ci } 33523b3eb3cSopenharmony_ci 33623b3eb3cSopenharmony_ci void SetWebPattern(const WeakPtr<NG::WebPattern>& webPattern) 33723b3eb3cSopenharmony_ci { 33823b3eb3cSopenharmony_ci webPattern_ = webPattern; 33923b3eb3cSopenharmony_ci } 34023b3eb3cSopenharmony_ci 34123b3eb3cSopenharmony_ci const WeakPtr<NG::WebPattern>& GetWebPattern() const 34223b3eb3cSopenharmony_ci { 34323b3eb3cSopenharmony_ci return webPattern_; 34423b3eb3cSopenharmony_ci } 34523b3eb3cSopenharmony_ci 34623b3eb3cSopenharmony_ci private: 34723b3eb3cSopenharmony_ci WeakPtr<JsAccessibilityManager> js_; 34823b3eb3cSopenharmony_ci uint32_t windowId_ = 0; 34923b3eb3cSopenharmony_ci WeakPtr<NG::WebPattern> webPattern_; 35023b3eb3cSopenharmony_ci }; 35123b3eb3cSopenharmony_ci#endif // WEB_SUPPORTED 35223b3eb3cSopenharmony_ci 35323b3eb3cSopenharmony_ci class ToastAccessibilityConfigObserver : public AccessibilityConfig::AccessibilityConfigObserver { 35423b3eb3cSopenharmony_ci public: 35523b3eb3cSopenharmony_ci ToastAccessibilityConfigObserver() = default; 35623b3eb3cSopenharmony_ci void OnConfigChanged( 35723b3eb3cSopenharmony_ci const AccessibilityConfig::CONFIG_ID id, const AccessibilityConfig::ConfigValue& value) override; 35823b3eb3cSopenharmony_ci }; 35923b3eb3cSopenharmony_ci 36023b3eb3cSopenharmony_ci class JsAccessibilityStateObserver : public Accessibility::AccessibilityStateObserver { 36123b3eb3cSopenharmony_ci public: 36223b3eb3cSopenharmony_ci void OnStateChanged(const bool state) override; 36323b3eb3cSopenharmony_ci void SetAccessibilityManager(const WeakPtr<JsAccessibilityManager>& accessibilityManager) 36423b3eb3cSopenharmony_ci { 36523b3eb3cSopenharmony_ci accessibilityManager_ = accessibilityManager; 36623b3eb3cSopenharmony_ci } 36723b3eb3cSopenharmony_ci 36823b3eb3cSopenharmony_ci void SetPipeline(const WeakPtr<PipelineBase>& pipeline) 36923b3eb3cSopenharmony_ci { 37023b3eb3cSopenharmony_ci pipeline_ = pipeline; 37123b3eb3cSopenharmony_ci } 37223b3eb3cSopenharmony_ci 37323b3eb3cSopenharmony_ci private: 37423b3eb3cSopenharmony_ci // Do not upgrade accessibilityManager_ on async thread, destructor might cause freeze 37523b3eb3cSopenharmony_ci WeakPtr<JsAccessibilityManager> accessibilityManager_; 37623b3eb3cSopenharmony_ci WeakPtr<PipelineBase> pipeline_; 37723b3eb3cSopenharmony_ci }; 37823b3eb3cSopenharmony_ci 37923b3eb3cSopenharmony_ci bool AccessibilityActionEvent(const Accessibility::ActionType& action, 38023b3eb3cSopenharmony_ci const std::map<std::string, std::string>& actionArguments, const RefPtr<AccessibilityNode>& node, 38123b3eb3cSopenharmony_ci const RefPtr<PipelineContext>& context); 38223b3eb3cSopenharmony_ci bool RequestAccessibilityFocus(const RefPtr<AccessibilityNode>& node); 38323b3eb3cSopenharmony_ci 38423b3eb3cSopenharmony_ci bool ClearAccessibilityFocus(const RefPtr<AccessibilityNode>& node); 38523b3eb3cSopenharmony_ci 38623b3eb3cSopenharmony_ci void AddFocusableNode(std::list<RefPtr<AccessibilityNode>>& nodeList, const RefPtr<AccessibilityNode>& node); 38723b3eb3cSopenharmony_ci bool CanAccessibilityFocused(const RefPtr<AccessibilityNode>& node); 38823b3eb3cSopenharmony_ci RefPtr<AccessibilityNode> FindNodeInRelativeDirection( 38923b3eb3cSopenharmony_ci const std::list<RefPtr<AccessibilityNode>>& nodeList, RefPtr<AccessibilityNode>& node, const int direction); 39023b3eb3cSopenharmony_ci RefPtr<AccessibilityNode> FindNodeInAbsoluteDirection( 39123b3eb3cSopenharmony_ci const std::list<RefPtr<AccessibilityNode>>& nodeList, RefPtr<AccessibilityNode>& node, const int direction); 39223b3eb3cSopenharmony_ci RefPtr<AccessibilityNode> GetNextFocusableNode( 39323b3eb3cSopenharmony_ci const std::list<RefPtr<AccessibilityNode>>& nodeList, RefPtr<AccessibilityNode>& node); 39423b3eb3cSopenharmony_ci RefPtr<AccessibilityNode> GetPreviousFocusableNode( 39523b3eb3cSopenharmony_ci const std::list<RefPtr<AccessibilityNode>>& nodeList, RefPtr<AccessibilityNode>& node); 39623b3eb3cSopenharmony_ci 39723b3eb3cSopenharmony_ci bool ExecuteActionNG(int64_t elementId, const std::map<std::string, std::string>& actionArguments, 39823b3eb3cSopenharmony_ci Accessibility::ActionType action, const RefPtr<PipelineBase>& context, int64_t uiExtensionOffset); 39923b3eb3cSopenharmony_ci bool ConvertActionTypeToBoolen(Accessibility::ActionType action, RefPtr<NG::FrameNode>& frameNode, 40023b3eb3cSopenharmony_ci int64_t elementId, RefPtr<NG::PipelineContext>& context); 40123b3eb3cSopenharmony_ci void SetSearchElementInfoByAccessibilityIdResult(Accessibility::AccessibilityElementOperatorCallback& callback, 40223b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>&& infos, const int32_t requestId); 40323b3eb3cSopenharmony_ci 40423b3eb3cSopenharmony_ci void SetSearchElementInfoByTextResult(Accessibility::AccessibilityElementOperatorCallback& callback, 40523b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>&& infos, const int32_t requestId); 40623b3eb3cSopenharmony_ci 40723b3eb3cSopenharmony_ci void SetFindFocusedElementInfoResult(Accessibility::AccessibilityElementOperatorCallback& callback, 40823b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& info, const int32_t requestId); 40923b3eb3cSopenharmony_ci 41023b3eb3cSopenharmony_ci void SetFocusMoveSearchResult(Accessibility::AccessibilityElementOperatorCallback& callback, 41123b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& info, const int32_t requestId); 41223b3eb3cSopenharmony_ci 41323b3eb3cSopenharmony_ci void SetExecuteActionResult( 41423b3eb3cSopenharmony_ci Accessibility::AccessibilityElementOperatorCallback& callback, const bool succeeded, const int32_t requestId); 41523b3eb3cSopenharmony_ci 41623b3eb3cSopenharmony_ci void SearchExtensionElementInfoByAccessibilityIdNG(const SearchParameter& searchParam, 41723b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, std::list<Accessibility::AccessibilityElementInfo>& infos, 41823b3eb3cSopenharmony_ci const RefPtr<PipelineBase>& context, const RefPtr<NG::PipelineContext>& ngPipeline); 41923b3eb3cSopenharmony_ci void SearchElementInfosByTextNG(const SearchParameter& searchParam, const RefPtr<NG::FrameNode>& node, 42023b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>& infos, const RefPtr<PipelineBase>& context, 42123b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& ngPipeline); 42223b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo> SearchElementInfosByTextNG( 42323b3eb3cSopenharmony_ci int64_t elementId, const std::string& text, const RefPtr<NG::FrameNode>& node, int64_t offset); 42423b3eb3cSopenharmony_ci void FindFocusedExtensionElementInfoNG(const SearchParameter& searchParam, 42523b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& info, const RefPtr<PipelineBase>& context, 42623b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& root); 42723b3eb3cSopenharmony_ci void FocusExtensionElementMoveSearchNG(const SearchParameter& searchParam, 42823b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& info, const RefPtr<PipelineBase>& context, 42923b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& root, RefPtr<NG::FrameNode>& outputExtensionNode); 43023b3eb3cSopenharmony_ci void TransferExecuteAction(int64_t elementId, RefPtr<NG::FrameNode>& node, 43123b3eb3cSopenharmony_ci const std::map<std::string, std::string>& actionArguments, 43223b3eb3cSopenharmony_ci Accessibility::ActionType& action, int64_t uiExtensionOffset); 43323b3eb3cSopenharmony_ci RefPtr<NG::FrameNode> FindNodeFromRootByExtensionId(const RefPtr<NG::FrameNode>& root, const int64_t uiExtensionId); 43423b3eb3cSopenharmony_ci bool RegisterThirdProviderInteractionOperationAsChildTree(const Registration& registration); 43523b3eb3cSopenharmony_ci 43623b3eb3cSopenharmony_ci void DumpProperty(const RefPtr<AccessibilityNode>& node); 43723b3eb3cSopenharmony_ci void DumpPropertyNG(int64_t nodeID); 43823b3eb3cSopenharmony_ci void DumpHoverTestNG(uint32_t windowId, int64_t nodeID, int32_t x, int32_t y, bool verbose); 43923b3eb3cSopenharmony_ci RefPtr<NG::PipelineContext> FindPipelineByElementId(const int64_t elementId, RefPtr<NG::FrameNode>& node); 44023b3eb3cSopenharmony_ci RefPtr<NG::FrameNode> FindNodeFromPipeline(const WeakPtr<PipelineBase>& context, const int64_t elementId); 44123b3eb3cSopenharmony_ci RefPtr<PipelineBase> GetPipelineByWindowId(const int32_t windowId); 44223b3eb3cSopenharmony_ci void ProcessParameters(Accessibility::ActionType op, const std::vector<std::string>& params, 44323b3eb3cSopenharmony_ci std::map<std::string, std::string>& paramsMap); 44423b3eb3cSopenharmony_ci 44523b3eb3cSopenharmony_ci RefPtr<NG::PipelineContext> GetPipelineByWindowId(uint32_t windowId); 44623b3eb3cSopenharmony_ci void DumpTreeNG(bool useWindowId, uint32_t windowId, int64_t rootId, bool isDumpSimplify = false); 44723b3eb3cSopenharmony_ci void DumpTreeNG(const RefPtr<NG::FrameNode>& parent, int32_t depth, 44823b3eb3cSopenharmony_ci int64_t nodeID, const CommonProperty& commonProperty, bool isDumpSimplify = false); 44923b3eb3cSopenharmony_ci void DumpTreeNodeSafeAreaInfoNg(const RefPtr<NG::FrameNode>& node); 45023b3eb3cSopenharmony_ci void DumpPadding(const std::unique_ptr<NG::PaddingProperty>& padding, std::string label); 45123b3eb3cSopenharmony_ci void DumpBorder(const std::unique_ptr<NG::BorderWidthProperty>& border, std::string label); 45223b3eb3cSopenharmony_ci void DumpTreeNodeCommonInfoNg(const RefPtr<NG::FrameNode>& node, const CommonProperty& commonProperty); 45323b3eb3cSopenharmony_ci void DumpTreeNodeSimplifyInfoNG( 45423b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, int32_t depth, const CommonProperty& commonProperty, int32_t childSize); 45523b3eb3cSopenharmony_ci void DumpTreeAccessibilityNodeNG(const RefPtr<NG::UINode>& uiNodeParent, 45623b3eb3cSopenharmony_ci int32_t depth, int64_t nodeID, const CommonProperty& commonProperty); 45723b3eb3cSopenharmony_ci bool CheckDumpInfoParams(const std::vector<std::string> ¶ms); 45823b3eb3cSopenharmony_ci bool CheckDumpHandleEventParams(const std::vector<std::string> ¶ms); 45923b3eb3cSopenharmony_ci void GenerateCommonProperty(const RefPtr<PipelineBase>& context, CommonProperty& output, 46023b3eb3cSopenharmony_ci const RefPtr<PipelineBase>& mainContext); 46123b3eb3cSopenharmony_ci 46223b3eb3cSopenharmony_ci void FindText(const RefPtr<NG::UINode>& node, std::list<Accessibility::AccessibilityElementInfo>& infos, 46323b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& context, 46423b3eb3cSopenharmony_ci const CommonProperty& commonProperty, const SearchParameter& searchParam); 46523b3eb3cSopenharmony_ci 46623b3eb3cSopenharmony_ci void FindTextByTextHint(const RefPtr<NG::UINode>& node, std::list<Accessibility::AccessibilityElementInfo>& infos, 46723b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& context, 46823b3eb3cSopenharmony_ci const CommonProperty& commonProperty, const SearchParameter& searchParam); 46923b3eb3cSopenharmony_ci 47023b3eb3cSopenharmony_ci void UpdateAccessibilityElementInfo( 47123b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, Accessibility::AccessibilityElementInfo& nodeInfo); 47223b3eb3cSopenharmony_ci 47323b3eb3cSopenharmony_ci void UpdateAccessibilityVisible( 47423b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, AccessibilityElementInfo& nodeInfo); 47523b3eb3cSopenharmony_ci 47623b3eb3cSopenharmony_ci void UpdateVirtualNodeInfo(std::list<Accessibility::AccessibilityElementInfo>& infos, 47723b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& nodeInfo, 47823b3eb3cSopenharmony_ci const RefPtr<NG::UINode>& uiVirtualNode, const CommonProperty& commonProperty, 47923b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& ngPipeline); 48023b3eb3cSopenharmony_ci 48123b3eb3cSopenharmony_ci void UpdateVirtualNodeChildAccessibilityElementInfo( 48223b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, const CommonProperty& commonProperty, 48323b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& nodeParentInfo, Accessibility::AccessibilityElementInfo& nodeInfo, 48423b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& ngPipeline); 48523b3eb3cSopenharmony_ci 48623b3eb3cSopenharmony_ci void UpdateVirtualNodeAccessibilityElementInfo( 48723b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& parent, const RefPtr<NG::FrameNode>& node, 48823b3eb3cSopenharmony_ci const CommonProperty& commonProperty, Accessibility::AccessibilityElementInfo& nodeInfo, 48923b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& ngPipeline); 49023b3eb3cSopenharmony_ci 49123b3eb3cSopenharmony_ci void UpdateAccessibilityElementInfo( 49223b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, const CommonProperty& commonProperty, 49323b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& nodeInfo, const RefPtr<NG::PipelineContext>& ngPipeline); 49423b3eb3cSopenharmony_ci 49523b3eb3cSopenharmony_ci void UpdateCacheInfoNG(std::list<Accessibility::AccessibilityElementInfo>& infos, const RefPtr<NG::FrameNode>& node, 49623b3eb3cSopenharmony_ci const CommonProperty& commonProperty, const RefPtr<NG::PipelineContext>& ngPipeline, 49723b3eb3cSopenharmony_ci const SearchParameter& searchParam); 49823b3eb3cSopenharmony_ci#ifdef WEB_SUPPORTED 49923b3eb3cSopenharmony_ci 50023b3eb3cSopenharmony_ci void UpdateWebAccessibilityElementInfo(const std::shared_ptr<NWeb::NWebAccessibilityNodeInfo>& node, 50123b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& nodeInfo, int32_t treeId); 50223b3eb3cSopenharmony_ci 50323b3eb3cSopenharmony_ci void UpdateWebAccessibilityElementInfo(const std::shared_ptr<NWeb::NWebAccessibilityNodeInfo>& node, 50423b3eb3cSopenharmony_ci const CommonProperty& commonProperty, Accessibility::AccessibilityElementInfo& nodeInfo, 50523b3eb3cSopenharmony_ci const RefPtr<NG::WebPattern>& webPattern); 50623b3eb3cSopenharmony_ci 50723b3eb3cSopenharmony_ci void UpdateWebCacheInfo(std::list<Accessibility::AccessibilityElementInfo>& infos, int64_t nodeId, 50823b3eb3cSopenharmony_ci const CommonProperty& commonProperty, const RefPtr<NG::PipelineContext>& ngPipeline, 50923b3eb3cSopenharmony_ci const SearchParameter& searchParam, const RefPtr<NG::WebPattern>& webPattern); 51023b3eb3cSopenharmony_ci#endif //WEB_SUPPORTED 51123b3eb3cSopenharmony_ci void NotifyChildTreeOnRegister(int32_t treeId); 51223b3eb3cSopenharmony_ci 51323b3eb3cSopenharmony_ci void NotifyChildTreeOnDeregister(); 51423b3eb3cSopenharmony_ci 51523b3eb3cSopenharmony_ci void SendUecOnTreeEvent(int64_t splitElementId); 51623b3eb3cSopenharmony_ci 51723b3eb3cSopenharmony_ci void NotifySetChildTreeIdAndWinId(int64_t elementId, const int32_t treeId, const int32_t childWindowId); 51823b3eb3cSopenharmony_ci 51923b3eb3cSopenharmony_ci bool CheckIsChildElement( 52023b3eb3cSopenharmony_ci int64_t &elementId, const std::vector<std::string>& params, std::vector<std::string>& info); 52123b3eb3cSopenharmony_ci 52223b3eb3cSopenharmony_ci bool NeedRegisterChildTree(uint32_t parentWindowId, int32_t parentTreeId, int64_t parentElementId); 52323b3eb3cSopenharmony_ci 52423b3eb3cSopenharmony_ci void FillEventInfoWithNode( 52523b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, 52623b3eb3cSopenharmony_ci Accessibility::AccessibilityEventInfo& eventInfo, 52723b3eb3cSopenharmony_ci const RefPtr<NG::PipelineContext>& context, 52823b3eb3cSopenharmony_ci int64_t elementId); 52923b3eb3cSopenharmony_ci 53023b3eb3cSopenharmony_ci void NotifyAccessibilitySAStateChange(bool state); 53123b3eb3cSopenharmony_ci void DumpTreeNodeInfoInJson( 53223b3eb3cSopenharmony_ci const RefPtr<NG::FrameNode>& node, int32_t depth, const CommonProperty& commonProperty, int32_t childSize); 53323b3eb3cSopenharmony_ci void CreateNodeInfoJson(const RefPtr<NG::FrameNode>& node, const CommonProperty& commonProperty, 53423b3eb3cSopenharmony_ci std::unique_ptr<JsonValue>& json, int32_t childSize); 53523b3eb3cSopenharmony_ci 53623b3eb3cSopenharmony_ci void SendEventToAccessibilityWithNodeInner(const AccessibilityEvent& accessibilityEvent, 53723b3eb3cSopenharmony_ci const RefPtr<AceType>& node, const RefPtr<PipelineBase>& context); 53823b3eb3cSopenharmony_ci void SendAccessibilityAsyncEventInner(const AccessibilityEvent& accessibilityEvent); 53923b3eb3cSopenharmony_ci int64_t GetDelayTimeBeforeSendEvent(const AccessibilityEvent& accessibilityEvent, const RefPtr<AceType>& node); 54023b3eb3cSopenharmony_ci void UpdateChildrenNodeInCache(std::list<AccessibilityElementInfo>& infos, 54123b3eb3cSopenharmony_ci const CommonProperty& commonProperty, const RefPtr<NG::PipelineContext>& ngPipeline, 54223b3eb3cSopenharmony_ci const SearchParameter& searchParam, std::list<RefPtr<NG::FrameNode>>& children); 54323b3eb3cSopenharmony_ci std::string callbackKey_; 54423b3eb3cSopenharmony_ci uint32_t windowId_ = 0; 54523b3eb3cSopenharmony_ci std::shared_ptr<JsAccessibilityStateObserver> stateObserver_ = nullptr; 54623b3eb3cSopenharmony_ci std::shared_ptr<ToastAccessibilityConfigObserver> toastObserver_ = nullptr; 54723b3eb3cSopenharmony_ci float scaleX_ = 1.0f; 54823b3eb3cSopenharmony_ci float scaleY_ = 1.0f; 54923b3eb3cSopenharmony_ci int64_t currentFocusNodeId_ = -1; 55023b3eb3cSopenharmony_ci 55123b3eb3cSopenharmony_ci int64_t lastElementId_ = -1; 55223b3eb3cSopenharmony_ci WeakPtr<NG::FrameNode> lastFrameNode_; 55323b3eb3cSopenharmony_ci NG::SizeF oldGeometrySize_; 55423b3eb3cSopenharmony_ci mutable std::mutex childTreeCallbackMapMutex_; 55523b3eb3cSopenharmony_ci std::unordered_map<int64_t, std::shared_ptr<AccessibilityChildTreeCallback>> childTreeCallbackMap_; 55623b3eb3cSopenharmony_ci mutable std::mutex componentSACallbackMutex_; 55723b3eb3cSopenharmony_ci std::unordered_map<int64_t, std::shared_ptr<AccessibilitySAObserverCallback>> componentSACallbackMap_; 55823b3eb3cSopenharmony_ci int64_t parentElementId_ = INVALID_PARENT_ID; 55923b3eb3cSopenharmony_ci uint32_t parentWindowId_ = 0; 56023b3eb3cSopenharmony_ci int32_t parentTreeId_ = 0; 56123b3eb3cSopenharmony_ci uint32_t parentWebWindowId_ = 0; 56223b3eb3cSopenharmony_ci std::function<void(int32_t&, int32_t&)> getParentRectHandler_; 56323b3eb3cSopenharmony_ci std::function<void(AccessibilityParentRectInfo&)> getParentRectHandlerNew_; 56423b3eb3cSopenharmony_ci bool isUseJson_ = false; 56523b3eb3cSopenharmony_ci}; 56623b3eb3cSopenharmony_ci 56723b3eb3cSopenharmony_ci} // namespace OHOS::Ace::Framework 56823b3eb3cSopenharmony_ci 56923b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_COMMON_ACCESSIBILITY_JS_ACCESSIBILITY_MANAGER_H 570