• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_FRAME_NODE_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_FRAME_NODE_H
18 
19 #include <functional>
20 #include <list>
21 #include <utility>
22 #include <mutex>
23 
24 #include "base/geometry/ng/offset_t.h"
25 #include "base/geometry/ng/point_t.h"
26 #include "base/geometry/ng/rect_t.h"
27 #include "base/geometry/ng/vector.h"
28 #include "base/memory/ace_type.h"
29 #include "base/memory/referenced.h"
30 #include "base/thread/cancelable_callback.h"
31 #include "base/thread/task_executor.h"
32 #include "base/utils/macros.h"
33 #include "base/utils/utils.h"
34 #include "core/accessibility/accessibility_utils.h"
35 #include "core/common/recorder/exposure_processor.h"
36 #include "core/common/resource/resource_configuration.h"
37 #include "core/components/common/layout/constants.h"
38 #include "core/components_ng/base/extension_handler.h"
39 #include "core/components_ng/base/frame_scene_status.h"
40 #include "core/components_ng/base/geometry_node.h"
41 #include "core/components_ng/base/modifier.h"
42 #include "core/components_ng/base/ui_node.h"
43 #include "core/components_ng/event/event_hub.h"
44 #include "core/components_ng/event/focus_hub.h"
45 #include "core/components_ng/event/gesture_event_hub.h"
46 #include "core/components_ng/event/input_event_hub.h"
47 #include "core/components_ng/event/target_component.h"
48 #include "core/components_ng/layout/layout_property.h"
49 #include "core/components_ng/base/lazy_compose_adapter.h"
50 #include "core/components_ng/property/accessibility_property.h"
51 #include "core/components_ng/property/flex_property.h"
52 #include "core/components_ng/property/layout_constraint.h"
53 #include "core/components_ng/property/property.h"
54 #include "core/components_ng/render/paint_property.h"
55 #include "core/components_ng/render/paint_wrapper.h"
56 #include "core/components_ng/render/render_context.h"
57 #include "core/components_v2/inspector/inspector_constants.h"
58 #include "core/components_v2/inspector/inspector_node.h"
59 
60 #include "interfaces/inner_api/ace_kit/include/ui/view/ai_caller_helper.h"
61 
62 namespace OHOS::Accessibility {
63 class AccessibilityElementInfo;
64 class AccessibilityEventInfo;
65 } // namespace OHOS::Accessibility
66 
67 namespace OHOS::Ace::Kit {
68 class FrameNode;
69 }
70 
71 namespace OHOS::Ace::NG {
72 class InspectorFilter;
73 class PipelineContext;
74 class Pattern;
75 class StateModifyTask;
76 class UITask;
77 struct DirtySwapConfig;
78 class DragDropRelatedConfigurations;
79 
80 struct CacheVisibleRectResult {
81     OffsetF windowOffset = OffsetF();
82     OffsetF innerWindowOffset = OffsetF();
83     RectF visibleRect = RectF();
84     RectF innerVisibleRect = RectF();
85     VectorF cumulativeScale = {1.0f, 1.0f};
86     VectorF innerCumulativeScale = {1.0f, 1.0f};
87     RectF frameRect = RectF();
88     RectF innerFrameRect = RectF();
89     RectF innerBoundaryRect = RectF();
90 };
91 
92 struct CacheMatrixInfo {
93     Matrix4 revertMatrix = Matrix4::CreateIdentity();
94     Matrix4 localMatrix = Matrix4::CreateIdentity();
95     RectF paintRectWithTransform;
96 };
97 
98 enum {
99     RET_FAILED = 11,
100     RET_SUCCESS = 10,
101 };
102 
103 // FrameNode will display rendering region in the screen.
104 class ACE_FORCE_EXPORT FrameNode : public UINode, public LayoutWrapper {
105     DECLARE_ACE_TYPE(FrameNode, UINode, LayoutWrapper);
106 
107 private:
108     class FrameProxy;
109 
110 public:
111     // create a new child element with new element tree.
112     static RefPtr<FrameNode> CreateFrameNodeWithTree(
113         const std::string& tag, int32_t nodeId, const RefPtr<Pattern>& pattern);
114 
115     static RefPtr<FrameNode> GetOrCreateFrameNode(
116         const std::string& tag, int32_t nodeId, const std::function<RefPtr<Pattern>(void)>& patternCreator);
117 
118     static RefPtr<FrameNode> GetOrCreateCommonNode(const std::string& tag, int32_t nodeId, bool isLayoutNode,
119         const std::function<RefPtr<Pattern>(void)>& patternCreator);
120 
121     // create a new element with new pattern.
122     static RefPtr<FrameNode> CreateFrameNode(
123         const std::string& tag, int32_t nodeId, const RefPtr<Pattern>& pattern, bool isRoot = false);
124 
125     static RefPtr<FrameNode> CreateCommonNode(const std::string& tag, int32_t nodeId, bool isLayoutNode,
126         const RefPtr<Pattern>& pattern, bool isRoot = false);
127 
128     // get element with nodeId from node map.
129     static RefPtr<FrameNode> GetFrameNode(const std::string& tag, int32_t nodeId);
130 
131     static RefPtr<FrameNode> GetFrameNodeOnly(const std::string& tag, int32_t nodeId);
132 
133     static void ProcessOffscreenNode(const RefPtr<FrameNode>& node, bool needRemainActive = false);
134     // avoid use creator function, use CreateFrameNode
135 
136     FrameNode(const std::string& tag, int32_t nodeId, const RefPtr<Pattern>& pattern,
137         bool isRoot = false, bool isLayoutNode = false);
138 
139     ~FrameNode() override;
140 
141     void OnDelete() override;
142 
FrameCount()143     int32_t FrameCount() const override
144     {
145         return 1;
146     }
147 
CurrentFrameCount()148     int32_t CurrentFrameCount() const override
149     {
150         return 1;
151     }
152 
SetCheckboxFlag(const bool checkboxFlag)153     void SetCheckboxFlag(const bool checkboxFlag)
154     {
155         checkboxFlag_ = checkboxFlag;
156     }
157 
SetBindTips(bool hasBindTips)158     void SetBindTips(bool hasBindTips)
159     {
160         hasBindTips_ = hasBindTips;
161     }
162 
GetCheckboxFlag()163     bool GetCheckboxFlag() const
164     {
165         return checkboxFlag_;
166     }
167 
SetDisallowDropForcedly(bool isDisallowDropForcedly)168     void SetDisallowDropForcedly(bool isDisallowDropForcedly)
169     {
170         isDisallowDropForcedly_ = isDisallowDropForcedly;
171     }
172 
GetDisallowDropForcedly()173     bool GetDisallowDropForcedly() const
174     {
175         return isDisallowDropForcedly_;
176     }
177 
178     void OnInspectorIdUpdate(const std::string& id) override;
179 
180     void OnAutoEventParamUpdate(const std::string& value) override;
181 
182     void UpdateGeometryTransition() override;
183 
184     struct ZIndexComparator {
operatorZIndexComparator185         bool operator()(const WeakPtr<FrameNode>& weakLeft, const WeakPtr<FrameNode>& weakRight) const
186         {
187             auto left = weakLeft.Upgrade();
188             auto right = weakRight.Upgrade();
189             if (left && right) {
190                 return left->GetRenderContext()->GetZIndexValue(ZINDEX_DEFAULT_VALUE) <
191                        right->GetRenderContext()->GetZIndexValue(ZINDEX_DEFAULT_VALUE);
192             }
193             return false;
194         }
195     };
196 
GetFrameChildren()197     const std::multiset<WeakPtr<FrameNode>, ZIndexComparator>& GetFrameChildren() const
198     {
199         return frameChildren_;
200     }
201 
202     void InitializePatternAndContext();
203 
204     virtual void MarkModifyDone();
205 
206     void MarkDirtyNode(PropertyChangeFlag extraFlag = PROPERTY_UPDATE_NORMAL) override;
207 
208     void ProcessFreezeNode();
209 
210     void OnFreezeStateChange() override;
211 
ProcessPropertyDiff()212     void ProcessPropertyDiff()
213     {
214         if (isPropertyDiffMarked_) {
215             MarkModifyDone();
216             MarkDirtyNode();
217             isPropertyDiffMarked_ = false;
218         }
219     }
220 
221     void FlushUpdateAndMarkDirty() override;
222 
223     void MarkNeedFrameFlushDirty(PropertyChangeFlag extraFlag = PROPERTY_UPDATE_NORMAL) override
224     {
225         MarkDirtyNode(extraFlag);
226     }
227 
228     [[deprecated]] void OnMountToParentDone();
229 
230     void AfterMountToParent() override;
231 
232     bool GetIsLayoutNode();
233 
234     bool GetIsFind();
235 
236     void SetIsFind(bool isFind);
237 
238     void GetOneDepthVisibleFrame(std::list<RefPtr<FrameNode>>& children);
239 
240     void GetOneDepthVisibleFrameWithOffset(std::list<RefPtr<FrameNode>>& children, OffsetF& offset);
241 
242     void UpdateLayoutConstraint(const MeasureProperty& calcLayoutConstraint);
243 
244     RefPtr<LayoutWrapperNode> CreateLayoutWrapper(bool forceMeasure = false, bool forceLayout = false) override;
245 
246     RefPtr<LayoutWrapperNode> UpdateLayoutWrapper(
247         RefPtr<LayoutWrapperNode> layoutWrapper, bool forceMeasure = false, bool forceLayout = false);
248 
249     void CreateLayoutTask(bool forceUseMainThread = false, LayoutType layoutTaskType = LayoutType::NONE);
250 
251     std::optional<UITask> CreateRenderTask(bool forceUseMainThread = false);
252 
253     void SwapDirtyLayoutWrapperOnMainThread(const RefPtr<LayoutWrapper>& dirty);
254 
255     // Clear the user callback.
256     void ClearUserOnAreaChange();
257 
258     void SetOnAreaChangeCallback(OnAreaChangedFunc&& callback);
259 
260     void TriggerOnAreaChangeCallback(uint64_t nanoTimestamp, int32_t areaChangeMinDepth = -1);
261 
262     void OnConfigurationUpdate(const ConfigurationChange& configurationChange) override;
263 
SetVisibleAreaUserCallback(const std::vector<double> & ratios,const VisibleCallbackInfo & callback)264     void SetVisibleAreaUserCallback(const std::vector<double>& ratios, const VisibleCallbackInfo& callback)
265     {
266         CreateEventHubInner();
267         CHECK_NULL_VOID(eventHub_);
268         eventHub_->SetVisibleAreaRatiosAndCallback(callback, ratios, true);
269     }
270 
271     void CleanVisibleAreaUserCallback(bool isApproximate = false);
272 
273     void SetVisibleAreaInnerCallback(const std::vector<double>& ratios, const VisibleCallbackInfo& callback,
274         bool isCalculateInnerClip = false)
275     {
276         isCalculateInnerVisibleRectClip_ = isCalculateInnerClip;
277         CreateEventHubInner();
278         CHECK_NULL_VOID(eventHub_);
279         eventHub_->SetVisibleAreaRatiosAndCallback(callback, ratios, false);
280     }
281 
282     void SetIsCalculateInnerVisibleRectClip(bool isCalculateInnerClip = true)
283     {
284         isCalculateInnerVisibleRectClip_ = isCalculateInnerClip;
285     }
286 
287     void SetIsCalculateInnerClip(bool isCalculateInnerClip = false)
288     {
289         isCalculateInnerVisibleRectClip_ = isCalculateInnerClip;
290     }
291 
CleanVisibleAreaInnerCallback()292     void CleanVisibleAreaInnerCallback()
293     {
294         CHECK_NULL_VOID(eventHub_);
295         eventHub_->CleanVisibleAreaCallback(false);
296     }
297 
298     void TriggerVisibleAreaChangeCallback(
299         uint64_t timestamp, bool forceDisappear = false, int32_t isVisibleChangeMinDepth = -1);
300 
301     void SetOnSizeChangeCallback(OnSizeChangedFunc&& callback);
302 
303     void AddInnerOnSizeChangeCallback(int32_t id, OnSizeChangedFunc&& callback);
304 
305     void SetJSFrameNodeOnSizeChangeCallback(OnSizeChangedFunc&& callback);
306 
307     void TriggerOnSizeChangeCallback();
308 
309     void SetGeometryNode(const RefPtr<GeometryNode>& node);
310 
311     void SetNodeFreeze(bool isFreeze);
312 
GetRenderContext()313     const RefPtr<RenderContext>& GetRenderContext() const
314     {
315         return renderContext_;
316     }
317 
318     const RefPtr<Pattern>& GetPattern() const;
319 
320     template<typename T>
GetPatternPtr()321     T* GetPatternPtr() const
322     {
323         if (ACE_UNLIKELY(pattern_ &&
324             SystemProperties::DetectAceObjTypeConvertion() &&
325             !DynamicCast<T>(pattern_))) {
326             LOGF_ABORT("bad type conversion: from [%{public}s] to [%{public}s]",
327                 GetPatternTypeName(), T::TypeName());
328         }
329         return reinterpret_cast<T*>(RawPtr(pattern_));
330     }
331 
332     template<typename T>
GetPattern()333     RefPtr<T> GetPattern() const
334     {
335         return DynamicCast<T>(pattern_);
336     }
337 
338     template<typename T>
GetAccessibilityProperty()339     RefPtr<T> GetAccessibilityProperty() const
340     {
341         return DynamicCast<T>(accessibilityProperty_);
342     }
343 
344     template<typename T>
GetLayoutPropertyPtr()345     T* GetLayoutPropertyPtr() const
346     {
347         if (ACE_UNLIKELY(layoutProperty_ &&
348             SystemProperties::DetectAceObjTypeConvertion() &&
349             !DynamicCast<T>(layoutProperty_))) {
350             LOGF_ABORT("bad type conversion: from [%{public}s] to [%{public}s]",
351                 GetLayoutPropertyTypeName(), T::TypeName());
352         }
353         return reinterpret_cast<T*>(RawPtr(layoutProperty_));
354     }
355 
356     template<typename T>
GetLayoutProperty()357     RefPtr<T> GetLayoutProperty() const
358     {
359         return DynamicCast<T>(layoutProperty_);
360     }
361 
362     template<typename T>
GetPaintPropertyPtr()363     T* GetPaintPropertyPtr() const
364     {
365         if (ACE_UNLIKELY(paintProperty_ &&
366             SystemProperties::DetectAceObjTypeConvertion() &&
367             !DynamicCast<T>(paintProperty_))) {
368             LOGF_ABORT("bad type conversion: from [%{public}s] to [%{public}s]",
369                 GetPaintPropertyTypeName(), T::TypeName());
370         }
371         return reinterpret_cast<T*>(RawPtr(paintProperty_));
372     }
373 
374     template<typename T>
GetPaintProperty()375     RefPtr<T> GetPaintProperty() const
376     {
377         return DynamicCast<T>(paintProperty_);
378     }
379 
380     template<typename T>
GetEventHub()381     RefPtr<T> GetEventHub()
382     {
383         return DynamicCast<T>(eventHub_);
384     }
385 
386     template<typename T>
GetOrCreateEventHub()387     RefPtr<T> GetOrCreateEventHub()
388     {
389         CreateEventHubInner();
390         CHECK_NULL_RETURN(eventHub_, nullptr);
391         return DynamicCast<T>(eventHub_);
392     }
393 
GetOrCreateGestureEventHub()394     RefPtr<GestureEventHub> GetOrCreateGestureEventHub()
395     {
396         CreateEventHubInner();
397         CHECK_NULL_RETURN(eventHub_, nullptr);
398         return eventHub_->GetOrCreateGestureEventHub();
399     }
400 
GetOrCreateInputEventHub()401     RefPtr<InputEventHub> GetOrCreateInputEventHub()
402     {
403         CreateEventHubInner();
404         return eventHub_->GetOrCreateInputEventHub();
405     }
406 
407     RefPtr<FocusHub> GetOrCreateFocusHub();
408     const RefPtr<FocusHub>& GetOrCreateFocusHub(FocusType type, bool focusable, FocusStyleType focusStyleType,
409         const std::unique_ptr<FocusPaintParam>& paintParamsPtr);
410     const RefPtr<FocusHub>& GetOrCreateFocusHub(const FocusPattern& focusPattern);
411 
412     const RefPtr<DragDropRelatedConfigurations>& GetOrCreateDragDropRelatedConfigurations();
413 
414     void CreateEventHubInner();
415 
GetFocusHub()416     const RefPtr<FocusHub>& GetFocusHub() const
417     {
418         return focusHub_;
419     }
420 
HasVirtualNodeAccessibilityProperty()421     bool HasVirtualNodeAccessibilityProperty() override
422     {
423         if (accessibilityProperty_ && accessibilityProperty_->GetAccessibilityVirtualNode()) {
424             return true;
425         }
426         return false;
427     }
428 
GetFocusType()429     FocusType GetFocusType() const
430     {
431         FocusType type = FocusType::DISABLE;
432         auto focusHub = GetFocusHub();
433         if (focusHub) {
434             type = focusHub->GetFocusType();
435         }
436         return type;
437     }
438 
439     void PostIdleTask(std::function<void(int64_t deadline, bool canUseLongPredictTask)>&& task);
440 
441     void AddJudgeToTargetComponent(RefPtr<TargetComponent>& targetComponent);
442 
443     // If return true, will prevent TouchTest Bubbling to parent and brother nodes.
444     HitTestResult TouchTest(const PointF& globalPoint, const PointF& parentLocalPoint, const PointF& parentRevertPoint,
445         TouchRestrict& touchRestrict, TouchTestResult& result, int32_t touchId, ResponseLinkResult& responseLinkResult,
446         bool isDispatch = false) override;
447 
448     HitTestResult MouseTest(const PointF& globalPoint, const PointF& parentLocalPoint, MouseTestResult& onMouseResult,
449         MouseTestResult& onHoverResult, RefPtr<FrameNode>& hoverNode) override;
450 
451     HitTestResult AxisTest(const PointF &globalPoint, const PointF &parentLocalPoint, const PointF &parentRevertPoint,
452         TouchRestrict &touchRestrict, AxisTestResult &axisResult) override;
453     ACE_NON_VIRTUAL void CollectSelfAxisResult(const PointF& globalPoint, const PointF& localPoint, bool& consumed,
454         const PointF& parentRevertPoint, AxisTestResult& axisResult, bool& preventBubbling, HitTestResult& testResult,
455         TouchRestrict& touchRestrict, bool blockHierarchy);
456     void HitTestChildren(const PointF& globalPoint, const PointF& localPoint, const PointF& subRevertPoint,
457         TouchRestrict& touchRestrict, AxisTestResult& newComingTargets, bool& preventBubbling, bool& consumed,
458         bool& blockHierarchy);
459 
460     void AnimateHoverEffect(bool isHovered) const;
461 
462     bool IsAtomicNode() const override;
463 
464     void MarkNeedSyncRenderTree(bool needRebuild = false) override;
465 
466     void RebuildRenderContextTree() override;
467 
468     bool IsContextTransparent() override;
469 
IsTrimMemRecycle()470     bool IsTrimMemRecycle() const
471     {
472         return isTrimMemRecycle_;
473     }
474 
SetTrimMemRecycle(bool isTrimMemRecycle)475     void SetTrimMemRecycle(bool isTrimMemRecycle)
476     {
477         isTrimMemRecycle_ = isTrimMemRecycle;
478     }
479 
IsVisible()480     bool IsVisible() const
481     {
482         return layoutProperty_->GetVisibility().value_or(VisibleType::VISIBLE) == VisibleType::VISIBLE;
483     }
484 
IsPrivacySensitive()485     bool IsPrivacySensitive() const
486     {
487         return isPrivacySensitive_;
488     }
489 
SetPrivacySensitive(bool flag)490     void SetPrivacySensitive(bool flag)
491     {
492         isPrivacySensitive_ = flag;
493     }
494 
495     void ChangeSensitiveStyle(bool isSensitive);
496 
497     bool IsJsCustomPropertyUpdated() const;
498 
499     void ToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const override;
500 
501     void ToTreeJson(std::unique_ptr<JsonValue>& json, const InspectorConfig& config) const override;
502 
503     void FromJson(const std::unique_ptr<JsonValue>& json) override;
504 
505     RefPtr<FrameNode> GetAncestorNodeOfFrame(bool checkBoundary) const;
506 
GetNodeName()507     std::string& GetNodeName()
508     {
509         return nodeName_;
510     }
511 
SetNodeName(std::string & nodeName)512     void SetNodeName(std::string& nodeName)
513     {
514         nodeName_ = nodeName;
515     }
516 
517     void OnWindowShow() override;
518 
519     void OnWindowHide() override;
520 
521     void OnWindowFocused() override;
522 
523     void OnWindowUnfocused() override;
524 
525     void OnWindowActivated() override;
526 
527     void OnWindowDeactivated() override;
528 
529     void OnWindowSizeChanged(int32_t width, int32_t height, WindowSizeChangeReason type) override;
530 
531     void OnNotifyMemoryLevel(int32_t level) override;
532 
533     // call by recycle framework.
534     void OnRecycle() override;
535     void OnReuse() override;
536 
537     void NotifyColorModeChange(uint32_t colorMode) override;
538 
539     OffsetF GetOffsetRelativeToWindow() const;
540 
541     OffsetF GetPositionToScreen();
542 
543     OffsetF GetGlobalPositionOnDisplay() const;
544 
545     OffsetF GetFinalOffsetRelativeToWindow(PipelineContext* pipelineContext) const;
546 
547     OffsetF GetPositionToParentWithTransform() const;
548 
549     OffsetF GetPositionToScreenWithTransform();
550 
551     OffsetF GetPositionToWindowWithTransform(bool fromBottom = false) const;
552 
553     OffsetF GetTransformRelativeOffset() const;
554 
555     VectorF GetTransformScaleRelativeToWindow() const;
556 
557     RectF GetTransformRectRelativeToWindow(bool checkBoundary = false) const;
558 
559     // deprecated, please use GetPaintRectOffsetNG.
560     // this function only consider transform of itself when calculate transform,
561     // do not consider the transform of its ansestors
562     // checkScreen takes effect only when checkBoundary is false.
563     OffsetF GetPaintRectOffset(bool excludeSelf = false, bool checkBoundary = false, bool checkScreen = false) const;
564 
565     // returns a node's offset relative to root.
566     // and accumulate every ancestor node's graphic properties such as rotate and transform
567     // @param excludeSelf default false, set true can exclude self.
568     // @param checkBoundary default false. should be true if you want check boundary of window scene
569     // for getting the offset to window.
570     OffsetF GetPaintRectOffsetNG(bool excludeSelf = false, bool checkBoundary = false) const;
571 
572     bool GetRectPointToParentWithTransform(std::vector<Point>& pointList, const RefPtr<FrameNode>& parent) const;
573 
574     RectF GetPaintRectToWindowWithTransform();
575 
576     std::pair<OffsetF, bool> GetPaintRectGlobalOffsetWithTranslate(
577         bool excludeSelf = false, bool checkBoundary = false) const;
578 
579     OffsetF GetPaintRectOffsetToPage() const;
580 
581     RectF GetPaintRectWithTransform() const;
582 
583     VectorF GetTransformScale() const;
584 
585     void AdjustGridOffset();
586 
IsInternal()587     bool IsInternal() const
588     {
589         return isInternal_;
590     }
591 
SetInternal()592     void SetInternal()
593     {
594         isInternal_ = true;
595     }
596 
597     int32_t GetAllDepthChildrenCount();
598 
599     void OnAccessibilityEvent(
600         AccessibilityEventType eventType, WindowsContentChangeTypes windowsContentChangeType =
601                                               WindowsContentChangeTypes::CONTENT_CHANGE_TYPE_INVALID) const;
602 
603     void OnAccessibilityEventForVirtualNode(AccessibilityEventType eventType, int64_t accessibilityId);
604 
605     void OnAccessibilityEvent(
606         AccessibilityEventType eventType, int32_t startIndex, int32_t endIndex);
607 
608     void OnAccessibilityEvent(
609         AccessibilityEventType eventType, const std::string& beforeText, const std::string& latestContent);
610 
611     void OnAccessibilityEvent(
612         AccessibilityEventType eventType, int64_t stackNodeId, WindowsContentChangeTypes windowsContentChangeType);
613 
614     void OnAccessibilityEvent(
615         AccessibilityEventType eventType, const std::string& textAnnouncedForAccessibility);
616     void MarkNeedRenderOnly();
617 
618     void OnDetachFromMainTree(bool recursive, PipelineContext* context) override;
619     void OnAttachToMainTree(bool recursive) override;
620     void OnAttachToBuilderNode(NodeStatus nodeStatus) override;
621     bool RenderCustomChild(int64_t deadline) override;
622     void TryVisibleChangeOnDescendant(VisibleType preVisibility, VisibleType currentVisibility) override;
623     void NotifyVisibleChange(VisibleType preVisibility, VisibleType currentVisibility);
624 
PushDestroyCallbackWithTag(std::function<void ()> && callback,std::string tag)625     void PushDestroyCallbackWithTag(std::function<void()>&& callback, std::string tag)
626     {
627         destroyCallbacksMap_[tag] = callback;
628     }
629 
SetConfigurationModeUpdateCallback(const std::function<void (const ConfigurationChange & configurationChange)> && callback)630     void SetConfigurationModeUpdateCallback(
631         const std::function<void(const ConfigurationChange& configurationChange)>&& callback)
632     {
633         configurationUpdateCallback_ = callback;
634     }
635 
SetColorModeUpdateCallback(const std::function<void ()> && callback)636     void SetColorModeUpdateCallback(const std::function<void()>&& callback)
637     {
638         colorModeUpdateCallback_ = callback;
639     }
640 
641     void SetNDKColorModeUpdateCallback(const std::function<void(int32_t)>&& callback);
642 
SetNDKFontUpdateCallback(const std::function<void (float,float)> && callback)643     void SetNDKFontUpdateCallback(const std::function<void(float, float)>&& callback)
644     {
645         std::unique_lock<std::shared_mutex> lock(fontSizeCallbackMutex_);
646         ndkFontUpdateCallback_ = callback;
647     }
648 
649     void FireColorNDKCallback();
650     void FireFontNDKCallback(const ConfigurationChange& configurationChange);
651 
652     bool MarkRemoving() override;
653 
654     void AddHotZoneRect(const DimensionRect& hotZoneRect);
655     void RemoveLastHotZoneRect() const;
656 
657     virtual bool IsOutOfTouchTestRegion(const PointF& parentLocalPoint, const TouchEvent& touchEvent,
658         std::vector<RectF>* regionList = nullptr);
659 
IsLayoutDirtyMarked()660     bool IsLayoutDirtyMarked() const
661     {
662         return isLayoutDirtyMarked_;
663     }
664 
SetLayoutDirtyMarked(bool marked)665     void SetLayoutDirtyMarked(bool marked)
666     {
667         isLayoutDirtyMarked_ = marked;
668     }
669 
HasPositionProp()670     bool HasPositionProp() const
671     {
672         CHECK_NULL_RETURN(renderContext_, false);
673         return renderContext_->HasPosition() || renderContext_->HasOffset() || renderContext_->HasPositionEdges() ||
674                renderContext_->HasOffsetEdges() || renderContext_->HasAnchor();
675     }
676 
677     // The function is only used for fast preview.
FastPreviewUpdateChildDone()678     void FastPreviewUpdateChildDone() override
679     {
680         OnMountToParentDone();
681     }
682 
IsExclusiveEventForChild()683     bool IsExclusiveEventForChild() const
684     {
685         return exclusiveEventForChild_;
686     }
687 
SetExclusiveEventForChild(bool exclusiveEventForChild)688     void SetExclusiveEventForChild(bool exclusiveEventForChild)
689     {
690         exclusiveEventForChild_ = exclusiveEventForChild;
691     }
692 
SetDraggable(bool draggable)693     void SetDraggable(bool draggable)
694     {
695         draggable_ = draggable;
696         userSet_ = true;
697         customerSet_ = false;
698     }
699 
SetCustomerDraggable(bool draggable)700     void SetCustomerDraggable(bool draggable)
701     {
702         draggable_ = draggable;
703         userSet_ = true;
704         customerSet_ = true;
705     }
706 
707     void SetDragPreviewOptions(const DragPreviewOption& previewOption, bool isResetOptions = true)
708     {
709         auto dragDropRelatedConfigurations = GetOrCreateDragDropRelatedConfigurations();
710         CHECK_NULL_VOID(dragDropRelatedConfigurations);
711         dragDropRelatedConfigurations->SetDragPreviewOption(previewOption, isResetOptions);
712     }
713 
SetOptionsAfterApplied(const OptionsAfterApplied & optionsAfterApplied)714     void SetOptionsAfterApplied(const OptionsAfterApplied& optionsAfterApplied)
715     {
716         auto dragDropRelatedConfigurations = GetOrCreateDragDropRelatedConfigurations();
717         CHECK_NULL_VOID(dragDropRelatedConfigurations);
718         dragDropRelatedConfigurations->SetOptionsAfterApplied(optionsAfterApplied);
719     }
720 
GetDragPreviewOption()721     DragPreviewOption GetDragPreviewOption()
722     {
723         auto dragDropRelatedConfigurations = GetOrCreateDragDropRelatedConfigurations();
724         CHECK_NULL_RETURN(dragDropRelatedConfigurations, DragPreviewOption());
725         return dragDropRelatedConfigurations->GetOrCreateDragPreviewOption();
726     }
727 
SetBackgroundFunction(std::function<RefPtr<UINode> ()> && buildFunc)728     void SetBackgroundFunction(std::function<RefPtr<UINode>()>&& buildFunc)
729     {
730         builderFunc_ = std::move(buildFunc);
731         backgroundNode_ = nullptr;
732     }
733 
IsDraggable()734     bool IsDraggable() const
735     {
736         return draggable_;
737     }
738 
IsLayoutComplete()739     bool IsLayoutComplete() const
740     {
741         return isLayoutComplete_;
742     }
743 
IsUserSet()744     bool IsUserSet() const
745     {
746         return userSet_;
747     }
748 
IsCustomerSet()749     bool IsCustomerSet() const
750     {
751         return customerSet_;
752     }
753 
GetPreGrayedOpacity()754     float GetPreGrayedOpacity() const
755     {
756         return preOpacity_;
757     }
758 
SetPreGrayedOpacity(float preOpacity)759     void SetPreGrayedOpacity(float preOpacity)
760     {
761         preOpacity_ = preOpacity;
762     }
763 
SetAllowDrop(const std::set<std::string> & allowDrop)764     void SetAllowDrop(const std::set<std::string>& allowDrop)
765     {
766         allowDrop_ = allowDrop;
767     }
768 
GetAllowDrop()769     const std::set<std::string>& GetAllowDrop() const
770     {
771         return allowDrop_;
772     }
773 
SetDrawModifier(const RefPtr<NG::DrawModifier> & drawModifier)774     void SetDrawModifier(const RefPtr<NG::DrawModifier>& drawModifier)
775     {
776         if (!extensionHandler_) {
777             extensionHandler_ = MakeRefPtr<ExtensionHandler>();
778             extensionHandler_->AttachFrameNode(this);
779         }
780         extensionHandler_->SetDrawModifier(drawModifier);
781     }
782 
783     bool IsSupportDrawModifier();
784 
SetDragPreview(const NG::DragDropInfo & info)785     void SetDragPreview(const NG::DragDropInfo& info)
786     {
787         dragPreviewInfo_ = info;
788     }
789 
GetDragPreview()790     const DragDropInfo& GetDragPreview() const
791     {
792         return dragPreviewInfo_;
793     }
794 
SetOverlayNode(const RefPtr<FrameNode> & overlayNode)795     void SetOverlayNode(const RefPtr<FrameNode>& overlayNode)
796     {
797         overlayNode_ = overlayNode;
798     }
799 
GetOverlayNode()800     RefPtr<FrameNode> GetOverlayNode() const
801     {
802         return overlayNode_;
803     }
804 
805     RefPtr<FrameNode> FindChildByPosition(float x, float y);
806     // some developer use translate to make Grid drag animation, using old function can't find accurate child.
807     // new function will ignore child's position and translate properties.
808     RefPtr<FrameNode> FindChildByPositionWithoutChildTransform(float x, float y);
809 
810     RefPtr<NodeAnimatablePropertyBase> GetAnimatablePropertyFloat(const std::string& propertyName) const;
811     static RefPtr<FrameNode> FindChildByName(const RefPtr<FrameNode>& parentNode, const std::string& nodeName);
812     void CreateAnimatablePropertyFloat(const std::string& propertyName, float value,
813         const std::function<void(float)>& onCallbackEvent, const PropertyUnit& propertyType = PropertyUnit::UNKNOWN);
814     void DeleteAnimatablePropertyFloat(const std::string& propertyName);
815     void UpdateAnimatablePropertyFloat(const std::string& propertyName, float value);
816     void CreateAnimatableArithmeticProperty(const std::string& propertyName, RefPtr<CustomAnimatableArithmetic>& value,
817         std::function<void(const RefPtr<CustomAnimatableArithmetic>&)>& onCallbackEvent);
818     void UpdateAnimatableArithmeticProperty(const std::string& propertyName, RefPtr<CustomAnimatableArithmetic>& value);
819 
820     void SetHitTestMode(HitTestMode mode);
821     HitTestMode GetHitTestMode() const override;
822 
823     TouchResult GetOnChildTouchTestRet(const std::vector<TouchTestInfo>& touchInfo);
824     OnChildTouchTestFunc GetOnTouchTestFunc();
825     void CollectTouchInfos(
826         const PointF& globalPoint, const PointF& parentRevertPoint, std::vector<TouchTestInfo>& touchInfos);
827     RefPtr<FrameNode> GetDispatchFrameNode(const TouchResult& touchRes);
828 
829     std::string ProvideRestoreInfo();
830 
831     static std::vector<RefPtr<FrameNode>> GetNodesById(const std::unordered_set<int32_t>& set);
832     static std::vector<FrameNode*> GetNodesPtrById(const std::unordered_set<int32_t>& set);
833 
834     double GetPreviewScaleVal();
835 
836     bool IsPreviewNeedScale();
837 
SetViewPort(RectF viewPort)838     void SetViewPort(RectF viewPort)
839     {
840         viewPort_ = viewPort;
841     }
842 
GetSelfViewPort()843     std::optional<RectF> GetSelfViewPort() const
844     {
845         return viewPort_;
846     }
847 
848     std::optional<RectF> GetViewPort(bool checkBoundary = false) const;
849 
850     // Frame Rate Controller(FRC) decides FrameRateRange by scene, speed and scene status
851     // speed is measured by millimeter/second
852     void AddFRCSceneInfo(const std::string& scene, float speed, SceneStatus status);
853 
854     void TryPrintDebugLog(const std::string& scene, float speed, SceneStatus status);
855 
856     OffsetF GetParentGlobalOffsetDuringLayout() const;
OnSetCacheCount(int32_t cacheCount,const std::optional<LayoutConstraintF> & itemConstraint)857     void OnSetCacheCount(int32_t cacheCount, const std::optional<LayoutConstraintF>& itemConstraint) override {};
858 
859     // layout wrapper function override
860     const RefPtr<LayoutAlgorithmWrapper>& GetLayoutAlgorithm(bool needReset = false) override;
861 
862     bool EnsureDelayedMeasureBeingOnlyOnce();
863 
864     bool PreMeasure(const std::optional<LayoutConstraintF>& parentConstraint);
865 
866     bool ChildPreMeasureHelper(LayoutWrapper* childWrapper, const std::optional<LayoutConstraintF>& parentConstraint);
867 
868     void CollectDelayMeasureChild(LayoutWrapper* childWrapper);
869 
870     void PostTaskForIgnore();
871 
872     void PostBundle(std::vector<RefPtr<FrameNode>>&& nodes);
873 
874     bool PostponedTaskForIgnore();
875 
AddDelayLayoutChild(const RefPtr<FrameNode> & child)876     void AddDelayLayoutChild(const RefPtr<FrameNode>& child)
877     {
878         if (child) {
879             delayLayoutChildren_.emplace_back(child);
880         }
881     }
882 
GetDelayLayoutChildren()883     const std::vector<RefPtr<FrameNode>>& GetDelayLayoutChildren() const
884     {
885         return delayLayoutChildren_;
886     }
887 
888     void TraverseForIgnore();
889 
890     void TraverseSubtreeToPostBundle(std::vector<RefPtr<FrameNode>>& subtreeCollection, int& subtreeRecheck);
891 
892     void Measure(const std::optional<LayoutConstraintF>& parentConstraint) override;
893 
894     // Called to perform layout children.
895     void Layout() override;
896 
GetTotalChildCount()897     int32_t GetTotalChildCount() const override
898     {
899         if (arkoalaLazyAdapter_) {
900             return arkoalaLazyAdapter_->GetTotalCount();
901         }
902         return UINode::TotalChildCount();
903     }
904 
GetTotalChildCountWithoutExpanded()905     int32_t GetTotalChildCountWithoutExpanded() const
906     {
907         return UINode::CurrentFrameCount();
908     }
909 
GetGeometryNode()910     const RefPtr<GeometryNode>& GetGeometryNode() const override
911     {
912         return geometryNode_;
913     }
914 
SetLayoutProperty(const RefPtr<LayoutProperty> & layoutProperty)915     void SetLayoutProperty(const RefPtr<LayoutProperty>& layoutProperty)
916     {
917         layoutProperty_ = layoutProperty;
918         layoutProperty_->SetHost(WeakClaim(this));
919     }
920 
GetLayoutProperty()921     const RefPtr<LayoutProperty>& GetLayoutProperty() const override
922     {
923         return layoutProperty_;
924     }
925 
926     RefPtr<LayoutWrapper> GetOrCreateChildByIndex(
927         uint32_t index, bool addToRenderTree = true, bool isCache = false) override;
928     RefPtr<LayoutWrapper> GetChildByIndex(uint32_t index, bool isCache = false) override;
929 
930     FrameNode* GetFrameNodeChildByIndex(uint32_t index, bool isCache = false, bool isExpand = true);
931     FrameNode* GetFrameNodeChildByIndexWithoutBuild(uint32_t index);
932     /**
933      * @brief Get the index of Child among all FrameNode children of [this].
934      * Handles intermediate SyntaxNodes like LazyForEach.
935      *
936      * @param child pointer to the Child FrameNode.
937      * @return index of Child, or -1 if not found.
938      */
939     int32_t GetChildTrueIndex(const RefPtr<LayoutWrapper>& child) const;
940     uint32_t GetChildTrueTotalCount() const;
941     ChildrenListWithGuard GetAllChildrenWithBuild(bool addToRenderTree = true) override;
942     void RemoveChildInRenderTree(uint32_t index) override;
943     void RemoveAllChildInRenderTree() override;
944     void DoRemoveChildInRenderTree(uint32_t index, bool isAll) override;
945     void SetActiveChildRange(
946         int32_t start, int32_t end, int32_t cacheStart = 0, int32_t cacheEnd = 0, bool showCached = false) override;
947     void SetActiveChildRange(const std::optional<ActiveChildSets>& activeChildSets,
948         const std::optional<ActiveChildRange>& activeChildRange = std::nullopt) override;
949     void DoSetActiveChildRange(
950         int32_t start, int32_t end, int32_t cacheStart, int32_t cacheEnd, bool showCache = false) override;
951     void RecycleItemsByIndex(int32_t start, int32_t end) override;
GetHostTag()952     const std::string& GetHostTag() const override
953     {
954         return GetTag();
955     }
956 
957     void UpdateFocusState();
958     bool SelfOrParentExpansive();
959     bool SelfExpansive();
960     bool SelfExpansiveToKeyboard();
961     bool ParentExpansive();
962 
IsActive()963     bool IsActive() const override
964     {
965         return isActive_;
966     }
967 
968     void SetActive(bool active = true, bool needRebuildRenderContext = false) override;
969 
GetAccessibilityVisible()970     bool GetAccessibilityVisible() const
971     {
972         return accessibilityVisible_;
973     }
974 
SetAccessibilityVisible(const bool accessibilityVisible)975     void SetAccessibilityVisible(const bool accessibilityVisible)
976     {
977         accessibilityVisible_ = accessibilityVisible;
978     }
979 
IsOutOfLayout()980     bool IsOutOfLayout() const override
981     {
982         return renderContext_->HasPosition() || renderContext_->HasPositionEdges();
983     }
984     void ProcessSafeAreaPadding();
985 
986     bool SkipMeasureContent() const override;
987     float GetBaselineDistance() const override;
988     void SetCacheCount(
989         int32_t cacheCount = 0, const std::optional<LayoutConstraintF>& itemConstraint = std::nullopt) override;
990 
991     void SyncGeometryNode(bool needSyncRsNode, const DirtySwapConfig& config);
992     RefPtr<UINode> GetFrameChildByIndex(
993         uint32_t index, bool needBuild, bool isCache = false, bool addToRenderTree = false) override;
994     RefPtr<UINode> GetFrameChildByIndexWithoutExpanded(uint32_t index) override;
995     bool CheckNeedForceMeasureAndLayout() override;
996     bool ReachResponseDeadline() const override;
997 
998     bool SetParentLayoutConstraint(const SizeF& size) const override;
999     void ForceSyncGeometryNode();
1000     bool IsGeometrySizeChange() const;
1001 
1002     template<typename T>
FindFocusChildNodeOfClass()1003     RefPtr<T> FindFocusChildNodeOfClass()
1004     {
1005         const auto& children = GetChildren();
1006         for (auto iter = children.rbegin(); iter != children.rend(); ++iter) {
1007             auto& child = *iter;
1008             auto target = DynamicCast<FrameNode>(child->FindChildNodeOfClass<T>());
1009             if (target && target->eventHub_) {
1010                 auto focusEvent = target->eventHub_->GetFocusHub();
1011                 if (focusEvent && focusEvent->IsCurrentFocus()) {
1012                     return AceType::DynamicCast<T>(target);
1013                 }
1014             }
1015         }
1016 
1017         if (AceType::InstanceOf<T>(this)) {
1018             auto target = DynamicCast<FrameNode>(this);
1019             if (target && target->eventHub_) {
1020                 auto focusEvent = target->eventHub_->GetFocusHub();
1021                 if (focusEvent && focusEvent->IsCurrentFocus()) {
1022                     return Claim(AceType::DynamicCast<T>(this));
1023                 }
1024             }
1025         }
1026         return nullptr;
1027     }
1028 
1029     virtual std::vector<RectF> GetResponseRegionList(const RectF& rect, int32_t sourceType);
1030 
IsFirstBuilding()1031     bool IsFirstBuilding() const
1032     {
1033         return isFirstBuilding_;
1034     }
1035 
MarkBuildDone()1036     void MarkBuildDone()
1037     {
1038         isFirstBuilding_ = false;
1039     }
1040 
GetLocalMatrix()1041     Matrix4 GetLocalMatrix() const
1042     {
1043         return localMat_;
1044     }
1045     OffsetF GetOffsetInScreen();
1046     OffsetF GetOffsetInSubwindow(const OffsetF& subwindowOffset);
1047     RefPtr<PixelMap> GetDragPixelMap();
1048     RefPtr<FrameNode> GetPageNode();
1049     RefPtr<FrameNode> GetFirstAutoFillContainerNode();
1050     RefPtr<FrameNode> GetNodeContainer();
1051     RefPtr<ContentModifier> GetContentModifier();
1052 
GetExtensionHandler()1053     ExtensionHandler* GetExtensionHandler() const
1054     {
1055         return RawPtr(extensionHandler_);
1056     }
1057 
SetExtensionHandler(const RefPtr<ExtensionHandler> & handler)1058     void SetExtensionHandler(const RefPtr<ExtensionHandler>& handler)
1059     {
1060         extensionHandler_ = handler;
1061         if (extensionHandler_) {
1062             extensionHandler_->AttachFrameNode(this);
1063         }
1064     }
1065 
1066     void NotifyFillRequestSuccess(RefPtr<ViewDataWrap> viewDataWrap,
1067         RefPtr<PageNodeInfoWrap> nodeWrap, AceAutoFillType autoFillType);
1068     void NotifyFillRequestFailed(int32_t errCode, const std::string& fillContent = "", bool isPopup = false);
1069 
1070     int32_t GetUiExtensionId();
1071     int64_t WrapExtensionAbilityId(int64_t extensionOffset, int64_t abilityId);
1072     void SearchExtensionElementInfoByAccessibilityIdNG(
1073         int64_t elementId, int32_t mode, int64_t offset, std::list<Accessibility::AccessibilityElementInfo>& output);
1074     void SearchElementInfosByTextNG(int64_t elementId, const std::string& text, int64_t offset,
1075         std::list<Accessibility::AccessibilityElementInfo>& output);
1076     void FindFocusedExtensionElementInfoNG(
1077         int64_t elementId, int32_t focusType, int64_t offset, Accessibility::AccessibilityElementInfo& output);
1078     void FocusMoveSearchNG(
1079         int64_t elementId, int32_t direction, int64_t offset, Accessibility::AccessibilityElementInfo& output);
1080     bool TransferExecuteAction(
1081         int64_t elementId, const std::map<std::string, std::string>& actionArguments, int32_t action, int64_t offset);
1082     std::vector<RectF> GetResponseRegionListForRecognizer(int32_t sourceType);
1083 
1084     std::vector<RectF> GetResponseRegionListForTouch(const RectF& windowRect);
1085 
1086     void GetResponseRegionListByTraversal(std::vector<RectF>& responseRegionList, const RectF& windowRect);
1087 
1088     bool InResponseRegionList(const PointF& parentLocalPoint, const std::vector<RectF>& responseRegionList);
1089 
1090     bool GetMonopolizeEvents() const;
1091 
IsWindowBoundary()1092     bool IsWindowBoundary() const
1093     {
1094         return isWindowBoundary_;
1095     }
1096 
1097     void SetWindowBoundary(bool isWindowBoundary = true)
1098     {
1099         isWindowBoundary_ = isWindowBoundary;
1100     }
1101 
SetIsMeasureBoundary(bool isMeasureBoundary)1102     void SetIsMeasureBoundary(bool isMeasureBoundary)
1103     {
1104         isMeasureBoundary_ = isMeasureBoundary;
1105     }
1106 
1107     void InitLastArea();
1108 
1109     OffsetF CalculateCachedTransformRelativeOffset(uint64_t nanoTimestamp);
1110 
1111     void PaintDebugBoundary(bool flag) override;
1112     RectF GetRectWithRender();
1113     bool CheckAncestorPageShow();
1114 
SetRemoveCustomProperties(std::function<void ()> func)1115     void SetRemoveCustomProperties(std::function<void()> func)
1116     {
1117         if (!removeCustomProperties_) {
1118             removeCustomProperties_ = func;
1119         }
1120     }
1121 
1122     void GetVisibleRect(RectF& visibleRect, RectF& frameRect) const;
1123     void GetVisibleRectWithClip(RectF& visibleRect, RectF& visibleInnerRect, RectF& frameRect) const;
1124 
1125     void AttachContext(PipelineContext* context, bool recursive = false) override;
1126     void DetachContext(bool recursive = false) override;
1127 
1128     void SetExposureProcessor(const RefPtr<Recorder::ExposureProcessor>& processor);
1129 
GetIsGeometryTransitionIn()1130     bool GetIsGeometryTransitionIn() const
1131     {
1132         return isGeometryTransitionIn_;
1133     }
1134 
SetIsGeometryTransitionIn(bool isGeometryTransitionIn)1135     void SetIsGeometryTransitionIn(bool isGeometryTransitionIn)
1136     {
1137         isGeometryTransitionIn_ = isGeometryTransitionIn;
1138     }
1139 
SetGeometryTransitionInRecursive(bool isGeometryTransitionIn)1140     void SetGeometryTransitionInRecursive(bool isGeometryTransitionIn) override
1141     {
1142         SetIsGeometryTransitionIn(isGeometryTransitionIn);
1143         UINode::SetGeometryTransitionInRecursive(isGeometryTransitionIn);
1144     }
1145     static std::pair<float, float> ContextPositionConvertToPX(
1146         const RefPtr<RenderContext>& context, const SizeF& percentReference);
1147 
1148     // Notified by render context when any transform attributes updated,
1149     // this flag will be used to refresh the transform matrix cache if it's dirty
NotifyTransformInfoChanged()1150     void NotifyTransformInfoChanged()
1151     {
1152         isTransformNotChanged_ = false;
1153     }
1154 
AddPredictLayoutNode(const RefPtr<FrameNode> & node)1155     void AddPredictLayoutNode(const RefPtr<FrameNode>& node)
1156     {
1157         predictLayoutNode_.emplace_back(node);
1158     }
1159 
CheckAccessibilityLevelNo()1160     bool CheckAccessibilityLevelNo() const {
1161         return false;
1162     }
1163 
HasAccessibilityVirtualNode(bool hasAccessibilityVirtualNode)1164     void HasAccessibilityVirtualNode(bool hasAccessibilityVirtualNode)
1165     {
1166         hasAccessibilityVirtualNode_ = hasAccessibilityVirtualNode;
1167     }
1168 
1169     void ProcessAccessibilityVirtualNode();
1170 
1171     void UpdateAccessibilityNodeRect();
1172 
GetVirtualNodeTransformRectRelativeToWindow()1173     RectF GetVirtualNodeTransformRectRelativeToWindow()
1174     {
1175         auto parentUinode = GetVirtualNodeParent().Upgrade();
1176         CHECK_NULL_RETURN(parentUinode, RectF {});
1177         auto parentFrame = AceType::DynamicCast<FrameNode>(parentUinode);
1178         CHECK_NULL_RETURN(parentFrame, RectF {});
1179         auto parentRect = parentFrame->GetTransformRectRelativeToWindow();
1180         auto currentRect = GetTransformRectRelativeToWindow();
1181         currentRect.SetTop(currentRect.Top() + parentRect.Top());
1182         currentRect.SetLeft(currentRect.Left() + parentRect.Left());
1183         return currentRect;
1184     }
1185 
SetIsUseTransitionAnimator(bool isUseTransitionAnimator)1186     void SetIsUseTransitionAnimator(bool isUseTransitionAnimator)
1187     {
1188         isUseTransitionAnimator_ = isUseTransitionAnimator;
1189     }
1190 
GetIsUseTransitionAnimator()1191     bool GetIsUseTransitionAnimator()
1192     {
1193         return isUseTransitionAnimator_;
1194     }
1195 
1196     // this method will check the cache state and return the cached revert matrix preferentially,
1197     // but the caller can pass in true to forcible refresh the cache
1198     CacheMatrixInfo& GetOrRefreshMatrixFromCache(bool forceRefresh = false);
1199 
1200     // apply the matrix to the given point specified by dst
1201     static void MapPointTo(PointF& dst, Matrix4& matrix);
1202     void SetSuggestOpIncMarked(bool flag);
1203     bool GetSuggestOpIncMarked();
1204     void SetCanSuggestOpInc(bool flag);
1205     bool GetCanSuggestOpInc();
1206     void SetApplicationRenderGroupMarked(bool flag);
1207     bool GetApplicationRenderGroupMarked();
1208     void SetSuggestOpIncActivatedOnce();
1209     bool GetSuggestOpIncActivatedOnce();
1210     bool MarkSuggestOpIncGroup(bool suggest, bool calc);
1211     void SetOpIncGroupCheckedThrough(bool flag);
1212     bool GetOpIncGroupCheckedThrough();
1213     void SetOpIncCheckedOnce();
1214     bool GetOpIncCheckedOnce();
1215     void MarkAndCheckNewOpIncNode(Axis axis);
1216     ChildrenListWithGuard GetAllChildren();
1217     OPINC_TYPE_E FindSuggestOpIncNode(std::string& path, const SizeF& boundary, int32_t depth, Axis axis);
1218     void GetInspectorValue() override;
1219     void NotifyWebPattern(bool isRegister) override;
1220 
GetChangeInfoFlag()1221     FrameNodeChangeInfoFlag GetChangeInfoFlag()
1222     {
1223         return changeInfoFlag_;
1224     }
1225 
SetDeleteRsNode(bool isDelete)1226     void SetDeleteRsNode(bool isDelete) {
1227         isDeleteRsNode_ = isDelete;
1228     }
1229 
GetIsDelete()1230     bool GetIsDelete() const {
1231         return isDeleteRsNode_;
1232     }
1233 
SetPositionZ(bool hasPositionZ)1234     void SetPositionZ(bool hasPositionZ) {
1235         hasPositionZ_ = hasPositionZ;
1236     }
1237 
HasPositionZ()1238     bool HasPositionZ() const {
1239         return hasPositionZ_;
1240     }
1241 
1242     void ClearSubtreeLayoutAlgorithm(bool includeSelf = true, bool clearEntireTree = false) override;
1243 
ClearChangeInfoFlag()1244     void ClearChangeInfoFlag()
1245     {
1246         changeInfoFlag_ = FRAME_NODE_CHANGE_INFO_NONE;
1247     }
1248 
1249     void OnSyncGeometryFrameFinish(const RectF& paintRect);
1250     void AddFrameNodeChangeInfoFlag(FrameNodeChangeInfoFlag changeFlag = FRAME_NODE_CHANGE_INFO_NONE);
1251     void RegisterNodeChangeListener();
1252     void UnregisterNodeChangeListener();
1253     void ProcessFrameNodeChangeFlag();
1254     void OnNodeTransformInfoUpdate(bool changed);
1255     void OnNodeTransitionInfoUpdate();
1256     uint32_t GetWindowPatternType() const;
1257 
ResetLayoutAlgorithm()1258     void ResetLayoutAlgorithm()
1259     {
1260         layoutAlgorithm_.Reset();
1261     }
1262 
HasLayoutAlgorithm()1263     bool HasLayoutAlgorithm()
1264     {
1265         return layoutAlgorithm_ != nullptr;
1266     }
1267 
GetDragHitTestBlock()1268     bool GetDragHitTestBlock() const
1269     {
1270         return dragHitTestBlock_;
1271     }
1272 
SetDragHitTestBlock(bool dragHitTestBlock)1273     void SetDragHitTestBlock(bool dragHitTestBlock)
1274     {
1275         dragHitTestBlock_ = dragHitTestBlock;
1276     }
1277 
1278     void SetAICallerHelper(const std::shared_ptr<AICallerHelper>& aiCallerHelper);
1279     /**
1280      * @description: this callback triggered by ai assistant by ui_session proxy.
1281      * @param funcName function name of the target function.
1282      * @param params params for target function in json format.
1283      * @return check ai function call success or not:
1284      * 0 means success, 1 means aiCallerHelper_ is null, 2 means functionName not found
1285      */
1286     uint32_t CallAIFunction(const std::string& functionName, const std::string& params);
1287 
1288     void NotifyChange(int32_t changeIdx, int32_t count, int64_t id, NotificationType notificationType) override;
1289 
1290     /* ============================== Arkoala LazyForEach adapter section START ==============================*/
1291     void ArkoalaSynchronize(
1292         LazyComposeAdapter::CreateItemCb creator, LazyComposeAdapter::UpdateRangeCb updater, int32_t totalCount);
1293 
1294     void ArkoalaRemoveItemsOnChange(int32_t changeIndex);
1295 
1296 private:
1297     RefPtr<LayoutWrapper> ArkoalaGetOrCreateChild(uint32_t index, bool active);
1298     void ArkoalaUpdateActiveRange(int32_t start, int32_t end, int32_t cacheStart, int32_t cacheEnd, bool showCached);
1299 
1300     /* temporary adapter to provide LazyForEach feature in Arkoala */
1301     std::unique_ptr<LazyComposeAdapter> arkoalaLazyAdapter_;
1302 
1303 public:
1304     /* ============================== Arkoala LazyForEach adapter section END ================================*/
1305 
1306     void ChildrenUpdatedFrom(int32_t index);
GetChildrenUpdated()1307     int32_t GetChildrenUpdated() const
1308     {
1309         return childrenUpdatedFrom_;
1310     }
1311 
1312     void SetJSCustomProperty(std::function<bool()> func, std::function<std::string(const std::string&)> getFunc,
1313         std::function<std::string()>&& getCustomPropertyMapFunc = nullptr);
1314     bool GetJSCustomProperty(const std::string& key, std::string& value);
1315     bool GetCapiCustomProperty(const std::string& key, std::string& value);
1316 
1317     void AddCustomProperty(const std::string& key, const std::string& value) override;
1318     void RemoveCustomProperty(const std::string& key) override;
1319 
1320     void SetCustomPropertyMapFlagByKey(const std::string& key);
1321 
1322     void AddExtraCustomProperty(const std::string& key, void* extraData);
1323     void* GetExtraCustomProperty(const std::string& key) const;
1324     void RemoveExtraCustomProperty(const std::string& key);
1325     bool GetCustomPropertyByKey(const std::string& key, std::string& value);
1326     void ExtraCustomPropertyToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
1327     void AddNodeDestroyCallback(const std::string& callbackKey, std::function<void()>&& callback);
1328     void RemoveNodeDestroyCallback(const std::string& callbackKey);
1329     void FireOnExtraNodeDestroyCallback();
1330 
1331     LayoutConstraintF GetLayoutConstraint() const;
1332 
GetTargetComponent()1333     WeakPtr<TargetComponent> GetTargetComponent() const
1334     {
1335         return targetComponent_;
1336     }
1337 
SetExposeInnerGestureFlag(bool exposeInnerGestureFlag)1338     void SetExposeInnerGestureFlag(bool exposeInnerGestureFlag)
1339     {
1340         exposeInnerGestureFlag_ = exposeInnerGestureFlag;
1341     }
1342 
GetExposeInnerGestureFlag()1343     bool GetExposeInnerGestureFlag() const
1344     {
1345         return exposeInnerGestureFlag_;
1346     }
1347 
1348     RefPtr<UINode> GetCurrentPageRootNode() override;
1349 
1350     std::list<RefPtr<FrameNode>> GetActiveChildren();
1351 
1352     void MarkDirtyWithOnProChange(PropertyChangeFlag extraFlag);
1353     void OnPropertyChangeMeasure() const;
1354 
1355     void SetKitNode(const RefPtr<Kit::FrameNode>& node);
1356     const RefPtr<Kit::FrameNode>& GetKitNode() const;
1357 
SetVisibleAreaChangeTriggerReason(VisibleAreaChangeTriggerReason triggerReason)1358     void SetVisibleAreaChangeTriggerReason(VisibleAreaChangeTriggerReason triggerReason)
1359     {
1360         if (visibleAreaChangeTriggerReason_ != triggerReason) {
1361             visibleAreaChangeTriggerReason_ = triggerReason;
1362         }
1363     }
1364 
1365     void OnThemeScopeUpdate(int32_t themeScopeId) override;
1366 
1367     OffsetF CalculateOffsetRelativeToWindow(
1368         uint64_t nanoTimestamp, bool logFlag = false, int32_t areaChangeMinDepth = -1);
1369 
1370     bool IsDebugInspectorId();
1371 
GetLastFrameRect()1372     RectF GetLastFrameRect() const
1373     {
1374         RectF rect;
1375         return lastFrameRect_ ? *lastFrameRect_ : rect;
1376     }
SetLastFrameRect(const RectF & lastFrameRect)1377     void SetLastFrameRect(const RectF& lastFrameRect)
1378     {
1379         *lastFrameRect_ = lastFrameRect;
1380     }
GetLastParentOffsetToWindow()1381     OffsetF GetLastParentOffsetToWindow() const
1382     {
1383         OffsetF offset;
1384         return lastParentOffsetToWindow_ ? *lastParentOffsetToWindow_ : offset;
1385     }
SetLastParentOffsetToWindow(const OffsetF & lastParentOffsetToWindow)1386     void SetLastParentOffsetToWindow(const OffsetF& lastParentOffsetToWindow)
1387     {
1388         *lastParentOffsetToWindow_ = lastParentOffsetToWindow;
1389     }
GetLastHostParentOffsetToWindow()1390     std::shared_ptr<OffsetF>& GetLastHostParentOffsetToWindow()
1391     {
1392         return lastHostParentOffsetToWindow_;
1393     }
ResetRenderDirtyMarked(bool isRenderDirtyMarked)1394     void ResetRenderDirtyMarked(bool isRenderDirtyMarked)
1395     {
1396         isRenderDirtyMarked_ = isRenderDirtyMarked;
1397     }
1398 
1399     void SetFrameNodeDestructorCallback(const std::function<void(int32_t)>&& callback);
1400     void SetMeasureCallback(const std::function<void(RefPtr<Kit::FrameNode>)>& measureCallback);
1401     void FireFrameNodeDestructorCallback();
1402 
CheckTopWindowBoundary()1403     bool CheckTopWindowBoundary() const
1404     {
1405         return topWindowBoundary_;
1406     }
1407 
ClearCachedGlobalOffset()1408     void ClearCachedGlobalOffset()
1409     {
1410         cachedGlobalOffset_ = { 0, OffsetF() };
1411     }
1412 
ClearCachedIsFrameDisappear()1413     void ClearCachedIsFrameDisappear()
1414     {
1415         cachedIsFrameDisappear_ = { 0, false };
1416     }
1417 
SetTopWindowBoundary(bool topWindowBoundary)1418     void SetTopWindowBoundary(bool topWindowBoundary)
1419     {
1420         topWindowBoundary_ = topWindowBoundary;
1421     }
1422 
CheckTopScreen()1423     bool CheckTopScreen() const
1424     {
1425         return GetTag() == V2::SCREEN_ETS_TAG;
1426     }
1427 
1428     bool CheckVisibleOrActive() override;
1429 
SetPaintNode(const RefPtr<FrameNode> & paintNode)1430     void SetPaintNode(const RefPtr<FrameNode>& paintNode)
1431     {
1432         paintNode_ = paintNode;
1433     }
1434 
GetPaintNode()1435     const RefPtr<FrameNode>& GetPaintNode() const
1436     {
1437         return paintNode_;
1438     }
1439 
SetFocusPaintNode(const RefPtr<FrameNode> & accessibilityFocusPaintNode)1440     void SetFocusPaintNode(const RefPtr<FrameNode>& accessibilityFocusPaintNode)
1441     {
1442         accessibilityFocusPaintNode_ = accessibilityFocusPaintNode;
1443     }
1444 
GetFocusPaintNode()1445     const RefPtr<FrameNode>& GetFocusPaintNode() const
1446     {
1447         return accessibilityFocusPaintNode_;
1448     }
1449 
1450     bool IsDrawFocusOnTop() const;
1451 
SetNeedLazyLayout(bool value)1452     void SetNeedLazyLayout(bool value)
1453     {
1454         layoutProperty_->SetNeedLazyLayout(value);
1455     }
1456 
SetRemoveToolbarItemCallback(uint32_t id,std::function<void ()> && callback)1457     void SetRemoveToolbarItemCallback(uint32_t id, std::function<void()>&& callback)
1458     {
1459         removeToolbarItemCallbacks_[id] = callback;
1460     }
1461 
1462     int32_t OnRecvCommand(const std::string& command) override;
1463 
ResetLastFrameNodeRect()1464     void ResetLastFrameNodeRect()
1465     {
1466         if (lastFrameNodeRect_) {
1467             lastFrameNodeRect_.reset();
1468         }
1469     }
1470 
1471     bool HasMultipleChild();
1472 
UpdateOcclusionCullingStatus(bool enable)1473     void UpdateOcclusionCullingStatus(bool enable)
1474     {
1475         if (renderContext_) {
1476             renderContext_->UpdateOcclusionCullingStatus(enable);
1477         }
1478     }
1479 
1480     void AddToOcclusionMap(bool enable);
1481     void MarkModifyDoneUnsafely();
1482     void MarkDirtyNodeUnsafely(PropertyChangeFlag extraFlag);
1483     void UpdateIgnoreCount(int inc);
1484     void MountToParent(const RefPtr<UINode>& parent, int32_t slot = DEFAULT_NODE_SLOT, bool silently = false,
1485         bool addDefaultTransition = false, bool addModalUiextension = false) override;
1486 
1487 protected:
1488     void DumpInfo() override;
1489     std::unordered_map<std::string, std::function<void()>> destroyCallbacksMap_;
1490     void DumpInfo(std::unique_ptr<JsonValue>& json) override;
1491     void DumpSimplifyInfo(std::shared_ptr<JsonValue>& json) override;
1492     void OnCollectRemoved() override;
1493 
1494 private:
1495     void MarkDirtyNode(
1496         bool isMeasureBoundary, bool isRenderBoundary, PropertyChangeFlag extraFlag = PROPERTY_UPDATE_NORMAL);
1497     OPINC_TYPE_E IsOpIncValidNode(const SizeF& boundary, Axis axis, int32_t childNumber = 0);
1498     static int GetValidLeafChildNumber(const RefPtr<FrameNode>& host, int32_t thresh);
1499     void MarkNeedRender(bool isRenderBoundary);
1500     bool IsNeedRequestParentMeasure() const;
1501     void UpdateLayoutPropertyFlag() override;
1502     void ForceUpdateLayoutPropertyFlag(PropertyChangeFlag propertyChangeFlag) override;
1503     void AdjustParentLayoutFlag(PropertyChangeFlag& flag) override;
1504     /**
1505      * @brief try to mark Parent dirty with flag PROPERTY_UPDATE_BY_CHILD_REQUEST.
1506      *
1507      * @return true if Parent is successfully marked dirty.
1508      */
1509     virtual bool RequestParentDirty();
1510 
1511     void UpdateChildrenLayoutWrapper(const RefPtr<LayoutWrapperNode>& self, bool forceMeasure, bool forceLayout);
1512     void AdjustLayoutWrapperTree(const RefPtr<LayoutWrapperNode>& parent, bool forceMeasure, bool forceLayout) override;
1513 
1514     RefPtr<PaintWrapper> CreatePaintWrapper();
1515     void LayoutOverlay();
1516 
1517     void OnGenerateOneDepthVisibleFrame(std::list<RefPtr<FrameNode>>& visibleList) override;
1518     void OnGenerateOneDepthVisibleFrameWithTransition(std::list<RefPtr<FrameNode>>& visibleList) override;
1519     void OnGenerateOneDepthVisibleFrameWithOffset(
1520         std::list<RefPtr<FrameNode>>& visibleList, OffsetF& offset) override;
1521     void OnGenerateOneDepthAllFrame(std::list<RefPtr<FrameNode>>& allList) override;
1522 
1523     bool IsMeasureBoundary();
1524     bool IsRenderBoundary();
1525 
1526     bool OnRemoveFromParent(bool allowTransition) override;
1527     bool RemoveImmediately() const override;
1528 
1529     bool IsPaintRectWithTransformValid();
1530 
1531     // dump self info.
1532     void DumpDragInfo();
1533     void DumpOverlayInfo();
1534     void DumpCommonInfo();
1535     void DumpCommonInfo(std::unique_ptr<JsonValue>& json);
1536     void DumpSimplifyCommonInfo(std::shared_ptr<JsonValue>& json);
1537     void DumpSimplifySafeAreaInfo(std::unique_ptr<JsonValue>& json);
1538     void DumpSimplifyOverlayInfo(std::unique_ptr<JsonValue>& json);
1539     void DumpBorder(const std::unique_ptr<NG::BorderWidthProperty>& border, std::string label,
1540         std::unique_ptr<JsonValue>& json);
1541     void DumpPadding(const std::unique_ptr<NG::PaddingProperty>& border, std::string label,
1542         std::unique_ptr<JsonValue>& json);
1543     void DumpOverlayInfo(std::unique_ptr<JsonValue>& json);
1544     void DumpDragInfo(std::unique_ptr<JsonValue>& json);
1545     void DumpAlignRulesInfo(std::unique_ptr<JsonValue>& json);
1546     void DumpSafeAreaInfo(std::unique_ptr<JsonValue>& json);
1547     void DumpExtensionHandlerInfo(std::unique_ptr<JsonValue>& json);
1548     void DumpOnSizeChangeInfo(std::unique_ptr<JsonValue>& json);
1549     void BuildLayoutInfo(std::unique_ptr<JsonValue>& json);
1550 
1551     void DumpSafeAreaInfo();
1552     // add flexLayout && direction && align && aspectRatio dumpInfo
1553     void DumpLayoutInfo();
1554     void DumpAlignRulesInfo();
1555     void DumpExtensionHandlerInfo();
1556     void DumpAdvanceInfo() override;
1557     void DumpAdvanceInfo(std::unique_ptr<JsonValue>& json) override;
1558     void DumpViewDataPageNode(RefPtr<ViewDataWrap> viewDataWrap, bool needsRecordData = false) override;
1559     void DumpOnSizeChangeInfo();
1560     void DumpKeyboardShortcutInfo();
1561     bool CheckAutoSave() override;
1562     void MouseToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
1563     void TouchToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
1564     void GeometryNodeToJsonValue(std::unique_ptr<JsonValue>& json, const InspectorFilter& filter) const;
1565 
1566     bool GetTouchable() const;
1567     bool OnLayoutFinish(bool& needSyncRsNode, DirtySwapConfig& config);
1568 
1569     void ProcessVisibleAreaChangeEvent(const RectF& visibleRect, const RectF& frameRect,
1570         const std::vector<double>& visibleAreaRatios, VisibleCallbackInfo& visibleAreaCallback, bool isUser);
1571     void ProcessAllVisibleCallback(const std::vector<double>& visibleAreaUserRatios,
1572         VisibleCallbackInfo& visibleAreaUserCallback, double currentVisibleRatio,
1573         double lastVisibleRatio, bool isThrottled = false, bool isInner = false);
1574     void ProcessThrottledVisibleCallback(bool forceDisappear);
1575     bool IsFrameDisappear() const;
1576     bool IsFrameDisappear(uint64_t timestamp, int32_t isVisibleChangeMinDepth = -1);
1577     bool IsFrameAncestorDisappear(uint64_t timestamp, int32_t isVisibleChangeMinDepth = -1);
1578     void ThrottledVisibleTask();
1579 
1580     void OnPixelRoundFinish(const SizeF& pixelGridRoundSize);
1581 
1582     double CalculateCurrentVisibleRatio(const RectF& visibleRect, const RectF& renderRect);
1583 
1584     // set custom background layoutConstraint
1585     void SetBackgroundLayoutConstraint(const RefPtr<FrameNode>& customNode);
1586 
1587     void GetPercentSensitive();
1588     void UpdatePercentSensitive();
1589 
1590     void AddFrameNodeSnapshot(
1591         bool isHit, int32_t parentId, const std::vector<RectF>& responseRegionList, EventTreeType type);
1592 
1593     int32_t GetNodeExpectedRate();
1594 
1595     void RecordExposureInner();
1596 
1597     const std::pair<uint64_t, OffsetF>& GetCachedGlobalOffset() const;
1598 
1599     void SetCachedGlobalOffset(const std::pair<uint64_t, OffsetF>& timestampOffset);
1600 
1601     const std::pair<uint64_t, OffsetF>& GetCachedTransformRelativeOffset() const;
1602 
1603     void SetCachedTransformRelativeOffset(const std::pair<uint64_t, OffsetF>& timestampOffset);
1604 
1605     HitTestMode TriggerOnTouchIntercept(const TouchEvent& touchEvent);
1606 
1607     void TriggerShouldParallelInnerWith(
1608         const ResponseLinkResult& currentRecognizers, const ResponseLinkResult& responseLinkRecognizers);
1609 
1610     void TriggerRsProfilerNodeMountCallbackIfExist();
1611 
1612     void AddTouchEventAllFingersInfo(TouchEventInfo& event, const TouchEvent& touchEvent);
1613 
1614     RectF ApplyFrameNodeTranformToRect(const RectF& rect, const RefPtr<FrameNode>& parent) const;
1615 
1616     CacheVisibleRectResult GetCacheVisibleRect(uint64_t timestamp, bool logFlag = false);
1617 
1618     CacheVisibleRectResult CalculateCacheVisibleRect(CacheVisibleRectResult& parentCacheVisibleRect,
1619         const RefPtr<FrameNode>& parentUi, RectF& rectToParent, const std::pair<VectorF, VectorF>& pairScale,
1620         uint64_t timestamp);
1621 
1622     void NotifyConfigurationChangeNdk(const ConfigurationChange& configurationChange);
1623 
1624     bool AllowVisibleAreaCheck() const;
1625 
1626     bool ProcessMouseTestHit(const PointF& globalPoint, const PointF& localPoint,
1627     TouchRestrict& touchRestrict, TouchTestResult& newComingTargets);
1628 
1629     bool ProcessTipsMouseTestHit(const PointF& globalPoint, const PointF& localPoint,
1630         TouchRestrict& touchRestrict, TouchTestResult& newComingTargets);
1631 
1632     void TipsTouchTest(const PointF& globalPoint, const PointF& parentLocalPoint, const PointF& parentRevertPoint,
1633         TouchRestrict& touchRestrict, TouchTestResult& result, ResponseLinkResult& responseLinkResult, bool isDispatch);
1634 
1635     RectF CheckResponseRegionForStylus(RectF& rect, const TouchEvent& touchEvent);
1636 
1637     void ResetPredictNodes();
1638     void HandleAreaChangeDestruct();
1639 
1640     const char* GetPatternTypeName() const;
1641     const char* GetLayoutPropertyTypeName() const;
1642     const char* GetPaintPropertyTypeName() const;
1643     void AddNodeToRegisterTouchTest();
1644     void CleanupPipelineResources();
1645 
1646     void MarkModifyDoneMultiThread();
1647     void MarkDirtyNodeMultiThread(PropertyChangeFlag extraFlag);
1648     void RebuildRenderContextTreeMultiThread();
1649     void MarkNeedRenderMultiThread(bool isRenderBoundary);
1650     void UpdateBackground();
1651     void DispatchVisibleAreaChangeEvent(const CacheVisibleRectResult& visibleResult);
1652 
1653     bool isTrimMemRecycle_ = false;
1654     // sort in ZIndex.
1655     std::multiset<WeakPtr<FrameNode>, ZIndexComparator> frameChildren_;
1656     RefPtr<GeometryNode> geometryNode_ = MakeRefPtr<GeometryNode>();
1657 
1658     std::function<void(const ConfigurationChange& configurationChange)> configurationUpdateCallback_;
1659     std::function<void()> colorModeUpdateCallback_;
1660     std::function<void(int32_t)> ndkColorModeUpdateCallback_;
1661     std::function<void(float, float)> ndkFontUpdateCallback_;
1662     RefPtr<AccessibilityProperty> accessibilityProperty_;
1663     bool hasAccessibilityVirtualNode_ = false;
1664     RefPtr<LayoutProperty> layoutProperty_;
1665     RefPtr<PaintProperty> paintProperty_;
1666     RefPtr<RenderContext> renderContext_ = RenderContext::Create();
1667     RefPtr<EventHub> eventHub_;
1668     RefPtr<Pattern> pattern_;
1669     RefPtr<FocusHub> focusHub_;
1670 
1671     RefPtr<ExtensionHandler> extensionHandler_;
1672 
1673     RefPtr<FrameNode> backgroundNode_;
1674     std::function<RefPtr<UINode>()> builderFunc_;
1675     std::unique_ptr<RectF> lastFrameRect_;
1676     std::unique_ptr<OffsetF> lastParentOffsetToWindow_;
1677     std::shared_ptr<OffsetF> lastHostParentOffsetToWindow_;
1678     std::unique_ptr<RectF> lastFrameNodeRect_;
1679     std::set<std::string> allowDrop_;
1680     std::function<void()> removeCustomProperties_;
1681     std::function<std::string(const std::string& key)> getCustomProperty_;
1682     std::function<std::string()> getCustomPropertyMapFunc_;
1683     std::optional<RectF> viewPort_;
1684     NG::DragDropInfo dragPreviewInfo_;
1685 
1686     RefPtr<LayoutAlgorithmWrapper> layoutAlgorithm_;
1687     RefPtr<GeometryNode> oldGeometryNode_;
1688     std::optional<bool> skipMeasureContent_;
1689     std::unique_ptr<FrameProxy> frameProxy_;
1690     WeakPtr<TargetComponent> targetComponent_;
1691 
1692     bool needSyncRenderTree_ = false;
1693 
1694     bool isPropertyDiffMarked_ = false;
1695     bool isLayoutDirtyMarked_ = false;
1696     bool isRenderDirtyMarked_ = false;
1697     bool isMeasureBoundary_ = false;
1698     bool hasPendingRequest_ = false;
1699     bool isPrivacySensitive_ = false;
1700 
1701     // for container, this flag controls only the last child in touch area is consuming event.
1702     bool exclusiveEventForChild_ = false;
1703     bool isActive_ = false;
1704     bool accessibilityVisible_ = true;
1705     bool isResponseRegion_ = false;
1706     bool isLayoutComplete_ = false;
1707     bool isFirstBuilding_ = true;
1708 
1709     double lastVisibleRatio_ = 0.0;
1710     double lastInnerVisibleRatio_ = 0.0;
1711     double lastVisibleCallbackRatio_ = 0.0;
1712     double lastInnerVisibleCallbackRatio_ = 0.0;
1713     double lastThrottledVisibleRatio_ = 0.0;
1714     double lastThrottledVisibleCbRatio_ = 0.0;
1715     int64_t lastThrottledTriggerTime_ = 0;
1716     bool throttledCallbackOnTheWay_ = false;
1717 
1718     // internal node such as Text in Button CreateWithLabel
1719     // should not seen by preview inspector or accessibility
1720     bool isInternal_ = false;
1721 
1722     std::string nodeName_;
1723 
1724     ColorMode colorMode_ = ColorMode::LIGHT;
1725 
1726     bool draggable_ = false;
1727     bool userSet_ = false;
1728     bool customerSet_ = false;
1729     bool isWindowBoundary_ = false;
1730     uint8_t suggestOpIncByte_ = 0;
1731     uint64_t getCacheNanoTime_ = 0;
1732     RectF prePaintRect_;
1733 
1734     std::map<std::string, RefPtr<NodeAnimatablePropertyBase>> nodeAnimatablePropertyMap_;
1735     Matrix4 localMat_ = Matrix4::CreateIdentity();
1736     // this is just used for the hit test process of event handling, do not used for other purpose
1737     CacheMatrixInfo cacheMatrixInfo_;
1738     // control the localMat_ and localRevertMatrix_ available or not, set to false when any transform info is set
1739     bool isTransformNotChanged_ = false;
1740     bool isFind_ = false;
1741 
1742     bool isRestoreInfoUsed_ = false;
1743     bool checkboxFlag_ = false;
1744     bool isDisallowDropForcedly_ = false;
1745     bool isGeometryTransitionIn_ = false;
1746     bool isLayoutNode_ = false;
1747     bool isCalculateInnerVisibleRectClip_ = false;
1748     bool dragHitTestBlock_ = false;
1749 
1750     bool isUseTransitionAnimator_ = false;
1751 
1752     bool exposeInnerGestureFlag_ = false;
1753     bool isDeleteRsNode_ = false;
1754     bool hasPositionZ_ = false;
1755     bool hasBindTips_ = false;
1756 
1757     RefPtr<FrameNode> overlayNode_;
1758 
1759     RefPtr<FrameNode> paintNode_;
1760 
1761     RefPtr<FrameNode> accessibilityFocusPaintNode_;
1762 
1763     std::unordered_map<std::string, int32_t> sceneRateMap_;
1764 
1765     std::unordered_map<std::string, std::vector<std::string>> customPropertyMap_;
1766 
1767     std::unordered_map<std::string, void*> extraCustomPropertyMap_;
1768 
1769     std::map<std::string, std::function<void()>> destroyCallbacks_;
1770 
1771     RefPtr<Recorder::ExposureProcessor> exposureProcessor_;
1772 
1773     std::pair<uint64_t, OffsetF> cachedGlobalOffset_ = { 0, OffsetF() };
1774     std::pair<uint64_t, OffsetF> cachedTransformRelativeOffset_ = { 0, OffsetF() };
1775     std::pair<uint64_t, bool> cachedIsFrameDisappear_ = { 0, false };
1776     std::pair<uint64_t, CacheVisibleRectResult> cachedVisibleRectResult_ = { 0, CacheVisibleRectResult() };
1777 
1778     struct onSizeChangeDumpInfo {
1779         int64_t onSizeChangeTimeStamp;
1780         RectF lastFrameRect;
1781         RectF currFrameRect;
1782     };
1783     std::vector<onSizeChangeDumpInfo> onSizeChangeDumpInfos;
1784     std::list<WeakPtr<FrameNode>> predictLayoutNode_;
1785     FrameNodeChangeInfoFlag changeInfoFlag_ = FRAME_NODE_CHANGE_INFO_NONE;
1786     std::optional<RectF> syncedFramePaintRect_;
1787 
1788     int32_t childrenUpdatedFrom_ = -1;
1789     VisibleAreaChangeTriggerReason visibleAreaChangeTriggerReason_ = VisibleAreaChangeTriggerReason::IDLE;
1790     float preOpacity_ = 1.0f;
1791     std::function<void(int32_t)> frameNodeDestructorCallback_;
1792     std::function<void(RefPtr<Kit::FrameNode>&)> measureCallback_;
1793 
1794     bool topWindowBoundary_ = false;
1795 
1796     friend class RosenRenderContext;
1797     friend class RenderContext;
1798     friend class Pattern;
1799     mutable std::shared_mutex fontSizeCallbackMutex_;
1800     mutable std::shared_mutex colorModeCallbackMutex_;
1801 
1802     RefPtr<Kit::FrameNode> kitNode_;
1803     ACE_DISALLOW_COPY_AND_MOVE(FrameNode);
1804 
1805     std::unordered_map<uint32_t, std::function<void()>> removeToolbarItemCallbacks_;
1806 
1807     RefPtr<FrameNode> cornerMarkNode_ = nullptr;
1808     RefPtr<DragDropRelatedConfigurations> dragDropRelatedConfigurations_;
1809 
1810     std::vector<RefPtr<FrameNode>> delayMeasureChildren_;
1811     std::vector<RefPtr<FrameNode>> delayLayoutChildren_;
1812     std::shared_ptr<AICallerHelper> aiCallerHelper_;
1813 };
1814 } // namespace OHOS::Ace::NG
1815 
1816 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_BASE_FRAME_NODE_H
1817