From 35bcda0095ea8c2355c96e0416a3cca3a256c409 Mon Sep 17 00:00:00 2001 From: xianzhiK <735001321@qq.com> Date: Sat, 16 Nov 2024 15:13:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=92=8C=E8=8A=82=E7=82=B9=E6=A0=91=E9=81=8D=E5=8E=86=E8=83=BD?= =?UTF-8?q?=E5=8A=9B=E5=8A=A0=E5=BC=BA=E9=9C=80=E6=B1=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xianzhiK <735001321@qq.com> --- .../core/components_ng/base/frame_node.cpp | 9 ++- .../core/components_ng/base/frame_node.h | 6 +- frameworks/core/components_ng/base/ui_node.h | 8 +++ .../core/components_ng/base/view_abstract.cpp | 8 +-- .../core/components_ng/base/view_abstract.h | 4 +- .../native/node/frame_node_modifier.cpp | 24 +++---- .../native/event/drag_and_drop_impl.cpp | 16 ++--- .../native/native_interface_xcomponent.cpp | 4 +- interfaces/native/native_type.h | 4 +- interfaces/native/node/animate_impl.cpp | 38 +++++------ interfaces/native/node/dialog_model.cpp | 36 +++++----- interfaces/native/node/native_node_napi.cpp | 2 +- interfaces/native/node/node_animate.cpp | 8 +-- interfaces/native/node/node_extened.cpp | 34 +++++----- interfaces/native/node/node_model.cpp | 32 ++++----- interfaces/native/node/node_utils.cpp | 37 +++++------ .../interfaces/drag_and_drop_test.cpp | 8 +-- test/unittest/interfaces/native_node_test.cpp | 66 +++++++++---------- 18 files changed, 177 insertions(+), 167 deletions(-) diff --git a/frameworks/core/components_ng/base/frame_node.cpp b/frameworks/core/components_ng/base/frame_node.cpp index fd88ba7c416..823cc71e3a4 100644 --- a/frameworks/core/components_ng/base/frame_node.cpp +++ b/frameworks/core/components_ng/base/frame_node.cpp @@ -6024,9 +6024,12 @@ RefPtr FrameNode::GetCurrentPageRootNode() CHECK_NULL_RETURN(pageNode, nullptr); auto jsView = pageNode->GetChildAtIndex(0); CHECK_NULL_RETURN(jsView, nullptr); - auto rootNode = jsView->GetChildAtIndex(0); - CHECK_NULL_RETURN(rootNode, nullptr); - return rootNode; + if (jsView->GetTag() == V2::JS_VIEW_ETS_TAG) { + auto rootNode = jsView->GetChildAtIndex(0); + CHECK_NULL_RETURN(rootNode, nullptr); + return rootNode; + } + return jsView; } std::list> FrameNode::GetActiveChildren() diff --git a/frameworks/core/components_ng/base/frame_node.h b/frameworks/core/components_ng/base/frame_node.h index 409412621d9..2556f5649c4 100644 --- a/frameworks/core/components_ng/base/frame_node.h +++ b/frameworks/core/components_ng/base/frame_node.h @@ -1118,8 +1118,8 @@ public: bool GetJSCustomProperty(const std::string& key, std::string& value); bool GetCapiCustomProperty(const std::string& key, std::string& value); - void AddCustomProperty(const std::string& key, const std::string& value); - void RemoveCustomProperty(const std::string& key); + void AddCustomProperty(const std::string& key, const std::string& value) override; + void RemoveCustomProperty(const std::string& key) override; LayoutConstraintF GetLayoutConstraint() const; @@ -1138,7 +1138,7 @@ public: return exposeInnerGestureFlag_; } - RefPtr GetCurrentPageRootNode(); + RefPtr GetCurrentPageRootNode() override; std::list> GetActiveChildren(); diff --git a/frameworks/core/components_ng/base/ui_node.h b/frameworks/core/components_ng/base/ui_node.h index de4c02589db..4e1d8861817 100644 --- a/frameworks/core/components_ng/base/ui_node.h +++ b/frameworks/core/components_ng/base/ui_node.h @@ -792,6 +792,14 @@ public: isCNode_ = createByCapi; } + virtual RefPtr GetCurrentPageRootNode() + { + return nullptr; + } + + virtual void AddCustomProperty(const std::string& key, const std::string& value) {} + virtual void RemoveCustomProperty(const std::string& key) {} + protected: std::list>& ModifyChildren() { diff --git a/frameworks/core/components_ng/base/view_abstract.cpp b/frameworks/core/components_ng/base/view_abstract.cpp index 428e4a1abe0..d94607c5a34 100644 --- a/frameworks/core/components_ng/base/view_abstract.cpp +++ b/frameworks/core/components_ng/base/view_abstract.cpp @@ -4446,7 +4446,7 @@ Alignment ViewAbstract::GetAlign(FrameNode *frameNode) Dimension ViewAbstract::GetWidth(FrameNode* frameNode) { - Dimension value = Dimension(0.0f); + Dimension value = Dimension(-1.0f); const auto& layoutProperty = frameNode->GetLayoutProperty(); CHECK_NULL_RETURN(layoutProperty, value); const auto& property = layoutProperty->GetCalcLayoutConstraint(); @@ -4463,7 +4463,7 @@ Dimension ViewAbstract::GetWidth(FrameNode* frameNode) Dimension ViewAbstract::GetHeight(FrameNode* frameNode) { - Dimension value = Dimension(0.0f); + Dimension value = Dimension(-1.0f); const auto& layoutProperty = frameNode->GetLayoutProperty(); CHECK_NULL_RETURN(layoutProperty, value); const auto& property = layoutProperty->GetCalcLayoutConstraint(); @@ -5139,13 +5139,13 @@ void ViewAbstract::SetSystemFontChangeEvent(FrameNode* frameNode, std::function< frameNode->SetNDKFontUpdateCallback(std::move(onFontChange)); } -void ViewAbstract::AddCustomProperty(FrameNode* frameNode, const std::string& key, const std::string& value) +void ViewAbstract::AddCustomProperty(UINode* frameNode, const std::string& key, const std::string& value) { CHECK_NULL_VOID(frameNode); frameNode->AddCustomProperty(key, value); } -void ViewAbstract::RemoveCustomProperty(FrameNode* frameNode, const std::string& key) +void ViewAbstract::RemoveCustomProperty(UINode* frameNode, const std::string& key) { CHECK_NULL_VOID(frameNode); frameNode->RemoveCustomProperty(key); diff --git a/frameworks/core/components_ng/base/view_abstract.h b/frameworks/core/components_ng/base/view_abstract.h index 972dc5353f1..bdc75c46bb7 100644 --- a/frameworks/core/components_ng/base/view_abstract.h +++ b/frameworks/core/components_ng/base/view_abstract.h @@ -779,8 +779,8 @@ public: static void SetMarkAnchorStart(Dimension& markAnchorStart); static void ResetMarkAnchorStart(); static void SetOffsetLocalizedEdges(bool needLocalized); - static void AddCustomProperty(FrameNode* frameNode, const std::string& key, const std::string& value); - static void RemoveCustomProperty(FrameNode* frameNode, const std::string& key); + static void AddCustomProperty(UINode* frameNode, const std::string& key, const std::string& value); + static void RemoveCustomProperty(UINode* frameNode, const std::string& key); private: static void AddDragFrameNodeToManager(); diff --git a/frameworks/core/interfaces/native/node/frame_node_modifier.cpp b/frameworks/core/interfaces/native/node/frame_node_modifier.cpp index bac65e7bf38..e841b372271 100644 --- a/frameworks/core/interfaces/native/node/frame_node_modifier.cpp +++ b/frameworks/core/interfaces/native/node/frame_node_modifier.cpp @@ -525,33 +525,33 @@ void SetCustomPropertyModiferByKey(ArkUINodeHandle node, void* callback, void* g void AddCustomProperty(ArkUINodeHandle node, ArkUI_CharPtr key, ArkUI_CharPtr value) { - auto* frameNode = reinterpret_cast(node); - CHECK_NULL_VOID(frameNode); - auto pipeline = frameNode->GetContextRefPtr(); + auto* uiNode = reinterpret_cast(node); + CHECK_NULL_VOID(uiNode); + auto pipeline = uiNode->GetContextRefPtr(); if (pipeline && !pipeline->CheckThreadSafe()) { LOGW("AddCustomProperty doesn't run on UI thread"); return; } - ViewAbstract::AddCustomProperty(frameNode, key, value); + ViewAbstract::AddCustomProperty(uiNode, key, value); } void RemoveCustomProperty(ArkUINodeHandle node, ArkUI_CharPtr key) { - auto* frameNode = reinterpret_cast(node); - CHECK_NULL_VOID(frameNode); - auto pipeline = frameNode->GetContextRefPtr(); + auto* uiNode = reinterpret_cast(node); + CHECK_NULL_VOID(uiNode); + auto pipeline = uiNode->GetContextRefPtr(); if (pipeline && !pipeline->CheckThreadSafe()) { LOGW("RemoveCustomProperty doesn't run on UI thread"); return; } - ViewAbstract::RemoveCustomProperty(frameNode, key); + ViewAbstract::RemoveCustomProperty(uiNode, key); } ArkUINodeHandle GetCurrentPageRootNode(ArkUINodeHandle node) { - auto frameNode = reinterpret_cast(node); - CHECK_NULL_RETURN(frameNode, nullptr); - auto rootNode = frameNode->GetCurrentPageRootNode(); + auto uiNode = reinterpret_cast(node); + CHECK_NULL_RETURN(uiNode, nullptr); + auto rootNode = uiNode->GetCurrentPageRootNode(); return reinterpret_cast(OHOS::Ace::AceType::RawPtr(rootNode)); } @@ -569,7 +569,7 @@ void GetActiveChildrenInfo(ArkUINodeHandle handle, ArkUINodeHandle** items, ArkU auto childList = frameNode->GetActiveChildren(); *size = childList.size(); *items = new ArkUINodeHandle[*size]; - int i = 0; + int32_t i = 0; for (auto& child : childList) { (*items)[i++] = reinterpret_cast(OHOS::Ace::AceType::RawPtr(child)); } diff --git a/interfaces/native/event/drag_and_drop_impl.cpp b/interfaces/native/event/drag_and_drop_impl.cpp index d88107ab7b0..516b3c990a3 100644 --- a/interfaces/native/event/drag_and_drop_impl.cpp +++ b/interfaces/native/event/drag_and_drop_impl.cpp @@ -111,7 +111,7 @@ int32_t OH_ArkUI_DragEvent_GetDataTypes( ArkUI_DragAction* OH_ArkUI_CreateDragActionWithNode(ArkUI_NodeHandle node) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !node) { return nullptr; } @@ -121,7 +121,7 @@ ArkUI_DragAction* OH_ArkUI_CreateDragActionWithNode(ArkUI_NodeHandle node) ArkUI_DragAction* OH_ArkUI_CreateDragActionWithContext(ArkUI_ContextHandle uiContext) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !uiContext) { return nullptr; } @@ -235,7 +235,7 @@ int32_t OH_ArkUI_DragAction_SetDragPreviewOption(ArkUI_DragAction* dragAction, A int32_t OH_ArkUI_DragAction_RegisterStatusListener(ArkUI_DragAction* dragAction, void* userData, void (*listener)(ArkUI_DragAndDropInfo* dragAndDropInfo, void* userData)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !dragAction) { return ARKUI_ERROR_CODE_PARAM_INVALID; } @@ -246,7 +246,7 @@ int32_t OH_ArkUI_DragAction_RegisterStatusListener(ArkUI_DragAction* dragAction, void OH_ArkUI_DragAction_UnregisterStatusListener(ArkUI_DragAction* dragAction) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !dragAction) { return; } @@ -280,7 +280,7 @@ int32_t OH_ArkUI_StartDrag(ArkUI_DragAction* dragAction) return ARKUI_ERROR_CODE_PARAM_INVALID; } auto* dragActions = reinterpret_cast(dragAction); - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!dragActions || !impl) { return ARKUI_ERROR_CODE_PARAM_INVALID; } @@ -322,7 +322,7 @@ int32_t OH_ArkUI_DragEvent_DisableDefaultDropAnimation(ArkUI_DragEvent* event, b int32_t OH_ArkUI_SetNodeDraggable(ArkUI_NodeHandle node, bool enabled) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !node) { return ARKUI_ERROR_CODE_PARAM_INVALID; } @@ -413,7 +413,7 @@ int32_t OH_ArkUI_DragPreviewOption_SetDefaultAnimationBeforeLiftingEnabled( int32_t OH_ArkUI_SetNodeDragPreviewOption(ArkUI_NodeHandle node, ArkUI_DragPreviewOption* option) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !node) { return ARKUI_ERROR_CODE_PARAM_INVALID; } @@ -456,7 +456,7 @@ int32_t OH_ArkUI_SetNodeDragPreviewOption(ArkUI_NodeHandle node, ArkUI_DragPrevi int32_t OH_ArkUI_SetNodeDragPreview(ArkUI_NodeHandle node, OH_PixelmapNative* preview) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !node) { return ARKUI_ERROR_CODE_PARAM_INVALID; } diff --git a/interfaces/native/native_interface_xcomponent.cpp b/interfaces/native/native_interface_xcomponent.cpp index cde9a070516..e66e17123f4 100644 --- a/interfaces/native/native_interface_xcomponent.cpp +++ b/interfaces/native/native_interface_xcomponent.cpp @@ -266,7 +266,7 @@ int32_t OH_NativeXComponent_UnregisterOnFrameCallback(OH_NativeXComponent* compo int32_t OH_NativeXComponent_AttachNativeRootNode( OH_NativeXComponent* component, ArkUI_NodeHandle root) { - if ((component == nullptr) || (root == nullptr)) { + if ((component == nullptr) || (root == nullptr) || !OHOS::Ace::NodeModel::CheckIsCNode(root)) { return OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER; } return component->AttachNativeRootNode(root->uiNodeHandle); @@ -275,7 +275,7 @@ int32_t OH_NativeXComponent_AttachNativeRootNode( int32_t OH_NativeXComponent_DetachNativeRootNode( OH_NativeXComponent* component, ArkUI_NodeHandle root) { - if ((component == nullptr) || (root == nullptr)) { + if ((component == nullptr) || (root == nullptr) || !OHOS::Ace::NodeModel::CheckIsCNode(root)) { return OH_NATIVEXCOMPONENT_RESULT_BAD_PARAMETER; } return component->DetachNativeRootNode(root->uiNodeHandle); diff --git a/interfaces/native/native_type.h b/interfaces/native/native_type.h index 7f0bc26204d..c7bfa920729 100644 --- a/interfaces/native/native_type.h +++ b/interfaces/native/native_type.h @@ -198,14 +198,14 @@ typedef struct ArkUI_ListChildrenMainSize ArkUI_ListChildrenMainSize; * * @since 14 */ -struct ArkUI_CustomProperty; +typedef struct ArkUI_CustomProperty ArkUI_CustomProperty; /** * @brief Define ActiveChildenInfo class information. * * @since 14 */ -struct ArkUI_ActiveChildrenInfo; +typedef struct ArkUI_ActiveChildrenInfo ArkUI_ActiveChildrenInfo; /** * @brief Provides the number types of ArkUI in the native code. diff --git a/interfaces/native/node/animate_impl.cpp b/interfaces/native/node/animate_impl.cpp index efa5a0d11d8..ba6955bd0e0 100644 --- a/interfaces/native/node/animate_impl.cpp +++ b/interfaces/native/node/animate_impl.cpp @@ -24,7 +24,7 @@ namespace OHOS::Ace::AnimateModel { int32_t AnimateTo(ArkUI_ContextHandle context, ArkUI_AnimateOption* option, ArkUI_ContextCallback* update, ArkUI_AnimateCompleteCallback* complete) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !context || !option || !update || !update->callback) { return ERROR_CODE_PARAM_INVALID; } @@ -65,7 +65,7 @@ int32_t AnimateTo(ArkUI_ContextHandle context, ArkUI_AnimateOption* option, ArkU int32_t KeyframeAnimateTo(ArkUI_ContextHandle context, ArkUI_KeyframeAnimateOption* option) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !context || !option || option->keyframes.size() == 0) { return ERROR_CODE_PARAM_INVALID; } @@ -158,7 +158,7 @@ ArkUIAnimatorOption* ConvertAnimatorOption(ArkUI_AnimatorOption* option) ArkUI_AnimatorHandle CreateAnimator(ArkUI_ContextHandle context, ArkUI_AnimatorOption* option) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !context || !option) { return nullptr; } @@ -171,7 +171,7 @@ ArkUI_AnimatorHandle CreateAnimator(ArkUI_ContextHandle context, ArkUI_AnimatorO void DisposeAnimator(ArkUI_AnimatorHandle animatorHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!animatorHandle || !animatorHandle->animator) { return; } @@ -190,7 +190,7 @@ void DisposeAnimator(ArkUI_AnimatorHandle animatorHandle) int32_t AnimatorReset(ArkUI_AnimatorHandle animatorHandle, ArkUI_AnimatorOption* option) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !animatorHandle || !animatorHandle->animator || !option) { return ERROR_CODE_PARAM_INVALID; } @@ -212,7 +212,7 @@ int32_t AnimatorReset(ArkUI_AnimatorHandle animatorHandle, ArkUI_AnimatorOption* int32_t AnimatorPlay(ArkUI_AnimatorHandle animatorHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !animatorHandle || !animatorHandle->animator) { return ERROR_CODE_PARAM_INVALID; } @@ -222,7 +222,7 @@ int32_t AnimatorPlay(ArkUI_AnimatorHandle animatorHandle) int32_t AnimatorFinish(ArkUI_AnimatorHandle animatorHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !animatorHandle || !animatorHandle->animator) { return ERROR_CODE_PARAM_INVALID; } @@ -232,7 +232,7 @@ int32_t AnimatorFinish(ArkUI_AnimatorHandle animatorHandle) int32_t AnimatorPause(ArkUI_AnimatorHandle animatorHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !animatorHandle || !animatorHandle->animator) { return ERROR_CODE_PARAM_INVALID; } @@ -242,7 +242,7 @@ int32_t AnimatorPause(ArkUI_AnimatorHandle animatorHandle) int32_t AnimatorCancel(ArkUI_AnimatorHandle animatorHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !animatorHandle || !animatorHandle->animator) { return ERROR_CODE_PARAM_INVALID; } @@ -252,7 +252,7 @@ int32_t AnimatorCancel(ArkUI_AnimatorHandle animatorHandle) int32_t AnimatorReverse(ArkUI_AnimatorHandle animatorHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !animatorHandle || !animatorHandle->animator) { return ERROR_CODE_PARAM_INVALID; } @@ -262,7 +262,7 @@ int32_t AnimatorReverse(ArkUI_AnimatorHandle animatorHandle) ArkUI_CurveHandle InitCurve(ArkUI_AnimationCurve animationCurve) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -273,7 +273,7 @@ ArkUI_CurveHandle InitCurve(ArkUI_AnimationCurve animationCurve) ArkUI_CurveHandle StepsCurve(int32_t count, bool end) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || count < 1) { return nullptr; } @@ -284,7 +284,7 @@ ArkUI_CurveHandle StepsCurve(int32_t count, bool end) ArkUI_CurveHandle CubicBezierCurve(float x1, float y1, float x2, float y2) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -297,7 +297,7 @@ ArkUI_CurveHandle CubicBezierCurve(float x1, float y1, float x2, float y2) ArkUI_CurveHandle SpringCurve(float velocity, float mass, float stiffness, float damping) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -317,7 +317,7 @@ ArkUI_CurveHandle SpringCurve(float velocity, float mass, float stiffness, float ArkUI_CurveHandle SpringMotion(float response, float dampingFraction, float overlapDuration) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -340,7 +340,7 @@ ArkUI_CurveHandle SpringMotion(float response, float dampingFraction, float over ArkUI_CurveHandle ResponsiveSpringMotion(float response, float dampingFraction, float overlapDuration) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -363,7 +363,7 @@ ArkUI_CurveHandle ResponsiveSpringMotion(float response, float dampingFraction, ArkUI_CurveHandle InterpolatingSpring(float velocity, float mass, float stiffness, float damping) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -383,7 +383,7 @@ ArkUI_CurveHandle InterpolatingSpring(float velocity, float mass, float stiffnes ArkUI_CurveHandle CustomCurve(void* userData, float (*interpolate)(float fraction, void* userdata)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -394,7 +394,7 @@ ArkUI_CurveHandle CustomCurve(void* userData, float (*interpolate)(float fractio void DisposeCurve(ArkUI_CurveHandle curveHandle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !curveHandle) { return; } diff --git a/interfaces/native/node/dialog_model.cpp b/interfaces/native/node/dialog_model.cpp index 30ecfd35b36..b04dcfde8d4 100644 --- a/interfaces/native/node/dialog_model.cpp +++ b/interfaces/native/node/dialog_model.cpp @@ -21,7 +21,7 @@ namespace OHOS::Ace::DialogModel { ArkUI_NativeDialogHandle Create() { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl) { return nullptr; } @@ -31,7 +31,7 @@ ArkUI_NativeDialogHandle Create() void Dispose(ArkUI_NativeDialogHandle handle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return; } @@ -42,7 +42,7 @@ void Dispose(ArkUI_NativeDialogHandle handle) int32_t SetContent(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle || !content) { return ERROR_CODE_PARAM_INVALID; } @@ -51,7 +51,7 @@ int32_t SetContent(ArkUI_NativeDialogHandle handle, ArkUI_NodeHandle content) int32_t RemoveContent(ArkUI_NativeDialogHandle handle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -60,7 +60,7 @@ int32_t RemoveContent(ArkUI_NativeDialogHandle handle) int32_t SetContentAlignment(ArkUI_NativeDialogHandle handle, int32_t alignment, float offsetX, float offsetY) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -70,7 +70,7 @@ int32_t SetContentAlignment(ArkUI_NativeDialogHandle handle, int32_t alignment, int32_t ResetContentAlignment(ArkUI_NativeDialogHandle handle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -79,7 +79,7 @@ int32_t ResetContentAlignment(ArkUI_NativeDialogHandle handle) int32_t SetModalMode(ArkUI_NativeDialogHandle handle, bool isModal) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -88,7 +88,7 @@ int32_t SetModalMode(ArkUI_NativeDialogHandle handle, bool isModal) int32_t SetAutoCancel(ArkUI_NativeDialogHandle handle, bool autoCancel) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -97,7 +97,7 @@ int32_t SetAutoCancel(ArkUI_NativeDialogHandle handle, bool autoCancel) int32_t SetMask(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI_Rect* maskRect) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -111,7 +111,7 @@ int32_t SetMask(ArkUI_NativeDialogHandle handle, uint32_t maskColor, const ArkUI int32_t SetBackgroundColor(ArkUI_NativeDialogHandle handle, uint32_t backgroundColor) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -121,7 +121,7 @@ int32_t SetBackgroundColor(ArkUI_NativeDialogHandle handle, uint32_t backgroundC int32_t SetCornerRadius(ArkUI_NativeDialogHandle handle, float topLeft, float topRight, float bottomLeft, float bottomRight) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -131,7 +131,7 @@ int32_t SetCornerRadius(ArkUI_NativeDialogHandle handle, float topLeft, float to int32_t SetGridColumnCount(ArkUI_NativeDialogHandle handle, int32_t gridCount) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -140,7 +140,7 @@ int32_t SetGridColumnCount(ArkUI_NativeDialogHandle handle, int32_t gridCount) int32_t EnableCustomStyle(ArkUI_NativeDialogHandle handle, bool enableCustomStyle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -149,7 +149,7 @@ int32_t EnableCustomStyle(ArkUI_NativeDialogHandle handle, bool enableCustomStyl int32_t EnableCustomAnimation(ArkUI_NativeDialogHandle handle, bool enableCustomAnimation) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -158,7 +158,7 @@ int32_t EnableCustomAnimation(ArkUI_NativeDialogHandle handle, bool enableCustom int32_t Show(ArkUI_NativeDialogHandle handle, bool showInSubWindow) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -167,7 +167,7 @@ int32_t Show(ArkUI_NativeDialogHandle handle, bool showInSubWindow) int32_t Close(ArkUI_NativeDialogHandle handle) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -176,7 +176,7 @@ int32_t Close(ArkUI_NativeDialogHandle handle) int32_t RegisterOnWillDismiss(ArkUI_NativeDialogHandle handle, ArkUI_OnWillDismissEvent eventHandler) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } @@ -186,7 +186,7 @@ int32_t RegisterOnWillDismiss(ArkUI_NativeDialogHandle handle, ArkUI_OnWillDismi int32_t RegisterOnWillDismissWithUserData( ArkUI_NativeDialogHandle handle, void* userData, void (*callback)(ArkUI_DialogDismissEvent* event)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !handle) { return ERROR_CODE_PARAM_INVALID; } diff --git a/interfaces/native/node/native_node_napi.cpp b/interfaces/native/node/native_node_napi.cpp index b62c25e8a2a..02eb053db68 100644 --- a/interfaces/native/node/native_node_napi.cpp +++ b/interfaces/native/node/native_node_napi.cpp @@ -28,7 +28,7 @@ int32_t OH_ArkUI_GetNodeHandleFromNapiValue(napi_env env, napi_value value, ArkU { bool hasProperty = false; auto result = napi_has_named_property(env, value, "nodePtr_", &hasProperty); - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (result == napi_ok && hasProperty) { napi_value frameNodePtr = nullptr; auto result = napi_get_named_property(env, value, "nodePtr_", &frameNodePtr); diff --git a/interfaces/native/node/node_animate.cpp b/interfaces/native/node/node_animate.cpp index e62214c8b5c..aac45f717dd 100644 --- a/interfaces/native/node/node_animate.cpp +++ b/interfaces/native/node/node_animate.cpp @@ -575,7 +575,7 @@ float OH_ArkUI_AnimatorOnFrameEvent_GetValue(ArkUI_AnimatorOnFrameEvent* event) int32_t OH_ArkUI_AnimatorOption_RegisterOnFrameCallback( ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorOnFrameEvent* event)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !option || !callback) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } @@ -587,7 +587,7 @@ int32_t OH_ArkUI_AnimatorOption_RegisterOnFrameCallback( int32_t OH_ArkUI_AnimatorOption_RegisterOnFinishCallback( ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !option || !callback) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } @@ -600,7 +600,7 @@ int32_t OH_ArkUI_AnimatorOption_RegisterOnFinishCallback( int32_t OH_ArkUI_AnimatorOption_RegisterOnCancelCallback( ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !option || !callback) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } @@ -613,7 +613,7 @@ int32_t OH_ArkUI_AnimatorOption_RegisterOnCancelCallback( int32_t OH_ArkUI_AnimatorOption_RegisterOnRepeatCallback( ArkUI_AnimatorOption* option, void* userData, void (*callback)(ArkUI_AnimatorEvent* event)) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); if (!impl || !option || !callback) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } diff --git a/interfaces/native/node/node_extened.cpp b/interfaces/native/node/node_extened.cpp index f03091490ea..9801db5e0e4 100644 --- a/interfaces/native/node/node_extened.cpp +++ b/interfaces/native/node/node_extened.cpp @@ -86,7 +86,7 @@ int32_t RegisterNodeCustomEvent(ArkUI_NodeHandle node, ArkUI_NodeCustomEventType if (eventType & ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW) { NodeAddExtraData(node, ARKUI_NODE_CUSTOM_EVENT_ON_OVERLAY_DRAW, targetId, userData); } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); if (node->type == ARKUI_NODE_CUSTOM_SPAN) { impl->getExtendedAPI()->registerCustomSpanAsyncEvent( node->uiNodeHandle, eventType, reinterpret_cast(node)); @@ -118,7 +118,7 @@ void UnregisterNodeCustomEvent(ArkUI_NodeHandle node, ArkUI_NodeCustomEventType if (node == nullptr || !node->extraCustomData || !CheckIsCNode(node)) { return; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto resultValue = impl->getExtendedAPI()->unregisterCustomNodeAsyncEvent(node->uiNodeHandle, eventType); if (resultValue == -1) { @@ -243,7 +243,7 @@ int32_t SetMeasuredSize(ArkUI_NodeHandle node, int32_t width, int32_t height) if (node == nullptr || !CheckIsCNode(node)) { return ERROR_CODE_PARAM_INVALID; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getExtendedAPI()->setMeasureWidth(node->uiNodeHandle, width > 0 ? width : 0); impl->getExtendedAPI()->setMeasureHeight(node->uiNodeHandle, height > 0 ? height : 0); return ERROR_CODE_NO_ERROR; @@ -254,7 +254,7 @@ int32_t SetLayoutPosition(ArkUI_NodeHandle node, int32_t positionX, int32_t posi if (node == nullptr || !CheckIsCNode(node)) { return ERROR_CODE_PARAM_INVALID; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getExtendedAPI()->setX(node->uiNodeHandle, positionX); impl->getExtendedAPI()->setY(node->uiNodeHandle, positionY); return ERROR_CODE_NO_ERROR; @@ -265,7 +265,7 @@ int32_t GetLayoutConstraint(ArkUI_NodeHandle node, ArkUI_LayoutConstraint* layou if (node == nullptr || layoutConstraint == nullptr || !CheckIsCNode(node)) { return ERROR_CODE_PARAM_INVALID; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); // data size ArkUI_Int32 data[6]; impl->getExtendedAPI()->getLayoutConstraint(node->uiNodeHandle, data); @@ -290,7 +290,7 @@ ArkUI_IntSize GetMeasuredSize(ArkUI_NodeHandle node) if (node == nullptr) { return size; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); size.width = impl->getExtendedAPI()->getMeasureWidth(node->uiNodeHandle); size.height = impl->getExtendedAPI()->getMeasureHeight(node->uiNodeHandle); return size; @@ -302,7 +302,7 @@ ArkUI_IntOffset GetLayoutPosition(ArkUI_NodeHandle node) if (node == nullptr) { return offset; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); offset.x = impl->getExtendedAPI()->getX(node->uiNodeHandle); offset.y = impl->getExtendedAPI()->getY(node->uiNodeHandle); return offset; @@ -313,7 +313,7 @@ int32_t MeasureNode(ArkUI_NodeHandle node, ArkUI_LayoutConstraint* constraint) if (node == nullptr || constraint == nullptr || !CheckIsCNode(node)) { return ERROR_CODE_PARAM_INVALID; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); // data size ArkUI_Float32 data[6]; //minWidth @@ -337,7 +337,7 @@ int32_t LayoutNode(ArkUI_NodeHandle node, int32_t positionX, int32_t positionY) if (node == nullptr || !CheckIsCNode(node)) { return ERROR_CODE_PARAM_INVALID; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); //layout data size float data[2]; //positionX @@ -353,7 +353,7 @@ uint32_t GetTotalChildCount(ArkUI_NodeHandle node) if (node == nullptr) { return 0; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); return impl->getNodeModifiers()->getFrameNodeModifier()->getChildrenCount(node->uiNodeHandle, true); } @@ -375,7 +375,7 @@ ArkUI_NodeHandle GetChildAt(ArkUI_NodeHandle node, int32_t position) if (node == nullptr) { return nullptr; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* attachNode = impl->getNodeModifiers()->getFrameNodeModifier()->getChild(node->uiNodeHandle, position, true); return GetArkUINode(attachNode); } @@ -385,7 +385,7 @@ ArkUI_NodeHandle GetFirstChild(ArkUI_NodeHandle node) if (node == nullptr) { return nullptr; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* attachNode = impl->getNodeModifiers()->getFrameNodeModifier()->getFirst(node->uiNodeHandle, true); return GetArkUINode(attachNode); } @@ -395,7 +395,7 @@ ArkUI_NodeHandle GetLastChild(ArkUI_NodeHandle node) if (node == nullptr) { return nullptr; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* attachNode = impl->getNodeModifiers()->getFrameNodeModifier()->getLast(node->uiNodeHandle, true); return GetArkUINode(attachNode); } @@ -405,7 +405,7 @@ ArkUI_NodeHandle GetPreviousSibling(ArkUI_NodeHandle node) if (node == nullptr) { return nullptr; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* attachNode = impl->getNodeModifiers()->getFrameNodeModifier()->getPreviousSibling(node->uiNodeHandle, true); return GetArkUINode(attachNode); } @@ -415,7 +415,7 @@ ArkUI_NodeHandle GetNextSibling(ArkUI_NodeHandle node) if (node == nullptr) { return nullptr; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* attachNode = impl->getNodeModifiers()->getFrameNodeModifier()->getNextSibling(node->uiNodeHandle, true); return GetArkUINode(attachNode); } @@ -425,7 +425,7 @@ ArkUI_NodeHandle GetParent(ArkUI_NodeHandle node) if (node == nullptr) { return nullptr; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* value = impl->getNodeModifiers()->getFrameNodeModifier()->getParent(node->uiNodeHandle); void* attachNode = impl->getExtendedAPI()->getAttachNodePtr(value); if (attachNode) { @@ -437,7 +437,7 @@ ArkUI_NodeHandle GetParent(ArkUI_NodeHandle node) int32_t RemoveAllChildren(ArkUI_NodeHandle parentNode) { CHECK_NULL_RETURN(parentNode, ERROR_CODE_PARAM_INVALID); - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->clearChildren(parentNode->uiNodeHandle); return ERROR_CODE_NO_ERROR; } diff --git a/interfaces/native/node/node_model.cpp b/interfaces/native/node/node_model.cpp index 7ae4d2f34e8..03dd580e3a4 100644 --- a/interfaces/native/node/node_model.cpp +++ b/interfaces/native/node/node_model.cpp @@ -144,7 +144,7 @@ ArkUI_NodeHandle CreateNode(ArkUI_NodeType type) ARKUI_CUSTOM_SPAN }; // already check in entry point. uint32_t nodeType = type < MAX_NODE_SCOPE_NUM ? type : (type - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM); - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); if (nodeType >= sizeof(nodes) / sizeof(ArkUINodeType)) { TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "node type: %{public}d NOT IMPLEMENT", type); return nullptr; @@ -201,7 +201,7 @@ void DisposeNode(ArkUI_NodeHandle nativePtr) return; } // already check in entry point. - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->disposeNode(nativePtr->uiNodeHandle); DisposeNativeSource(nativePtr); g_nodeSet.erase(nativePtr); @@ -220,7 +220,7 @@ int32_t AddChild(ArkUI_NodeHandle parentNode, ArkUI_NodeHandle childNode) if (parentNode->type == -1) { return ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); // already check in entry point. impl->getBasicAPI()->addChild(parentNode->uiNodeHandle, childNode->uiNodeHandle); impl->getBasicAPI()->markDirty(parentNode->uiNodeHandle, ARKUI_DIRTY_FLAG_MEASURE_BY_CHILD_REQUEST); @@ -238,7 +238,7 @@ int32_t RemoveChild(ArkUI_NodeHandle parentNode, ArkUI_NodeHandle childNode) if (parentNode->type == -1) { return ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->removeChild(parentNode->uiNodeHandle, childNode->uiNodeHandle); impl->getBasicAPI()->markDirty(parentNode->uiNodeHandle, ARKUI_DIRTY_FLAG_MEASURE_BY_CHILD_REQUEST); return ERROR_CODE_NO_ERROR; @@ -255,7 +255,7 @@ int32_t InsertChildAfter(ArkUI_NodeHandle parentNode, ArkUI_NodeHandle childNode if (parentNode->type == -1) { return ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->insertChildAfter( parentNode->uiNodeHandle, childNode->uiNodeHandle, siblingNode ? siblingNode->uiNodeHandle : nullptr); impl->getBasicAPI()->markDirty(parentNode->uiNodeHandle, ARKUI_DIRTY_FLAG_MEASURE_BY_CHILD_REQUEST); @@ -273,7 +273,7 @@ int32_t InsertChildBefore(ArkUI_NodeHandle parentNode, ArkUI_NodeHandle childNod if (parentNode->type == -1) { return ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->insertChildBefore( parentNode->uiNodeHandle, childNode->uiNodeHandle, siblingNode ? siblingNode->uiNodeHandle : nullptr); impl->getBasicAPI()->markDirty(parentNode->uiNodeHandle, ARKUI_DIRTY_FLAG_MEASURE_BY_CHILD_REQUEST); @@ -291,7 +291,7 @@ int32_t InsertChildAt(ArkUI_NodeHandle parentNode, ArkUI_NodeHandle childNode, i if (parentNode->type == -1) { return ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->insertChildAt(parentNode->uiNodeHandle, childNode->uiNodeHandle, position); impl->getBasicAPI()->markDirty(parentNode->uiNodeHandle, ARKUI_DIRTY_FLAG_MEASURE_BY_CHILD_REQUEST); return ERROR_CODE_NO_ERROR; @@ -351,7 +351,7 @@ int32_t RegisterNodeEvent(ArkUI_NodeHandle nodePtr, ArkUI_NodeEventType eventTyp if (nodePtr->type == -1) { return ERROR_CODE_NATIVE_IMPL_BUILDER_NODE_ERROR; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); auto* extraParam = new InnerEventExtraParam({ targetId, nodePtr, userData }); if (nodePtr->extraData) { auto* extraData = reinterpret_cast(nodePtr->extraData); @@ -637,7 +637,7 @@ void ApplyModifierFinish(ArkUI_NodeHandle nodePtr) if (!nodePtr) { return; } - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->applyModifierFinish(nodePtr->uiNodeHandle); } @@ -666,7 +666,7 @@ void MarkDirty(ArkUI_NodeHandle nodePtr, ArkUI_NodeDirtyFlag dirtyFlag) } } // already check in entry point. - auto* impl = GetFullImpl(); + const auto* impl = GetFullImpl(); impl->getBasicAPI()->markDirty(nodePtr->uiNodeHandle, flag); } @@ -735,7 +735,7 @@ extern "C" { int32_t OH_ArkUI_NodeContent_AddNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); CHECK_NULL_RETURN(impl, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_LIBRARY_NOT_FOUND); CHECK_NULL_RETURN(node, OHOS::Ace::ERROR_CODE_PARAM_INVALID); return impl->getNodeModifiers()->getNodeContentModifier()->addChild( @@ -744,7 +744,7 @@ int32_t OH_ArkUI_NodeContent_AddNode(ArkUI_NodeContentHandle content, ArkUI_Node int32_t OH_ArkUI_NodeContent_InsertNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node, int32_t position) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); CHECK_NULL_RETURN(impl, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_LIBRARY_NOT_FOUND); CHECK_NULL_RETURN(node, OHOS::Ace::ERROR_CODE_PARAM_INVALID); return impl->getNodeModifiers()->getNodeContentModifier()->insertChild( @@ -753,7 +753,7 @@ int32_t OH_ArkUI_NodeContent_InsertNode(ArkUI_NodeContentHandle content, ArkUI_N int32_t OH_ArkUI_NodeContent_RemoveNode(ArkUI_NodeContentHandle content, ArkUI_NodeHandle node) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); CHECK_NULL_RETURN(impl, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_LIBRARY_NOT_FOUND); CHECK_NULL_RETURN(node, OHOS::Ace::ERROR_CODE_PARAM_INVALID); return impl->getNodeModifiers()->getNodeContentModifier()->removeChild( @@ -762,7 +762,7 @@ int32_t OH_ArkUI_NodeContent_RemoveNode(ArkUI_NodeContentHandle content, ArkUI_N int32_t OH_ArkUI_NodeContent_RegisterCallback(ArkUI_NodeContentHandle content, ArkUI_NodeContentCallback callback) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); CHECK_NULL_RETURN(impl, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_LIBRARY_NOT_FOUND); auto innerCallback = reinterpret_cast(callback); return impl->getNodeModifiers()->getNodeContentModifier()->registerEvent( @@ -785,7 +785,7 @@ ArkUI_NodeContentHandle OH_ArkUI_NodeContentEvent_GetNodeContentHandle(ArkUI_Nod int32_t OH_ArkUI_NodeContent_SetUserData(ArkUI_NodeContentHandle content, void* userData) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); CHECK_NULL_RETURN(impl, OHOS::Ace::ERROR_CODE_NATIVE_IMPL_LIBRARY_NOT_FOUND); return impl->getNodeModifiers()->getNodeContentModifier()->setUserData( reinterpret_cast(content), userData); @@ -793,7 +793,7 @@ int32_t OH_ArkUI_NodeContent_SetUserData(ArkUI_NodeContentHandle content, void* void* OH_ArkUI_NodeContent_GetUserData(ArkUI_NodeContentHandle content) { - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); CHECK_NULL_RETURN(impl, nullptr); return impl->getNodeModifiers()->getNodeContentModifier()->getUserData( reinterpret_cast(content)); diff --git a/interfaces/native/node/node_utils.cpp b/interfaces/native/node/node_utils.cpp index d02bef76711..bac6781a523 100644 --- a/interfaces/native/node/node_utils.cpp +++ b/interfaces/native/node/node_utils.cpp @@ -31,7 +31,7 @@ int32_t OH_ArkUI_NodeUtils_GetLayoutSize(ArkUI_NodeHandle node, ArkUI_IntSize* s if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); ArkUI_Int32* tempSize = new ArkUI_Int32[2]; impl->getNodeModifiers()->getFrameNodeModifier()->getLayoutSize(node->uiNodeHandle, tempSize); size->width = tempSize[0]; @@ -44,7 +44,7 @@ int32_t OH_ArkUI_NodeUtils_GetLayoutPosition(ArkUI_NodeHandle node, ArkUI_IntOff if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); auto value = impl->getNodeModifiers()->getFrameNodeModifier()->getLayoutPositionWithoutMargin(node->uiNodeHandle); localOffset->x = static_cast(value[0]); localOffset->y = static_cast(value[1]); @@ -57,7 +57,7 @@ int32_t OH_ArkUI_NodeUtils_GetLayoutPositionInWindow(ArkUI_NodeHandle node, ArkU if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); ArkUI_Float32 tempOffset[2]; impl->getNodeModifiers()->getFrameNodeModifier()->getPositionToWindow(node->uiNodeHandle, &tempOffset, false); globalOffset->x = tempOffset[0]; @@ -71,7 +71,7 @@ int32_t OH_ArkUI_NodeUtils_GetLayoutPositionInScreen(ArkUI_NodeHandle node, ArkU if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); ArkUI_Float32 tempOffset[2]; impl->getNodeModifiers()->getFrameNodeModifier()->getPositionToScreen(node->uiNodeHandle, &tempOffset, false); screenOffset->x = tempOffset[0]; @@ -85,7 +85,7 @@ int32_t OH_ArkUI_NodeUtils_GetPositionWithTranslateInWindow(ArkUI_NodeHandle nod if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); ArkUI_Float32 tempOffset[2]; impl->getNodeModifiers()->getFrameNodeModifier()->getPositionToWindowWithTransform( node->uiNodeHandle, &tempOffset, false); @@ -100,7 +100,7 @@ int32_t OH_ArkUI_NodeUtils_GetPositionWithTranslateInScreen(ArkUI_NodeHandle nod if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); ArkUI_Float32 tempOffset[2]; impl->getNodeModifiers()->getFrameNodeModifier()->getPositionToScreenWithTransform( node->uiNodeHandle, &tempOffset, false); @@ -116,7 +116,7 @@ int32_t OH_ArkUI_RegisterSystemColorModeChangeEvent( if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->setSystemColorModeChangeEvent( node->uiNodeHandle, userData, reinterpret_cast(onColorModeChange)); @@ -128,7 +128,7 @@ void OH_ArkUI_UnregisterSystemColorModeChangeEvent(ArkUI_NodeHandle node) if (node == nullptr) { return; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->resetSystemColorModeChangeEvent(node->uiNodeHandle); } @@ -138,7 +138,7 @@ int32_t OH_ArkUI_RegisterSystemFontStyleChangeEvent( if (node == nullptr) { return OHOS::Ace::ERROR_CODE_PARAM_INVALID; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->setSystemFontStyleChangeEvent( node->uiNodeHandle, userData, reinterpret_cast(onFontStyleChange)); @@ -150,7 +150,7 @@ void OH_ArkUI_UnregisterSystemFontStyleChangeEvent(ArkUI_NodeHandle node) if (node == nullptr) { return; } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->resetSystemFontStyleChangeEvent(node->uiNodeHandle); } @@ -173,7 +173,7 @@ void OH_ArkUI_NodeUtils_AddCustomProperty(ArkUI_NodeHandle node, const char* nam LOGF("AddCustomProperty input params name or value is nullptr"); abort(); } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->addCustomProperty(node->uiNodeHandle, name, value); } @@ -186,7 +186,7 @@ void OH_ArkUI_NodeUtils_RemoveCustomProperty(ArkUI_NodeHandle node, const char* LOGF("RemoveCustomProperty input params name is nullptr"); abort(); } - auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); + const auto* impl = OHOS::Ace::NodeModel::GetFullImpl(); impl->getNodeModifiers()->getFrameNodeModifier()->removeCustomProperty(node->uiNodeHandle, name); } @@ -225,14 +225,13 @@ int32_t OH_ArkUI_NodeUtils_GetActiveChildrenInfo(ArkUI_NodeHandle head, ArkUI_Ac uint32_t totalSize = 0; impl->getNodeModifiers()->getFrameNodeModifier()->getActiveChildrenInfo( head->uiNodeHandle, &innerNodes, &totalSize); - if (totalSize == 0) { - return ARKUI_ERROR_CODE_PARAM_INVALID; - } *handle = new ArkUI_ActiveChildrenInfo({ .nodeList = nullptr, .nodeCount = totalSize }); (*handle)->nodeCount = totalSize; - (*handle)->nodeList = new ArkUI_NodeHandle[totalSize] {}; - for (uint32_t i = 0; i < totalSize; i++) { - ((*handle)->nodeList[i]) = GetArkUINode(innerNodes[i]); + if (totalSize > 0) { + (*handle)->nodeList = new ArkUI_NodeHandle[totalSize] {}; + for (uint32_t i = 0; i < totalSize; i++) { + ((*handle)->nodeList[i]) = GetArkUINode(innerNodes[i]); + } } delete[] innerNodes; return 0; @@ -270,7 +269,7 @@ bool OH_ArkUI_NodeUtils_IsCreatedByNDK(ArkUI_NodeHandle node) int32_t OH_ArkUI_NodeUtils_GetNodeType(ArkUI_NodeHandle node) { if (node == nullptr) { - return 0; + return -1; } static const std::unordered_map nodeTypeMap = { diff --git a/test/unittest/interfaces/drag_and_drop_test.cpp b/test/unittest/interfaces/drag_and_drop_test.cpp index a5fa5738339..dd4baa23d8a 100644 --- a/test/unittest/interfaces/drag_and_drop_test.cpp +++ b/test/unittest/interfaces/drag_and_drop_test.cpp @@ -155,8 +155,8 @@ HWTEST_F(DragAndDropTest, DragAndDropTest004, TestSize.Level1) */ auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto textNode = new ArkUI_Node({ ARKUI_NODE_TEXT, nullptr }); - auto areaNode = new ArkUI_Node({ ARKUI_NODE_TEXT_AREA, nullptr }); + auto textNode = new ArkUI_Node({ ARKUI_NODE_TEXT, nullptr, true }); + auto areaNode = new ArkUI_Node({ ARKUI_NODE_TEXT_AREA, nullptr, true }); /** * @tc.expected: Return expected results. @@ -254,7 +254,7 @@ HWTEST_F(DragAndDropTest, DragAndDropTest007, TestSize.Level1) /** * @tc.steps: step1.create DragEvent, related function is called. */ - auto textNode = new ArkUI_Node({ ARKUI_NODE_TEXT, nullptr }); + auto textNode = new ArkUI_Node({ ARKUI_NODE_TEXT, nullptr, true }); auto ret1 = OH_ArkUI_SetNodeDraggable(textNode, true); /** @@ -486,7 +486,7 @@ HWTEST_F(DragAndDropTest, DragAndDropTest016, TestSize.Level1) OH_ArkUI_DragPreviewOption_SetDefaultShadowEnabled(dragPreviewOption, true); OH_ArkUI_DragPreviewOption_SetScaleMode( dragPreviewOption, ArkUI_DragPreviewScaleMode::ARKUI_DRAG_PREVIEW_SCALE_AUTO); - auto textNode = new ArkUI_Node({ ARKUI_NODE_TEXT, nullptr }); + auto textNode = new ArkUI_Node({ ARKUI_NODE_TEXT, nullptr, true }); auto ret1 = OH_ArkUI_SetNodeDragPreviewOption(textNode, dragPreviewOption); EXPECT_EQ(ret1, ARKUI_ERROR_CODE_NO_ERROR); diff --git a/test/unittest/interfaces/native_node_test.cpp b/test/unittest/interfaces/native_node_test.cpp index 5744d5b2389..6be98ba4a67 100644 --- a/test/unittest/interfaces/native_node_test.cpp +++ b/test/unittest/interfaces/native_node_test.cpp @@ -1400,7 +1400,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest008, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT, nullptr, true}); uint32_t color = 0XFFFF0000; float size = 10.0f; ArkUI_NumberValue value[] = {{.u32 = color}}; @@ -1626,7 +1626,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest010, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE_SPAN, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE_SPAN, nullptr, true}); ArkUI_NumberValue value[] = {{.i32 = ARKUI_IMAGE_SPAN_ALIGNMENT_BASELINE}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue)}; nodeAPI->setAttribute(rootNode, NODE_IMAGE_SPAN_VERTICAL_ALIGNMENT, &item); @@ -1656,7 +1656,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest011, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE, nullptr, true}); float border = 10.0f; ArkUI_NumberValue value[] = {{.f32 = border}}; @@ -1763,7 +1763,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest013, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_LOADING_PROGRESS, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_LOADING_PROGRESS, nullptr, true}); ASSERT_NE(rootNode, nullptr); uint32_t color = 0XFFFF0000; ArkUI_NumberValue value[] = {{.u32 = color}}; @@ -1791,7 +1791,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest014, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT_INPUT, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT_INPUT, nullptr, true}); uint32_t color = 0XFFFF0000; float padding = 10.0f; ArkUI_NumberValue value[] = {{.u32 = color}}; @@ -1994,7 +1994,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest015, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT_AREA, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT_AREA, nullptr, true}); uint32_t color = 0XFFFF0000; float padding = 10.0f; ArkUI_NumberValue value[] = {{.u32 = color}}; @@ -2138,7 +2138,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest016, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_BUTTON, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_BUTTON, nullptr, true}); ArkUI_NumberValue value[] = {{.f32 = 10.0f}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), "test", nullptr}; nodeAPI->setAttribute(rootNode, NODE_BUTTON_LABEL, &item); @@ -2271,7 +2271,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest020, TestSize.Level1) auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_DATE_PICKER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_DATE_PICKER, nullptr, true}); ArkUI_NumberValue value[] = {{.i32 = true}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), nullptr, nullptr}; nodeAPI->setAttribute(rootNode, NODE_DATE_PICKER_LUNAR, &item); @@ -2314,7 +2314,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest021, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_TIME_PICKER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_TIME_PICKER, nullptr, true}); ArkUI_NumberValue value[] = {{.i32 = true}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), nullptr, nullptr}; item.string = "11-59"; @@ -2347,7 +2347,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest022, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT_PICKER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT_PICKER, nullptr, true}); ArkUI_NumberValue value[] = {{.i32 = ARKUI_TEXTPICKER_RANGETYPE_SINGLE}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), nullptr, nullptr}; item.string = "1;2;3"; @@ -2398,7 +2398,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest023, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_CALENDAR_PICKER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_CALENDAR_PICKER, nullptr, true}); float offset = 10.0f; ArkUI_NumberValue value[] = {{.f32 = offset}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), nullptr, nullptr}; @@ -2637,9 +2637,9 @@ HWTEST_F(NativeNodeTest, NativeNodeTest027, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_LIST, nullptr}); - auto childNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM, nullptr}); - auto groupNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM_GROUP, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_LIST, nullptr, true}); + auto childNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM, nullptr, true}); + auto groupNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM_GROUP, nullptr, true}); float distance = 10.0f; uint32_t color = 0xFFFF0000; @@ -2747,7 +2747,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest028, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_SWIPER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_SWIPER, nullptr, true}); ArkUI_NumberValue value[] = {{.i32 = ARKUI_CURVE_LINEAR}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), nullptr, nullptr}; ArkUI_NumberValue value2[] = {{.i32 = 1}, {.i32 = 1}}; @@ -3003,7 +3003,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest032, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_REFRESH, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_REFRESH, nullptr, true}); ASSERT_NE(rootNode, nullptr); ArkUI_NumberValue value[] = {{.i32 = true}}; ArkUI_AttributeItem item = {value, sizeof(value) / sizeof(ArkUI_NumberValue), nullptr, nullptr}; @@ -3036,7 +3036,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest033, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_WATER_FLOW, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_WATER_FLOW, nullptr, true}); float distance = 10.0f; uint32_t color = 0xFFFF0000; ArkUI_NumberValue value[] = {{.f32 = distance}}; @@ -3165,7 +3165,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest035, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_RELATIVE_CONTAINER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_RELATIVE_CONTAINER, nullptr, true}); ASSERT_NE(rootNode, nullptr); auto alignRules = OH_ArkUI_AlignmentRuleOption_Create(); @@ -3360,7 +3360,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest036, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE_ANIMATOR, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE_ANIMATOR, nullptr, true}); ASSERT_NE(rootNode, nullptr); EXPECT_EQ(nodeAPI->resetAttribute(rootNode, NODE_IMAGE_ANIMATOR_IMAGES), ARKUI_ERROR_CODE_NO_ERROR); EXPECT_EQ(nodeAPI->resetAttribute(rootNode, NODE_IMAGE_ANIMATOR_STATE), ARKUI_ERROR_CODE_NO_ERROR); @@ -3389,7 +3389,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest037, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_STACK, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_STACK, nullptr, true}); float negativeFloat = -1.0f; int32_t negativeEnum = -1; uint32_t color = 0XFFFF0000; @@ -3718,7 +3718,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest038, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_TEXT, nullptr, true}); float negativeFloat = -1.0f; int32_t negativeInt = -1; ArkUI_NumberValue value[] = {{.f32 = negativeFloat}}; @@ -3788,8 +3788,8 @@ HWTEST_F(NativeNodeTest, NativeNodeTest039, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto textinput = new ArkUI_Node({ARKUI_NODE_TEXT_INPUT, nullptr}); - auto textarea = new ArkUI_Node({ARKUI_NODE_TEXT_AREA, nullptr}); + auto textinput = new ArkUI_Node({ARKUI_NODE_TEXT_INPUT, nullptr, true}); + auto textarea = new ArkUI_Node({ARKUI_NODE_TEXT_AREA, nullptr, true}); float negativeFloat = -1.0f; int32_t negativeInt = -1; ArkUI_NumberValue value[] = {{.f32 = negativeFloat}}; @@ -3957,7 +3957,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest043, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE_SPAN, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE_SPAN, nullptr, true}); int32_t negativeInt = -1; ArkUI_NumberValue value0[] = {}; ArkUI_AttributeItem item0 = {value0, 0, nullptr, nullptr}; @@ -3981,7 +3981,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest044, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_IMAGE, nullptr, true}); int32_t negativeInt = -1; ArkUI_NumberValue value0[] = {}; ArkUI_AttributeItem item0 = {value0, 0, nullptr, nullptr}; @@ -4054,7 +4054,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest047, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_BUTTON, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_BUTTON, nullptr, true}); int32_t negativeInt = -1; ArkUI_NumberValue value0[] = {}; ArkUI_AttributeItem item0 = {value0, 0, nullptr, nullptr}; @@ -4484,10 +4484,10 @@ HWTEST_F(NativeNodeTest, NativeNodeTest059, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_LIST, nullptr}); - auto childNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM, nullptr}); - auto childNodeNew = new ArkUI_Node({ARKUI_NODE_LIST_ITEM, nullptr}); - auto groupNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM_GROUP, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_LIST, nullptr, true}); + auto childNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM, nullptr, true}); + auto childNodeNew = new ArkUI_Node({ARKUI_NODE_LIST_ITEM, nullptr, true}); + auto groupNode = new ArkUI_Node({ARKUI_NODE_LIST_ITEM_GROUP, nullptr, true}); nodeAPI->insertChildAt(rootNode, groupNode, 0); nodeAPI->insertChildAfter(groupNode, childNodeNew, nullptr); @@ -4564,7 +4564,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest060, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_SWIPER, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_SWIPER, nullptr, true}); float negativeFloat = -1.0f; int32_t negativeInt = -1; ArkUI_NumberValue value0[] = {}; @@ -4845,7 +4845,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest067, TestSize.Level1) EXPECT_EQ(nodeAPI->setAttribute(nullptr, NODE_WIDTH, nullptr), ARKUI_ERROR_CODE_PARAM_INVALID); EXPECT_EQ(nodeAPI->resetAttribute(nullptr, NODE_WIDTH), ARKUI_ERROR_CODE_PARAM_INVALID); EXPECT_EQ(nodeAPI->getAttribute(nullptr, NODE_WIDTH), nullptr); - auto abnormalNode = new ArkUI_Node({-1, nullptr}); + auto abnormalNode = new ArkUI_Node({-1, nullptr, true}); EXPECT_EQ(nodeAPI->addChild(abnormalNode, abnormalNode), ARKUI_ERROR_CODE_NOT_SUPPROTED_FOR_ARKTS_NODE); EXPECT_EQ(nodeAPI->removeChild(abnormalNode, abnormalNode), ARKUI_ERROR_CODE_NOT_SUPPROTED_FOR_ARKTS_NODE); EXPECT_EQ(nodeAPI->insertChildAfter(abnormalNode, abnormalNode, nullptr), @@ -5215,7 +5215,7 @@ HWTEST_F(NativeNodeTest, NativeNodeTest080, TestSize.Level1) { auto nodeAPI = reinterpret_cast( OH_ArkUI_QueryModuleInterfaceByName(ARKUI_NATIVE_NODE, "ArkUI_NativeNodeAPI_1")); - auto rootNode = new ArkUI_Node({ARKUI_NODE_CUSTOM_SPAN, nullptr}); + auto rootNode = new ArkUI_Node({ARKUI_NODE_CUSTOM_SPAN, nullptr, true}); EXPECT_EQ(nodeAPI->registerNodeCustomEvent( rootNode, ARKUI_NODE_CUSTOM_EVENT_ON_MEASURE, 0, nullptr), ARKUI_ERROR_CODE_NO_ERROR);