NDK c-api XTS 修复

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

Change-Id: I6b559b0febe67a5a6c8d7ca63e0264dda45b9e7a
This commit is contained in:
firminly 2024-06-17 10:43:22 +08:00
parent 88371086c9
commit b9c1c6f095
6 changed files with 41 additions and 3 deletions

View File

@ -1976,4 +1976,19 @@ void TextFieldModelNG::SetEnablePreviewText(FrameNode* frameNode, bool enablePre
CHECK_NULL_VOID(pattern);
pattern->SetSupportPreviewText(enablePreviewText);
}
PaddingProperty TextFieldModelNG::GetPadding(FrameNode* frameNode)
{
NG::PaddingProperty paddings = NG::ViewAbstract::GetPadding(frameNode);
auto textfieldPaintProperty = frameNode->GetPaintProperty<TextFieldPaintProperty>();
CHECK_NULL_RETURN(textfieldPaintProperty, paddings);
if (textfieldPaintProperty->HasPaddingByUser()) {
const auto& property = textfieldPaintProperty->GetPaddingByUserValue();
paddings.top = std::optional<CalcLength>(property.top);
paddings.right = std::optional<CalcLength>(property.right);
paddings.bottom = std::optional<CalcLength>(property.bottom);
paddings.left = std::optional<CalcLength>(property.left);
}
return paddings;
}
} // namespace OHOS::Ace::NG

View File

@ -269,6 +269,7 @@ public:
static void SetOnWillDeleteEvent(FrameNode* frameNode, std::function<bool(const DeleteValueInfo&)>&& func);
static void SetOnDidDeleteEvent(FrameNode* frameNode, std::function<void(const DeleteValueInfo&)>&& func);
static void SetEnablePreviewText(FrameNode* frameNode, bool enablePreviewText);
static PaddingProperty GetPadding(FrameNode* frameNode);
private:
void AddDragFrameNodeToManager() const;

View File

@ -2692,6 +2692,7 @@ struct ArkUITextAreaModifier {
void (*resetTextAreaOnDidDelete)(ArkUINodeHandle node);
void (*setTextAreaEnablePreviewText)(ArkUINodeHandle node, ArkUI_Uint32 value);
void (*resetTextAreaEnablePreviewText)(ArkUINodeHandle node);
void (*getTextAreaPadding)(ArkUINodeHandle node, ArkUI_Float32 (*values)[4], ArkUI_Int32 length, ArkUI_Int32 unit);
};
struct ArkUITextInputModifier {

View File

@ -538,7 +538,7 @@ ArkUI_Uint32 GetSelectColor(ArkUINodeHandle node)
auto *frameNode = reinterpret_cast<FrameNode *>(node);
CHECK_NULL_RETURN(frameNode, ERROR_UINT_CODE);
NG::Gradient gradient = SliderModelNG::GetSelectColor(frameNode);
return gradient.GetColors().at(0).GetColor().GetValue();
return gradient.GetColors().at(0).GetLinearColor().ToColor().GetValue();
}
ArkUI_Bool GetShowSteps(ArkUINodeHandle node)

View File

@ -1592,6 +1592,18 @@ void ResetTextAreaEnablePreviewText(ArkUINodeHandle node)
CHECK_NULL_VOID(frameNode);
TextFieldModelNG::SetEnablePreviewText(frameNode, DEFAULT_ENABLE_PREVIEW_TEXT_VALUE);
}
void GetTextAreaPadding(ArkUINodeHandle node, ArkUI_Float32 (*values)[4], ArkUI_Int32 length, ArkUI_Int32 unit)
{
auto* frameNode = reinterpret_cast<FrameNode*>(node);
CHECK_NULL_VOID(frameNode);
auto padding = TextFieldModelNG::GetPadding(frameNode);
(*values)[NUM_0] = padding.top->GetDimensionContainsNegative().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_1] = padding.right->GetDimensionContainsNegative().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_2] = padding.bottom->GetDimensionContainsNegative().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_3] = padding.left->GetDimensionContainsNegative().GetNativeValue(static_cast<DimensionUnit>(unit));
length = NUM_4;
}
} // namespace
namespace NodeModifier {
@ -1639,7 +1651,7 @@ const ArkUITextAreaModifier* GetTextAreaModifier()
SetTextAreaOnDidInsert, ResetTextAreaOnDidInsert,
SetTextAreaOnWillDelete, ResetTextAreaOnWillDelete,
SetTextAreaOnDidDelete, ResetTextAreaOnDidDelete,
SetTextAreaEnablePreviewText, ResetTextAreaEnablePreviewText };
SetTextAreaEnablePreviewText, ResetTextAreaEnablePreviewText, GetTextAreaPadding };
return &modifier;
}

View File

@ -965,7 +965,12 @@ const ArkUI_AttributeItem* GetPadding(ArkUI_NodeHandle node)
ArkUI_Float32 paddings[NUM_4];
ArkUI_Int32 length = 0;
ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
fullImpl->getNodeModifiers()->getCommonModifier()->getPadding(node->uiNodeHandle, &paddings, length, unit);
if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaPadding(
node->uiNodeHandle, &paddings, length, unit);
} else {
fullImpl->getNodeModifiers()->getCommonModifier()->getPadding(node->uiNodeHandle, &paddings, length, unit);
}
g_numberValues[NUM_0].f32 = paddings[NUM_0];
g_numberValues[NUM_1].f32 = paddings[NUM_1];
g_numberValues[NUM_2].f32 = paddings[NUM_2];
@ -10369,6 +10374,7 @@ const ArkUI_AttributeItem* GetFontColor(ArkUI_NodeHandle node)
g_attributeItem.size = REQUIRED_ONE_PARAM;
break;
case ARKUI_NODE_TEXT_INPUT:
case ARKUI_NODE_TEXT_AREA:
g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
getTextInputFontColor(node->uiNodeHandle);
g_attributeItem.size = REQUIRED_ONE_PARAM;
@ -10400,6 +10406,7 @@ const ArkUI_AttributeItem* GetFontSize(ArkUI_NodeHandle node)
g_attributeItem.size = REQUIRED_ONE_PARAM;
break;
case ARKUI_NODE_TEXT_INPUT:
case ARKUI_NODE_TEXT_AREA:
g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
getTextInputFontSize(node->uiNodeHandle, unit);
g_attributeItem.size = REQUIRED_ONE_PARAM;
@ -10430,6 +10437,7 @@ const ArkUI_AttributeItem* GetFontStyle(ArkUI_NodeHandle node)
g_attributeItem.size = REQUIRED_ONE_PARAM;
break;
case ARKUI_NODE_TEXT_INPUT:
case ARKUI_NODE_TEXT_AREA:
g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
getTextInputFontStyle(node->uiNodeHandle);
g_attributeItem.size = REQUIRED_ONE_PARAM;
@ -10454,6 +10462,7 @@ const ArkUI_AttributeItem* GetFontWeight(ArkUI_NodeHandle node)
g_attributeItem.size = REQUIRED_ONE_PARAM;
break;
case ARKUI_NODE_TEXT_INPUT:
case ARKUI_NODE_TEXT_AREA:
g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
getTextInputFontWeight(node->uiNodeHandle);
g_attributeItem.size = REQUIRED_ONE_PARAM;