1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #include "core/components_ng/property/accessibility_property.h" 17 18 #include "core/accessibility/accessibility_constants.h" 19 #include "core/components_ng/base/frame_node.h" 20 #include "core/pipeline_ng/pipeline_context.h" 21 22 namespace OHOS::Ace::NG { SetAccessibilityGroupMultiThread()23void AccessibilityProperty::SetAccessibilityGroupMultiThread() 24 { 25 // no need send event when node is free 26 } 27 SetAccessibilityTextWithEventMultiThread()28void AccessibilityProperty::SetAccessibilityTextWithEventMultiThread() 29 { 30 // no need send event when node is free 31 } 32 SetAccessibilityDescriptionWithEventMultiThread()33void AccessibilityProperty::SetAccessibilityDescriptionWithEventMultiThread() 34 { 35 // no need send event when node is free 36 } 37 SetAccessibilityLevelMultiThread(const std::string & backupLevel)38void AccessibilityProperty::SetAccessibilityLevelMultiThread(const std::string& backupLevel) 39 { 40 // no need send event when node is free 41 } 42 NotifyComponentChangeEventMultiThread(AccessibilityEventType eventType)43void AccessibilityProperty::NotifyComponentChangeEventMultiThread(AccessibilityEventType eventType) 44 { 45 auto frameNode = host_.Upgrade(); 46 CHECK_NULL_VOID(frameNode); 47 frameNode->PostAfterAttachMainTreeTask([weak = WeakPtr(frameNode)]() { 48 if (AceApplicationInfo::GetInstance().IsAccessibilityEnabled()) { 49 auto frameNode = weak.Upgrade(); 50 CHECK_NULL_VOID(frameNode); 51 auto pipeline = frameNode->GetContext(); 52 CHECK_NULL_VOID(pipeline); 53 pipeline->AddAccessibilityCallbackEvent(AccessibilityCallbackEventId::ON_SEND_ELEMENT_INFO_CHANGE, 54 frameNode->GetAccessibilityId()); 55 } 56 }); 57 } 58 } // namespace OHOS::Ace::NG 59