NDK c-api fix some tod problems

Signed-off-by: liyi0309<liyi58@huawei.com>

Change-Id: If1fe41b122a4f0bebb06e5ad4477d422882f46fc
This commit is contained in:
firminly 2024-05-24 10:21:47 +08:00
parent 028cb06d86
commit 10ec6344be
7 changed files with 71 additions and 19 deletions

View File

@ -2569,8 +2569,8 @@ void ViewAbstract::SetPositionEdges(FrameNode* frameNode, const EdgesParam& valu
void ViewAbstract::ResetPosition(FrameNode* frameNode) void ViewAbstract::ResetPosition(FrameNode* frameNode)
{ {
ACE_RESET_RENDER_CONTEXT(RenderContext, Position); ACE_RESET_NODE_RENDER_CONTEXT(RenderContext, Position, frameNode);
ACE_RESET_RENDER_CONTEXT(RenderContext, PositionEdges); ACE_RESET_NODE_RENDER_CONTEXT(RenderContext, PositionEdges, frameNode);
CHECK_NULL_VOID(frameNode); CHECK_NULL_VOID(frameNode);
auto parentNode = frameNode->GetAncestorNodeOfFrame(); auto parentNode = frameNode->GetAncestorNodeOfFrame();
CHECK_NULL_VOID(parentNode); CHECK_NULL_VOID(parentNode);

View File

@ -1350,7 +1350,7 @@ struct ArkUICommonModifier {
ArkUIAnchorType (*getMarkAnchor)(ArkUINodeHandle node); ArkUIAnchorType (*getMarkAnchor)(ArkUINodeHandle node);
void (*getAlignRules)(ArkUINodeHandle node, ArkUI_CharPtr* anchors, ArkUI_Int32* direction, ArkUI_Int32 length); void (*getAlignRules)(ArkUINodeHandle node, ArkUI_CharPtr* anchors, ArkUI_Int32* direction, ArkUI_Int32 length);
ArkUIBlurStyleOptionType (*getBackgroundBlurStyle)(ArkUINodeHandle node); ArkUIBlurStyleOptionType (*getBackgroundBlurStyle)(ArkUINodeHandle node);
ArkUIImageSizeType (*getBackgroundImageSize)(ArkUINodeHandle node); ArkUIImageSizeType (*getBackgroundImageSize)(ArkUINodeHandle node, ArkUI_Int32 unit);
ArkUI_Int32 (*getBackgroundImageSizeWithStyle)(ArkUINodeHandle node); ArkUI_Int32 (*getBackgroundImageSizeWithStyle)(ArkUINodeHandle node);
void (*setOutlineWidthFloat)(ArkUINodeHandle node, ArkUI_Float32 left, ArkUI_Float32 top, void (*setOutlineWidthFloat)(ArkUINodeHandle node, ArkUI_Float32 left, ArkUI_Float32 top,
ArkUI_Float32 right, ArkUI_Float32 bottom); ArkUI_Float32 right, ArkUI_Float32 bottom);

View File

@ -853,7 +853,7 @@ void ResetPosition(ArkUINodeHandle node)
{ {
auto* frameNode = reinterpret_cast<FrameNode*>(node); auto* frameNode = reinterpret_cast<FrameNode*>(node);
CHECK_NULL_VOID(frameNode); CHECK_NULL_VOID(frameNode);
ViewAbstract::SetPosition(frameNode, { 0.0_vp, 0.0_vp }); ViewAbstract::ResetPosition(frameNode);
} }
bool ParseEdges(OHOS::Ace::EdgesParam& edges, const ArkUIStringAndFloat* options) bool ParseEdges(OHOS::Ace::EdgesParam& edges, const ArkUIStringAndFloat* options)
@ -1890,7 +1890,7 @@ void SetBackgroundImageSize(ArkUINodeHandle node, ArkUI_Float32 valueWidth, ArkU
ViewAbstract::SetBackgroundImageSize(frameNode, bgImgSize); ViewAbstract::SetBackgroundImageSize(frameNode, bgImgSize);
} }
ArkUIImageSizeType GetBackgroundImageSize(ArkUINodeHandle node) ArkUIImageSizeType GetBackgroundImageSize(ArkUINodeHandle node, ArkUI_Int32 unit)
{ {
ArkUIImageSizeType imageSizeType = { 0, 0, 0, 0 }; ArkUIImageSizeType imageSizeType = { 0, 0, 0, 0 };
auto* frameNode = reinterpret_cast<FrameNode*>(node); auto* frameNode = reinterpret_cast<FrameNode*>(node);
@ -1899,9 +1899,10 @@ ArkUIImageSizeType GetBackgroundImageSize(ArkUINodeHandle node)
CHECK_NULL_RETURN(renderContext, imageSizeType); CHECK_NULL_RETURN(renderContext, imageSizeType);
CHECK_NULL_RETURN(renderContext->GetBackground(), imageSizeType); CHECK_NULL_RETURN(renderContext->GetBackground(), imageSizeType);
auto imageSize = renderContext->GetBackground()->GetBackgroundImageSize(); auto imageSize = renderContext->GetBackground()->GetBackgroundImageSize();
double density = unit == static_cast<ArkUI_Int32>(DimensionUnit::PX) ? 1 : PipelineBase::GetCurrentDensity();
CHECK_NULL_RETURN(imageSize, imageSizeType); CHECK_NULL_RETURN(imageSize, imageSizeType);
imageSizeType.xValue = imageSize->GetSizeValueX(); imageSizeType.xValue = imageSize->GetSizeValueX() / density;
imageSizeType.yValue = imageSize->GetSizeValueY(); imageSizeType.yValue = imageSize->GetSizeValueY() / density;
imageSizeType.xType = static_cast<int32_t>(imageSize->GetSizeTypeX()); imageSizeType.xType = static_cast<int32_t>(imageSize->GetSizeTypeX());
imageSizeType.yType = static_cast<int32_t>(imageSize->GetSizeTypeY()); imageSizeType.yType = static_cast<int32_t>(imageSize->GetSizeTypeY());
return imageSizeType; return imageSizeType;

View File

@ -424,6 +424,9 @@ ArkUI_Int32 GetTextPickerSelectedSize(ArkUINodeHandle node)
{ {
auto* frameNode = reinterpret_cast<FrameNode*>(node); auto* frameNode = reinterpret_cast<FrameNode*>(node);
CHECK_NULL_RETURN(frameNode, 0); CHECK_NULL_RETURN(frameNode, 0);
if (TextPickerModelNG::IsSingle(frameNode)) {
return 1;
}
return TextPickerModelNG::GetSelectedSize(frameNode); return TextPickerModelNG::GetSelectedSize(frameNode);
} }

View File

@ -21,6 +21,7 @@
#include "core/interfaces/arkoala/arkoala_api.h" #include "core/interfaces/arkoala/arkoala_api.h"
#include "core/interfaces/native/node/node_api.h" #include "core/interfaces/native/node/node_api.h"
#include "core/pipeline/base/element_register.h" #include "core/pipeline/base/element_register.h"
#include "core/pipeline_ng/pipeline_context.h"
namespace OHOS::Ace::NG { namespace OHOS::Ace::NG {
const int32_t ERROR_UINT_CODE = -1; const int32_t ERROR_UINT_CODE = -1;
@ -84,9 +85,11 @@ void ResetToggleSwitchPointColor(ArkUINodeHandle node)
{ {
auto* frameNode = reinterpret_cast<FrameNode*>(node); auto* frameNode = reinterpret_cast<FrameNode*>(node);
CHECK_NULL_VOID(frameNode); CHECK_NULL_VOID(frameNode);
auto pipeline = PipelineBase::GetCurrentContext(); auto context = frameNode->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(context);
auto theme = pipeline->GetTheme<SwitchTheme>(); auto themeManager = context->GetThemeManager();
CHECK_NULL_VOID(themeManager);
auto theme = themeManager->GetTheme<SwitchTheme>();
Color color; Color color;
if (theme) { if (theme) {
color = theme->GetPointColor(); color = theme->GetPointColor();
@ -279,9 +282,11 @@ void ResetToggleUnselectedColor(ArkUINodeHandle node)
{ {
auto* frameNode = reinterpret_cast<FrameNode*>(node); auto* frameNode = reinterpret_cast<FrameNode*>(node);
CHECK_NULL_VOID(frameNode); CHECK_NULL_VOID(frameNode);
auto pipeline = PipelineBase::GetCurrentContext(); auto context = frameNode->GetContext();
CHECK_NULL_VOID(pipeline); CHECK_NULL_VOID(context);
auto switchTheme = pipeline->GetTheme<SwitchTheme>(); auto themeManager = context->GetThemeManager();
CHECK_NULL_VOID(themeManager);
auto switchTheme = themeManager->GetTheme<SwitchTheme>();
CHECK_NULL_VOID(switchTheme); CHECK_NULL_VOID(switchTheme);
Color unselectedColor; Color unselectedColor;
if (switchTheme) { if (switchTheme) {

View File

@ -78,6 +78,7 @@ ArkUIAPICallbackMethod* callbacks = nullptr;
void* createTextNode(ArkUI_Int32 nodeId) void* createTextNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = TextModelNG::CreateFrameNode(nodeId, ""); auto frameNode = TextModelNG::CreateFrameNode(nodeId, "");
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -85,6 +86,7 @@ void* createTextNode(ArkUI_Int32 nodeId)
void* createSpanNode(ArkUI_Int32 nodeId) void* createSpanNode(ArkUI_Int32 nodeId)
{ {
auto spanNode = SpanModelNG::CreateSpanNode(nodeId, ""); auto spanNode = SpanModelNG::CreateSpanNode(nodeId, "");
CHECK_NULL_RETURN(spanNode, nullptr);
spanNode->IncRefCount(); spanNode->IncRefCount();
return AceType::RawPtr(spanNode); return AceType::RawPtr(spanNode);
} }
@ -92,6 +94,7 @@ void* createSpanNode(ArkUI_Int32 nodeId)
void* createImageSpanNode(ArkUI_Int32 nodeId) void* createImageSpanNode(ArkUI_Int32 nodeId)
{ {
auto imageSpanNode = ImageSpanView::CreateFrameNode(nodeId); auto imageSpanNode = ImageSpanView::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(imageSpanNode, nullptr);
imageSpanNode->IncRefCount(); imageSpanNode->IncRefCount();
return AceType::RawPtr(imageSpanNode); return AceType::RawPtr(imageSpanNode);
} }
@ -99,6 +102,7 @@ void* createImageNode(ArkUI_Int32 nodeId)
{ {
RefPtr<PixelMap> pixmap = nullptr; RefPtr<PixelMap> pixmap = nullptr;
auto frameNode = ImageModelNG::CreateFrameNode(nodeId, "", pixmap, "", "", false); auto frameNode = ImageModelNG::CreateFrameNode(nodeId, "", pixmap, "", "", false);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -106,6 +110,7 @@ void* createImageNode(ArkUI_Int32 nodeId)
void* createToggleNode(ArkUI_Int32 nodeId) void* createToggleNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ToggleModelNG::CreateFrameNode(nodeId, NG::ToggleType::SWITCH, false); auto frameNode = ToggleModelNG::CreateFrameNode(nodeId, NG::ToggleType::SWITCH, false);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -113,6 +118,7 @@ void* createToggleNode(ArkUI_Int32 nodeId)
void* createLoadingProgress(ArkUI_Int32 nodeId) void* createLoadingProgress(ArkUI_Int32 nodeId)
{ {
auto frameNode = LoadingProgressModelNG::CreateFrameNode(nodeId); auto frameNode = LoadingProgressModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -120,6 +126,7 @@ void* createLoadingProgress(ArkUI_Int32 nodeId)
void* createTextInputNode(ArkUI_Int32 nodeId) void* createTextInputNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = TextFieldModelNG::CreateFrameNode(nodeId, "", "", false); auto frameNode = TextFieldModelNG::CreateFrameNode(nodeId, "", "", false);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -127,6 +134,7 @@ void* createTextInputNode(ArkUI_Int32 nodeId)
void* createStackNode(ArkUI_Int32 nodeId) void* createStackNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = StackModelNG::CreateFrameNode(nodeId); auto frameNode = StackModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -134,6 +142,7 @@ void* createStackNode(ArkUI_Int32 nodeId)
void* createScrollNode(ArkUI_Int32 nodeId) void* createScrollNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ScrollModelNG::CreateFrameNode(nodeId); auto frameNode = ScrollModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -141,6 +150,7 @@ void* createScrollNode(ArkUI_Int32 nodeId)
void* createListNode(ArkUI_Int32 nodeId) void* createListNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ListModelNG::CreateFrameNode(nodeId); auto frameNode = ListModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -148,6 +158,7 @@ void* createListNode(ArkUI_Int32 nodeId)
void* createSwiperNode(ArkUI_Int32 nodeId) void* createSwiperNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = SwiperModelNG::CreateFrameNode(nodeId); auto frameNode = SwiperModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -155,6 +166,7 @@ void* createSwiperNode(ArkUI_Int32 nodeId)
void* createTextAreaNode(ArkUI_Int32 nodeId) void* createTextAreaNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = TextFieldModelNG::CreateFrameNode(nodeId, "", "", true); auto frameNode = TextFieldModelNG::CreateFrameNode(nodeId, "", "", true);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -162,6 +174,7 @@ void* createTextAreaNode(ArkUI_Int32 nodeId)
void* createButtonNode(ArkUI_Int32 nodeId) void* createButtonNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ButtonModelNG::CreateFrameNode(nodeId); auto frameNode = ButtonModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -169,6 +182,7 @@ void* createButtonNode(ArkUI_Int32 nodeId)
void* createProgressNode(ArkUI_Int32 nodeId) void* createProgressNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ProgressModelNG::CreateFrameNode(nodeId, 0, 100, NG::ProgressType::LINEAR); auto frameNode = ProgressModelNG::CreateFrameNode(nodeId, 0, 100, NG::ProgressType::LINEAR);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -176,6 +190,7 @@ void* createProgressNode(ArkUI_Int32 nodeId)
void* createCheckBoxNode(ArkUI_Int32 nodeId) void* createCheckBoxNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = CheckBoxModelNG::CreateFrameNode(nodeId); auto frameNode = CheckBoxModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -183,14 +198,15 @@ void* createCheckBoxNode(ArkUI_Int32 nodeId)
void* createColumnNode(ArkUI_Int32 nodeId) void* createColumnNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ColumnModelNG::CreateFrameNode(nodeId); auto frameNode = ColumnModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
TAG_LOGD(AceLogTag::ACE_NATIVE_NODE, "createColumnNode: frameNode %{public}p", AceType::RawPtr(frameNode));
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
void* createRowNode(ArkUI_Int32 nodeId) void* createRowNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = RowModelNG::CreateFrameNode(nodeId); auto frameNode = RowModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -198,6 +214,7 @@ void* createRowNode(ArkUI_Int32 nodeId)
void* createFlexNode(ArkUI_Int32 nodeId) void* createFlexNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = FlexModelNG::CreateFrameNode(nodeId); auto frameNode = FlexModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -205,6 +222,7 @@ void* createFlexNode(ArkUI_Int32 nodeId)
void* createListItemNode(ArkUI_Int32 nodeId) void* createListItemNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ListItemModelNG::CreateFrameNode(nodeId); auto frameNode = ListItemModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -212,6 +230,7 @@ void* createListItemNode(ArkUI_Int32 nodeId)
void* createRefreshNode(ArkUI_Int32 nodeId) void* createRefreshNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = RefreshModelNG::CreateFrameNode(nodeId); auto frameNode = RefreshModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -235,6 +254,7 @@ void* createRootNode(ArkUI_Int32 nodeId)
void* createComponentRootNode(ArkUI_Int32 nodeId) void* createComponentRootNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = CommonViewModelNG::CreateFrameNode(nodeId); auto frameNode = CommonViewModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
TAG_LOGD(AceLogTag::ACE_NATIVE_NODE, "createComponentRootNode: frameNode %{public}p", AceType::RawPtr(frameNode)); TAG_LOGD(AceLogTag::ACE_NATIVE_NODE, "createComponentRootNode: frameNode %{public}p", AceType::RawPtr(frameNode));
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
@ -252,6 +272,7 @@ void* createXComponentNode(ArkUI_Int32 nodeId)
void* createListItemGroupNode(ArkUI_Int32 nodeId) void* createListItemGroupNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = ListItemGroupModelNG::CreateFrameNode(nodeId); auto frameNode = ListItemGroupModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -259,6 +280,7 @@ void* createListItemGroupNode(ArkUI_Int32 nodeId)
void* createSliderNode(ArkUI_Int32 nodeId) void* createSliderNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = SliderModelNG::CreateFrameNode(nodeId); auto frameNode = SliderModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -266,6 +288,7 @@ void* createSliderNode(ArkUI_Int32 nodeId)
void* createCanvasNode(ArkUI_Int32 nodeId) void* createCanvasNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = CanvasModelNG::CreateFrameNode(nodeId); auto frameNode = CanvasModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -273,6 +296,7 @@ void* createCanvasNode(ArkUI_Int32 nodeId)
void* createDatePickerNode(ArkUI_Int32 nodeId) void* createDatePickerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = DatePickerModelNG::CreateFrameNode(nodeId); auto frameNode = DatePickerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -280,6 +304,7 @@ void* createDatePickerNode(ArkUI_Int32 nodeId)
void* createTimePickerNode(ArkUI_Int32 nodeId) void* createTimePickerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = TimePickerModelNG::CreateFrameNode(nodeId); auto frameNode = TimePickerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -287,6 +312,7 @@ void* createTimePickerNode(ArkUI_Int32 nodeId)
void* createTextPickerNode(ArkUI_Int32 nodeId) void* createTextPickerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = TextPickerModelNG::CreateFrameNode(nodeId); auto frameNode = TextPickerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -294,6 +320,7 @@ void* createTextPickerNode(ArkUI_Int32 nodeId)
void* createCalendarPickerNode(ArkUI_Int32 nodeId) void* createCalendarPickerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = CalendarPickerModelNG::CreateFrameNode(nodeId); auto frameNode = CalendarPickerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -301,6 +328,7 @@ void* createCalendarPickerNode(ArkUI_Int32 nodeId)
void* createCustomNode(ArkUI_Int32 nodeId) void* createCustomNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = StackModelNG::CreateFrameNode(nodeId); auto frameNode = StackModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -308,6 +336,7 @@ void* createCustomNode(ArkUI_Int32 nodeId)
void* createWaterFlowNode(ArkUI_Int32 nodeId) void* createWaterFlowNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = WaterFlowModelNG::CreateFrameNode(nodeId); auto frameNode = WaterFlowModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -315,6 +344,7 @@ void* createWaterFlowNode(ArkUI_Int32 nodeId)
void* createFlowItemNode(ArkUI_Int32 nodeId) void* createFlowItemNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = WaterFlowItemModelNG::CreateFrameNode(nodeId); auto frameNode = WaterFlowItemModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -322,6 +352,7 @@ void* createFlowItemNode(ArkUI_Int32 nodeId)
void* createCircleNode(ArkUI_Int32 nodeId) void* createCircleNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = CircleModelNG::CreateFrameNode(nodeId); auto frameNode = CircleModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -329,12 +360,14 @@ void* createCircleNode(ArkUI_Int32 nodeId)
void* createRelativeContainerNode(ArkUI_Int32 nodeId) void* createRelativeContainerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = RelativeContainerModelNG::CreateFrameNode(nodeId); auto frameNode = RelativeContainerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
void* createGridNode(ArkUI_Int32 nodeId) void* createGridNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = GridModelNG::CreateFrameNode(nodeId); auto frameNode = GridModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -342,6 +375,7 @@ void* createGridNode(ArkUI_Int32 nodeId)
void* createGridItemNode(ArkUI_Int32 nodeId) void* createGridItemNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = GridItemModelNG::CreateFrameNode(nodeId); auto frameNode = GridItemModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -349,6 +383,7 @@ void* createGridItemNode(ArkUI_Int32 nodeId)
void* createBlankNode(ArkUI_Int32 nodeId) void* createBlankNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = BlankModelNG::CreateFrameNode(nodeId); auto frameNode = BlankModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -356,6 +391,7 @@ void* createBlankNode(ArkUI_Int32 nodeId)
void* createDividerNode(ArkUI_Int32 nodeId) void* createDividerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = DividerModelNG::CreateFrameNode(nodeId); auto frameNode = DividerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -363,6 +399,7 @@ void* createDividerNode(ArkUI_Int32 nodeId)
void* createAlphabetIndexerNode(ArkUI_Int32 nodeId) void* createAlphabetIndexerNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = IndexerModelNG::CreateFrameNode(nodeId); auto frameNode = IndexerModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -370,6 +407,7 @@ void* createAlphabetIndexerNode(ArkUI_Int32 nodeId)
void* createSearchNode(ArkUI_Int32 nodeId) void* createSearchNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = SearchModelNG::CreateFrameNode(nodeId); auto frameNode = SearchModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -377,6 +415,7 @@ void* createSearchNode(ArkUI_Int32 nodeId)
void* createGridRowNode(ArkUI_Int32 nodeId) void* createGridRowNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = GridRowModelNG::CreateFrameNode(nodeId); auto frameNode = GridRowModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -384,6 +423,7 @@ void* createGridRowNode(ArkUI_Int32 nodeId)
void* createGridColNode(ArkUI_Int32 nodeId) void* createGridColNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = GridColModelNG::CreateFrameNode(nodeId); auto frameNode = GridColModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -391,6 +431,7 @@ void* createGridColNode(ArkUI_Int32 nodeId)
void* createRadioNode(ArkUI_Int32 nodeId) void* createRadioNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = RadioModelNG::CreateFrameNode(nodeId); auto frameNode = RadioModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }
@ -398,6 +439,7 @@ void* createRadioNode(ArkUI_Int32 nodeId)
void* createSelectNode(ArkUI_Int32 nodeId) void* createSelectNode(ArkUI_Int32 nodeId)
{ {
auto frameNode = SelectModelNG::CreateFrameNode(nodeId); auto frameNode = SelectModelNG::CreateFrameNode(nodeId);
CHECK_NULL_RETURN(frameNode, nullptr);
frameNode->IncRefCount(); frameNode->IncRefCount();
return AceType::RawPtr(frameNode); return AceType::RawPtr(frameNode);
} }

View File

@ -1578,8 +1578,8 @@ int32_t SetBorderStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
auto* fullImpl = GetFullImpl(); auto* fullImpl = GetFullImpl();
int styles[ALLOW_SIZE_4] = { 0, 0, 0, 0 }; int styles[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
if (item->size == 1) { if (item->size == 1) {
if (item->value[0].f32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID || if (item->value[0].i32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID ||
item->value[0].f32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) { item->value[0].i32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) {
return ERROR_CODE_PARAM_INVALID; return ERROR_CODE_PARAM_INVALID;
} }
for (int i = 0; i < ALLOW_SIZE_4; ++i) { for (int i = 0; i < ALLOW_SIZE_4; ++i) {
@ -1587,8 +1587,8 @@ int32_t SetBorderStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
} }
} else if (item->size == ALLOW_SIZE_4) { } else if (item->size == ALLOW_SIZE_4) {
for (int i = 0; i < ALLOW_SIZE_4; ++i) { for (int i = 0; i < ALLOW_SIZE_4; ++i) {
if (item->value[i].f32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID || if (item->value[i].i32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID ||
item->value[i].f32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) { item->value[i].i32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) {
return ERROR_CODE_PARAM_INVALID; return ERROR_CODE_PARAM_INVALID;
} else { } else {
styles[i] = item->value[i].i32; styles[i] = item->value[i].i32;
@ -9670,7 +9670,8 @@ const ArkUI_AttributeItem* GetBackgroundImageSize(ArkUI_NodeHandle node)
{ {
auto fullImpl = GetFullImpl(); auto fullImpl = GetFullImpl();
auto backGroundImageSize = auto backGroundImageSize =
fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImageSize(node->uiNodeHandle); fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImageSize(
node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
g_numberValues[BACKGROUND_IMAGE_WIDTH_INDEX].f32 = backGroundImageSize.xValue; g_numberValues[BACKGROUND_IMAGE_WIDTH_INDEX].f32 = backGroundImageSize.xValue;
g_numberValues[BACKGROUND_IMAGE_HEIGHT_INDEX].f32 = backGroundImageSize.yValue; g_numberValues[BACKGROUND_IMAGE_HEIGHT_INDEX].f32 = backGroundImageSize.yValue;
g_attributeItem.size = REQUIRED_TWO_PARAM; g_attributeItem.size = REQUIRED_TWO_PARAM;