• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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_BASE_VIEW_STACK_PROCESSOR_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_VIEW_STACK_PROCESSOR_H
18 
19 #include <memory>
20 #include <stack>
21 #include <unordered_map>
22 #include <vector>
23 
24 #include "base/memory/referenced.h"
25 #include "core/common/container.h"
26 #include "core/common/container_scope.h"
27 #include "core/components/common/properties/animation_option.h"
28 #include "core/components/common/properties/state_attributes.h"
29 #include "core/components_ng/base/frame_node.h"
30 #include "core/components_ng/base/ui_node.h"
31 #include "core/components_ng/event/state_style_manager.h"
32 #include "core/components_ng/layout/layout_property.h"
33 #include "core/gestures/gesture_processor.h"
34 #include "core/pipeline/base/render_context.h"
35 
36 #define ACE_UPDATE_LAYOUT_PROPERTY(target, name, value)                         \
37     do {                                                                        \
38         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \
39         ACE_UPDATE_NODE_LAYOUT_PROPERTY(target, name, value, frameNode);        \
40     } while (false)
41 #define ACE_UPDATE_NODE_LAYOUT_PROPERTY(target, name, value, frameNode)         \
42     do {                                                                        \
43         CHECK_NULL_VOID(frameNode);                                             \
44         auto cast##target = (frameNode)->GetLayoutPropertyPtr<target>();        \
45         if (cast##target) {                                                     \
46             cast##target->Update##name(value);                                  \
47         }                                                                       \
48     } while (false)
49 
50 #define ACE_GET_NODE_LAYOUT_PROPERTY(target, name, value, frameNode)            \
51     do {                                                                        \
52         auto cast##target = frameNode->GetLayoutPropertyPtr<target>();          \
53         if (cast##target) {                                                     \
54             value = cast##target->Get##name##Value();                           \
55         }                                                                       \
56     } while (false)
57 
58 #define ACE_GET_NODE_LAYOUT_PROPERTY_WITH_DEFAULT_VALUE(target, name, value, frameNode, defaultValue)   \
59     do {                                                                                                \
60         auto cast##target = frameNode->GetLayoutPropertyPtr<target>();                                  \
61         if (cast##target) {                                                                             \
62             value = cast##target->Get##name##Value(defaultValue);                                       \
63         }                                                                                               \
64     } while (false)
65 
66 #define ACE_UPDATE_PAINT_PROPERTY(target, name, value)                          \
67     do {                                                                        \
68         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \
69         ACE_UPDATE_NODE_PAINT_PROPERTY(target, name, value, frameNode);         \
70     } while (false)
71 #define ACE_UPDATE_NODE_PAINT_PROPERTY(target, name, value, frameNode)          \
72     do {                                                                        \
73         CHECK_NULL_VOID(frameNode);                                             \
74         auto cast##target = (frameNode)->GetPaintPropertyPtr<target>();         \
75         if (cast##target) {                                                     \
76             cast##target->Update##name(value);                                  \
77         }                                                                       \
78     } while (false)
79 
80 #define ACE_GET_NODE_PAINT_PROPERTY(target, name, value, frameNode)             \
81     do {                                                                        \
82         auto cast##target = frameNode->GetPaintPropertyPtr<target>();           \
83         if (cast##target) {                                                     \
84             value = cast##target->Get##name##Value();                           \
85         }                                                                       \
86     } while (false)
87 
88 #define ACE_GET_NODE_PAINT_PROPERTY_WITH_DEFAULT_VALUE(target, name, value, frameNode, defaultValue) \
89     do {                                                                                             \
90         auto cast##target = frameNode->GetPaintPropertyPtr<target>();                                \
91         if (cast##target) {                                                                          \
92             value = cast##target->Get##name##Value(defaultValue);                                    \
93         }                                                                                            \
94     } while (false)
95 
96 #define ACE_UPDATE_RENDER_CONTEXT(name, value)                                  \
97     do {                                                                        \
98         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \
99         ACE_UPDATE_NODE_RENDER_CONTEXT(name, value, frameNode);                 \
100     } while (false)
101 #define ACE_UPDATE_NODE_RENDER_CONTEXT(name, value, frameNode)                  \
102     do {                                                                        \
103         CHECK_NULL_VOID(frameNode);                                             \
104         const auto& target = (frameNode)->GetRenderContext();                   \
105         if (target) {                                                           \
106             target->Update##name(value);                                        \
107         }                                                                       \
108     } while (false)
109 
110 #define ACE_RESET_LAYOUT_PROPERTY(target, name)                                 \
111     do {                                                                        \
112         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \
113         ACE_RESET_NODE_LAYOUT_PROPERTY(target, name, frameNode);                \
114     } while (false)
115 #define ACE_RESET_NODE_LAYOUT_PROPERTY(target, name, frameNode)                 \
116     do {                                                                        \
117         CHECK_NULL_VOID(frameNode);                                             \
118         auto cast##target = frameNode->GetLayoutPropertyPtr<target>();          \
119         CHECK_NULL_VOID(cast##target);                                          \
120         cast##target->Reset##name();                                            \
121     } while (false)
122 
123 #define ACE_RESET_LAYOUT_PROPERTY_WITH_FLAG(target, name, changeFlag)                      \
124     do {                                                                                   \
125         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode();            \
126         ACE_RESET_NODE_LAYOUT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode);     \
127     } while (false)
128 #define ACE_RESET_NODE_LAYOUT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode)      \
129     do {                                                                                   \
130         CHECK_NULL_VOID(frameNode);                                                        \
131         auto cast##target = frameNode->GetLayoutPropertyPtr<target>();                     \
132         CHECK_NULL_VOID(cast##target);                                                     \
133         if (cast##target->Has##name()) {                                                   \
134             cast##target->Reset##name();                                                   \
135             cast##target->UpdatePropertyChangeFlag(changeFlag);                            \
136         }                                                                                  \
137     } while (false)
138 
139 #define ACE_RESET_PAINT_PROPERTY(target, name)                                  \
140     do {                                                                        \
141         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \
142         ACE_RESET_NODE_PAINT_PROPERTY(target, name, frameNode);                 \
143     } while (false)
144 #define ACE_RESET_NODE_PAINT_PROPERTY(target, name, frameNode)                  \
145     do {                                                                        \
146         CHECK_NULL_VOID(frameNode);                                             \
147         auto cast##target = frameNode->GetPaintPropertyPtr<target>();           \
148         CHECK_NULL_VOID(cast##target);                                          \
149         cast##target->Reset##name();                                            \
150     } while (false)
151 
152 #define ACE_RESET_PAINT_PROPERTY_WITH_FLAG(target, name, changeFlag)                      \
153     do {                                                                                  \
154         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode();           \
155         ACE_RESET_NODE_PAINT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode);     \
156     } while (false)
157 #define ACE_RESET_NODE_PAINT_PROPERTY_WITH_FLAG(target, name, changeFlag, frameNode)      \
158     do {                                                                                  \
159         CHECK_NULL_VOID(frameNode);                                                       \
160         auto cast##target = frameNode->GetPaintPropertyPtr<target>();                     \
161         CHECK_NULL_VOID(cast##target);                                                    \
162         cast##target->Reset##name();                                                      \
163         cast##target->UpdatePropertyChangeFlag(changeFlag);                               \
164     } while (false)
165 
166 #define ACE_RESET_RENDER_CONTEXT(target, name)                                  \
167     do {                                                                        \
168         auto frameNode = ViewStackProcessor::GetInstance()->GetMainFrameNode(); \
169         ACE_RESET_NODE_RENDER_CONTEXT(target, name, frameNode);                 \
170     } while (false)
171 #define ACE_RESET_NODE_RENDER_CONTEXT(target, name, frameNode)                  \
172     do {                                                                        \
173         CHECK_NULL_VOID(frameNode);                                             \
174         const auto& cast##target = (frameNode)->GetRenderContext();             \
175         CHECK_NULL_VOID(cast##target);                                          \
176         cast##target->Reset##name();                                            \
177     } while (false)
178 
179 namespace OHOS::Ace::NG {
180 using PrebuildFunc = std::function<void()>;
181 
182 enum class PrebuildCompCmdType {
183     FRONT = 0,
184     BACK,
185 };
186 
187 struct PrebuildCompCmd {
188     PrebuildCompCmdType commandType;
189     const char* commandName = "";
190     PrebuildFunc prebuildFunc;
191 
PrebuildCompCmdPrebuildCompCmd192     PrebuildCompCmd(PrebuildCompCmdType commandType) : commandType(commandType) {}
PrebuildCompCmdPrebuildCompCmd193     PrebuildCompCmd(PrebuildCompCmdType commandType, const char* commandName,
194         PrebuildFunc& prebuildFunc) : commandType(commandType), commandName(commandName), prebuildFunc(prebuildFunc) {}
195 };
196 
197 class ACE_EXPORT ViewStackProcessor final {
198 public:
199     friend class ScopedViewStackProcessor;
200 #ifdef ACE_STATIC
201     friend class InteropViewStackProcessor;
202 #endif
203 
204     ACE_FORCE_EXPORT static ViewStackProcessor* GetInstance();
205     ~ViewStackProcessor() = default;
206 
207     template<typename Pattern>
GetMainFrameNodePattern()208     RefPtr<Pattern> GetMainFrameNodePattern() const
209     {
210         auto frameNode = GetMainFrameNode();
211         if (!frameNode) {
212             return nullptr;
213         }
214         return AceType::DynamicCast<Pattern>(frameNode->GetPattern());
215     }
216 
217     template<typename Pattern>
GetMainFrameNodePattern(FrameNode * frameNode)218     RefPtr<Pattern> GetMainFrameNodePattern(FrameNode* frameNode) const
219     {
220         if (!frameNode) {
221             return nullptr;
222         }
223         return AceType::DynamicCast<Pattern>(frameNode->GetPattern());
224     }
225 
226     template<typename EventHubType>
GetMainFrameNodeEventHub()227     RefPtr<EventHubType> GetMainFrameNodeEventHub() const
228     {
229         auto frameNode = GetMainFrameNode();
230         if (!frameNode) {
231             return nullptr;
232         }
233         return frameNode->GetOrCreateEventHub<EventHubType>();
234     }
235 
GetMainFrameNodeGestureEventHub()236     RefPtr<GestureEventHub> GetMainFrameNodeGestureEventHub() const
237     {
238         auto frameNode = GetMainFrameNode();
239         if (!frameNode) {
240             return nullptr;
241         }
242         return frameNode->GetOrCreateGestureEventHub();
243     }
244 
GetMainFrameNodeInputEventHub()245     RefPtr<InputEventHub> GetMainFrameNodeInputEventHub() const
246     {
247         auto frameNode = GetMainFrameNode();
248         if (!frameNode) {
249             return nullptr;
250         }
251         return frameNode->GetOrCreateInputEventHub();
252     }
253 
GetOrCreateMainFrameNodeFocusHub()254     RefPtr<FocusHub> GetOrCreateMainFrameNodeFocusHub() const
255     {
256         auto frameNode = GetMainFrameNode();
257         if (!frameNode) {
258             return nullptr;
259         }
260         return frameNode->GetOrCreateFocusHub();
261     }
262 
GetMainFrameNodeFocusHub()263     RefPtr<FocusHub> GetMainFrameNodeFocusHub() const
264     {
265         auto frameNode = GetMainFrameNode();
266         if (!frameNode) {
267             return nullptr;
268         }
269         return frameNode->GetFocusHub();
270     }
271 
272     ACE_FORCE_EXPORT FrameNode* GetMainFrameNode() const;
273 
274    // Get main component include composed component created by js view.
275     const RefPtr<UINode>& GetMainElementNode() const;
276     void ApplyParentThemeScopeId(const RefPtr<UINode>& element);
277     // create wrappingComponentsMap and the component to map and then Push
278     // the map to the render component stack.
279     ACE_FORCE_EXPORT void Push(const RefPtr<UINode>& element, bool isCustomView = false);
280 #ifdef ACE_STATIC
281     ACE_FORCE_EXPORT void PushPtr(int64_t elementPtr);
282 #endif
283 
284     // Wrap the components map for the stack top and then pop the stack.
285     // Add the wrapped component has child of the new stack top's main component.
286     void Pop();
287 
288     // pop the last container
289     ACE_FORCE_EXPORT void PopContainer();
290 
291     // End of Render function, create component tree and flush modify task.
292     ACE_FORCE_EXPORT RefPtr<UINode> Finish();
293 
294     // Set key to be used for next node on the stack
295     void PushKey(const std::string& key);
296 
297     // Returns a key for the node if it has been pushed to the stack. Default is ""
298     std::string GetKey();
299 
300     // Takes care of the viewId wrt to foreach
301     std::string ProcessViewId(const std::string& viewId);
302 
303     // Clear the key pushed to the stack
304     void PopKey();
305 
306     // Check whether the current node is in the corresponding polymorphic style state.
307     // When the polymorphic style is not set on the front end, it returns true regardless of the current node state;
308     // When the polymorphic style is set on the front end, true is returned only if the current node state is the same
309     // as the polymorphic style.
310     bool IsCurrentVisualStateProcess();
311 
312     void SetVisualState(VisualState state);
313 
GetVisualState()314     std::optional<UIState> GetVisualState() const
315     {
316         return visualState_;
317     }
318 
IsVisualStateSet()319     bool IsVisualStateSet()
320     {
321         return visualState_.has_value();
322     }
323 
ClearVisualState()324     void ClearVisualState()
325     {
326         visualState_.reset();
327     }
328 
ClearStack()329     void ClearStack()
330     {
331         auto emptyStack = std::stack<RefPtr<UINode>>();
332         elementsStack_.swap(emptyStack);
333     }
334 
GetOrCreateGestureProcessor()335     RefPtr<GestureProcessor> GetOrCreateGestureProcessor()
336     {
337         if (!gestureStack_) {
338             gestureStack_ = AceType::MakeRefPtr<GestureProcessor>();
339         }
340         return gestureStack_;
341     }
342 
ResetGestureProcessor()343     void ResetGestureProcessor()
344     {
345         return gestureStack_.Reset();
346     }
347 
348     /**
349      * when nesting observeComponentCreation functions, such as in the case of
350      * If, and the if branch creates a Text etc that requires an implicit pop
351      * this function is needed after executing the inner observeComponentCreation
352      * and before read ViewStackProcessor.GetTopMostElementId(); on the outer one
353      */
354     void ImplicitPopBeforeContinue();
355 
356     // End of Rerender function, flush modifier task.
357     ACE_FORCE_EXPORT void FlushRerenderTask();
358 
359     /**
360      * start 'get' access recording
361      * account all get access to given node id
362      * next node creation will claim the given node id
363      * see ClaimNodeId()
364      */
StartGetAccessRecordingFor(int32_t elmtId)365     void StartGetAccessRecordingFor(int32_t elmtId)
366     {
367         accountGetAccessToNodeId_ = elmtId;
368         reservedNodeId_ = elmtId;
369         if (containerId_ != OHOS::Ace::INSTANCE_ID_UNDEFINED) {
370             restoreInstanceId_ = Container::CurrentId();
371             ContainerScope::UpdateCurrent(containerId_);
372         }
373     }
374 
ClaimNodeId()375     int32_t ClaimNodeId()
376     {
377         const auto result = reservedNodeId_;
378         reservedNodeId_ = ElementRegister::UndefinedElementId;
379         return result;
380     }
381 
SetRecycleNodeId(int32_t recycleNodeId)382     void SetRecycleNodeId(int32_t recycleNodeId)
383     {
384         recycleNodeId_ = recycleNodeId;
385     }
386 
GetRecycleNodeId()387     int32_t GetRecycleNodeId()
388     {
389         const auto result = recycleNodeId_;
390         recycleNodeId_ = ElementRegister::UndefinedElementId;
391         return result;
392     }
393 
394     /**
395      * get the elmtId to which all get access should be accounted
396      * ElementRegister::UndefinedElementId; means no get access recording enabled
397      */
GetNodeIdToAccountFor()398     ElementIdType GetNodeIdToAccountFor() const
399     {
400         return accountGetAccessToNodeId_;
401     }
SetNodeIdToAccountFor(ElementIdType elmtId)402     void SetNodeIdToAccountFor(ElementIdType elmtId)
403     {
404         accountGetAccessToNodeId_ = elmtId;
405     }
406 
407     /**
408      * inverse of StartGetAccessRecordingFor
409      */
StopGetAccessRecording()410     void StopGetAccessRecording()
411     {
412         if (restoreInstanceId_ != OHOS::Ace::INSTANCE_ID_UNDEFINED) {
413             ContainerScope::UpdateCurrent(restoreInstanceId_);
414             restoreInstanceId_ = OHOS::Ace::INSTANCE_ID_UNDEFINED;
415         }
416         accountGetAccessToNodeId_ = ElementRegister::UndefinedElementId;
417         reservedNodeId_ = ElementRegister::UndefinedElementId;
418     }
419 
420     void FlushImplicitAnimation();
421 
422     // used for knowing which page node to execute the pageTransitionFunc
SetPageNode(const RefPtr<FrameNode> & pageNode)423     void SetPageNode(const RefPtr<FrameNode>& pageNode)
424     {
425         currentPage_ = pageNode;
426     }
427 
GetPageNode()428     const RefPtr<FrameNode>& GetPageNode() const
429     {
430         return currentPage_;
431     }
432 
433     // Sets the implicit animation option. This is needed for 3D Model View.
434     void SetImplicitAnimationOption(const AnimationOption& option);
435 
436     // Returns implicit animation option.
437     const AnimationOption& GetImplicitAnimationOption() const;
438 
439     RefPtr<UINode> GetNewUINode();
440 
GetAndPushFrameNode(const std::string & tag,int32_t elmtId)441     void GetAndPushFrameNode(const std::string& tag, int32_t elmtId)
442     {
443         auto frameNode = FrameNode::GetFrameNode(tag, elmtId);
444         if (!frameNode) {
445             return;
446         }
447         Push(frameNode);
448     }
449 
CheckTopNodeFirstBuilding()450     bool CheckTopNodeFirstBuilding() const
451     {
452         auto node = GetMainFrameNode();
453         CHECK_NULL_RETURN(node, false);
454         return node->IsFirstBuilding();
455     }
456 
SetCustomTitleNode(const RefPtr<UINode> & customTitleNode)457     void SetCustomTitleNode(const RefPtr<UINode>& customTitleNode)
458     {
459         customTitleNode_ = customTitleNode;
460     }
461 
GetCustomTitleNode()462     const RefPtr<UINode> GetCustomTitleNode() const
463     {
464         return customTitleNode_;
465     }
466 
SetCustomWindowMaskNode(const RefPtr<UINode> & customWindowMaskNode)467     void SetCustomWindowMaskNode(const RefPtr<UINode>& customWindowMaskNode)
468     {
469         customWindowMaskNode_ = customWindowMaskNode;
470     }
471 
GetCustomWindowMaskNode()472     const RefPtr<UINode> GetCustomWindowMaskNode() const
473     {
474         return customWindowMaskNode_;
475     }
476 
SetCustomButtonNode(const RefPtr<UINode> & customButtonNode)477     void SetCustomButtonNode(const RefPtr<UINode>& customButtonNode)
478     {
479         customButtonNode_ = customButtonNode;
480     }
481 
GetCustomButtonNode()482     const RefPtr<UINode> GetCustomButtonNode() const
483     {
484         return customButtonNode_;
485     }
486 
SetCustomAppBarNode(const RefPtr<UINode> & customNode)487     void SetCustomAppBarNode(const RefPtr<UINode>& customNode)
488     {
489         customAppBarNode_ = customNode;
490     }
491 
GetCustomAppBarNode()492     const RefPtr<UINode> GetCustomAppBarNode() const
493     {
494         return customAppBarNode_;
495     }
496 
SetIsBuilderNode(bool isBuilderNode)497     void SetIsBuilderNode(bool isBuilderNode)
498     {
499         isBuilderNode_ = isBuilderNode;
500     }
501 
IsBuilderNode()502     bool IsBuilderNode() const
503     {
504         return isBuilderNode_;
505     }
506 
SetIsExportTexture(bool isExportTexture)507     void SetIsExportTexture(bool isExportTexture)
508     {
509         isExportTexture_ = isExportTexture;
510     }
511 
IsExportTexture()512     bool IsExportTexture() const
513     {
514         return isExportTexture_;
515     }
516 
SetRebuildContainerId(int32_t containerId)517     void SetRebuildContainerId(int32_t containerId)
518     {
519         containerId_ = containerId;
520     }
521 
IsEmpty()522     bool IsEmpty() const
523     {
524         return elementsStack_.empty();
525     }
526 
SetIsPrebuilding(bool isPrebuilding)527     void SetIsPrebuilding(bool isPrebuilding)
528     {
529         isPrebuilding_ = isPrebuilding;
530     }
531 
CheckIsPrebuildTimeout()532     bool CheckIsPrebuildTimeout()
533     {
534         if (!isPrebuildTimeout_) {
535             isPrebuildTimeout_ = prebuildDeadline_ > 0 && GetSysTimestamp() > prebuildDeadline_;
536         }
537         return isPrebuildTimeout_;
538     }
539 
IsPrebuilding()540     bool IsPrebuilding() const
541     {
542         return isPrebuilding_;
543     }
544 
GetPrebuildComponentCmds()545     std::queue<PrebuildCompCmd>& GetPrebuildComponentCmds()
546     {
547         return PrebuildCompCmds_;
548     }
549 
PushPrebuildCompCmd()550     void PushPrebuildCompCmd()
551     {
552         PrebuildCompCmds_.emplace(PrebuildCompCmdType::FRONT);
553     }
554 
PushPrebuildCompCmd(const char * commandName,PrebuildFunc prebuildFunc)555     void PushPrebuildCompCmd(const char* commandName, PrebuildFunc prebuildFunc)
556     {
557         PrebuildCompCmds_.emplace(PrebuildCompCmdType::BACK, commandName, prebuildFunc);
558     }
559 private:
560     ViewStackProcessor();
561 
562     bool ShouldPopImmediately();
563 
564     // Singleton instance
565     static thread_local std::unique_ptr<ViewStackProcessor> instance;
566 
567     // render component stack
568     std::stack<RefPtr<UINode>> elementsStack_;
569 
570     RefPtr<FrameNode> currentPage_;
571 
572     RefPtr<UINode> customTitleNode_;
573     RefPtr<UINode> customButtonNode_;
574     RefPtr<UINode> customAppBarNode_;
575     RefPtr<UINode> customWindowMaskNode_;
576 
577     RefPtr<GestureProcessor> gestureStack_;
578 
579     std::string viewKey_;
580     std::stack<size_t> keyStack_;
581 
582     std::stack<int32_t> parentIdStack_;
583 
584     std::optional<UIState> visualState_ = std::nullopt;
585     bool isBuilderNode_ = false;
586     bool isExportTexture_ = false;
587     bool isPrebuilding_ = false;
588     bool isPrebuildTimeout_ = false;
589     int64_t prebuildDeadline_ = 0;
590     std::queue<PrebuildCompCmd> PrebuildCompCmds_;
591     int32_t containerId_ = OHOS::Ace::INSTANCE_ID_UNDEFINED;
592     int32_t restoreInstanceId_ = OHOS::Ace::INSTANCE_ID_UNDEFINED;
593 
594     ElementIdType recycleNodeId_ = ElementRegister::UndefinedElementId;
595     // elmtId reserved for next component creation
596     ElementIdType reservedNodeId_ = ElementRegister::UndefinedElementId;
597 
598     // elmtId to account get access to
599     ElementIdType accountGetAccessToNodeId_ = ElementRegister::UndefinedElementId;
600 
601     AnimationOption implicitAnimationOption_;
602 
603     ACE_DISALLOW_COPY_AND_MOVE(ViewStackProcessor);
604 };
605 
606 class ACE_FORCE_EXPORT ScopedViewStackProcessor final {
607 public:
608     ScopedViewStackProcessor(int32_t containerId = OHOS::Ace::INSTANCE_ID_UNDEFINED);
609     ScopedViewStackProcessor(std::unique_ptr<ViewStackProcessor>& instance,
610         int32_t containerId = OHOS::Ace::INSTANCE_ID_UNDEFINED);
611     ~ScopedViewStackProcessor();
612     void SwapViewStackProcessor(std::unique_ptr<ViewStackProcessor>& instance);
613 
614 private:
615     void Init(int32_t containerId);
616     std::unique_ptr<ViewStackProcessor> instance_;
617 
618     ACE_DISALLOW_COPY_AND_MOVE(ScopedViewStackProcessor);
619 };
620 
621 #ifdef ACE_STATIC
622 class InteropViewStackProcessor;
623 #endif
624 } // namespace OHOS::Ace::NG
625 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_VIEW_STACK_PROCESSOR_H
626