1 /*
2  * Copyright (c) 2021 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_BRIDGE_COMMON_DOM_DOM_PROXY_H
17 #define FOUNDATION_ACE_FRAMEWORKS_BRIDGE_COMMON_DOM_DOM_PROXY_H
18 
19 #include "frameworks/bridge/common/dom/dom_node.h"
20 
21 namespace OHOS::Ace::Framework {
22 
23 class DOMProxy : public DOMNode {
24     DECLARE_ACE_TYPE(DOMProxy, DOMNode);
25 
26 public:
DOMProxy(NodeId nodeId,const std::string & nodeName)27     DOMProxy(NodeId nodeId, const std::string& nodeName) : DOMNode(nodeId, nodeName) {}
28     ~DOMProxy() override = default;
29 
GetSpecializedComponent()30     RefPtr<Component> GetSpecializedComponent() override
31     {
32         return nullptr;
33     }
34 
CompositeComponents()35     void CompositeComponents() override {}
36 
37     void Mount(int32_t slot) override;
38     void SetShowAttr(const std::string& showValue) override;
39     void ConnectWith(const WeakPtr<DOMNode>& target);
40 
41     // proxy node does not need the following actions
SetAttr(const std::vector<std::pair<std::string,std::string>> & attrs)42     void SetAttr(const std::vector<std::pair<std::string, std::string>>& attrs) override {}
SetStyle(const std::vector<std::pair<std::string,std::string>> & styles)43     void SetStyle(const std::vector<std::pair<std::string, std::string>>& styles) override {}
AddEvent(int32_t pageId,const std::vector<std::string> & events)44     void AddEvent(int32_t pageId, const std::vector<std::string>& events) override {}
45     void UpdateStyleWithChildren() override;
46     void SetIsIgnored(bool ignore);
47 
48 private:
49     WeakPtr<DOMNode> targetNode_;
50 };
51 
52 } // namespace OHOS::Ace::Framework
53 
54 #endif // FOUNDATION_ACE_FRAMEWORKS_BRIDGE_COMMON_DOM_DOM_PROXY_H
55