• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_WEB_WEB_ACCESSIBILITY_NODE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_WEB_WEB_ACCESSIBILITY_NODE_H
18 #include "base/memory/referenced.h"
19 #include "base/web/webview/ohos_nweb/include/nweb_accessibility_node_info.h"
20 #include "core/components_ng/base/frame_node.h"
21 #include "core/components_ng/property/property.h"
22 
23 namespace OHOS::Ace::NG {
24 class ACE_EXPORT WebAccessibilityNode : public FrameNode {
DECLARE_ACE_TYPE(WebAccessibilityNode,FrameNode)25     DECLARE_ACE_TYPE(WebAccessibilityNode, FrameNode)
26 public:
27     WebAccessibilityNode(const RefPtr<FrameNode>& webNode)
28         : FrameNode(V2::WEB_CORE_TAG, 0, MakeRefPtr<Pattern>())
29     {
30         webNode_ = WeakPtr(webNode);
31         accessibilityNodeInfo_.pageId = webNode->GetPageId();
32         accessibilityNodeInfo_.selected = false;
33         accessibilityNodeInfo_.focused = false;
34         accessibilityNodeInfo_.heading = false;
35         accessibilityNodeInfo_.checked = false;
36         accessibilityNodeInfo_.editable = false;
37         accessibilityNodeInfo_.enabled = false;
38         accessibilityNodeInfo_.checkable = false;
39         accessibilityNodeInfo_.clickable = false;
40         accessibilityNodeInfo_.focusable = false;
41         accessibilityNodeInfo_.scrollable = false;
42         accessibilityNodeInfo_.password = false;
43         accessibilityNodeInfo_.visible = false;
44         accessibilityNodeInfo_.hinting = false;
45         accessibilityNodeInfo_.pluralLineSupported = false;
46         accessibilityNodeInfo_.popupSupported = false;
47         accessibilityNodeInfo_.contentInvalid = false;
48         accessibilityNodeInfo_.deletable = false;
49         accessibilityNodeInfo_.accessibilityFocus = false;
50     }
~WebAccessibilityNode()51     ~WebAccessibilityNode()
52     {
53         webNode_.Reset();
54     }
GetAccessibilityNodeInfo()55     NWeb::NWebAccessibilityNodeInfo& GetAccessibilityNodeInfo()
56     {
57         return accessibilityNodeInfo_;
58     }
GetWebNode()59     RefPtr<FrameNode> GetWebNode()
60     {
61         return webNode_.Upgrade();
62     }
63 
64 private:
65     NWeb::NWebAccessibilityNodeInfo accessibilityNodeInfo_;
66     WeakPtr<FrameNode> webNode_ = nullptr;
67 };
68 } // namespace OHOS::Ace::NG
69 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_WEB_WEB_ACCESSIBILITY_NODE_H