fix c-api xts problems

Signed-off-by: zoulinken <zoulinken1@huawei.com>
This commit is contained in:
zoulinken 2024-06-12 19:57:49 +08:00
parent d6d60f07fa
commit 52143ccccc
3 changed files with 8 additions and 6 deletions

View File

@ -117,7 +117,7 @@ void SwiperPattern::OnAttachToFrameNode()
void SwiperPattern::OnDetachFromFrameNode(FrameNode* node)
{
auto pipeline = GetContext();
auto pipeline = PipelineContext::GetCurrentContextSafely();
CHECK_NULL_VOID(pipeline);
if (HasSurfaceChangedCallback()) {
pipeline->UnregisterSurfaceChangedCallback(surfaceChangedCallbackId_.value_or(-1));

View File

@ -714,6 +714,8 @@ void GetFont(ArkUINodeHandle node, ArkUITextFont* font)
}
g_strValue = families;
font->fontFamilies = g_strValue.c_str();
} else {
font->fontFamilies = "HarmonyOS Sans";
}
if (value.fontStyle.has_value()) {
font->fontStyle = static_cast<ArkUI_Int32>(value.fontStyle.value());

View File

@ -1214,7 +1214,7 @@ int32_t SetBrightness(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
if (actualSize < 0) {
return ERROR_CODE_PARAM_INVALID;
}
if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 2.0f)) {
if (LessNotEqual(item->value[0].f32, 0.0f)) {
return ERROR_CODE_PARAM_INVALID;
}
auto fullImpl = GetFullImpl();
@ -1377,7 +1377,7 @@ void ResetLinearGradient(ArkUI_NodeHandle node)
int32_t SetAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
{
auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
if (actualSize < 0) {
if (actualSize < 0 || !InRegion(NUM_0, NUM_8, item->value[0].i32)) {
return ERROR_CODE_PARAM_INVALID;
}
auto fullImpl = GetFullImpl();
@ -2677,7 +2677,7 @@ const ArkUI_AttributeItem* GetRadialGradient(ArkUI_NodeHandle node)
int32_t SetMask(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
{
if (item->size < 4) {
if (item->size < NUM_3) {
return ERROR_CODE_PARAM_INVALID;
}
auto* fullImpl = GetFullImpl();
@ -4911,7 +4911,7 @@ int32_t SetScrollScrollSnap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* it
paginationParams[item->size - NUM_3 + NUM_0] = snapAlign;
paginationParams[item->size - NUM_3 + NUM_1] = enableSnapToStart;
paginationParams[item->size - NUM_3 + NUM_2] = enableSnapToEnd;
paginationParams[item->size] = (item->size - NUM_3 > 1) ? true : false;
paginationParams[item->size] = (item->size - NUM_3 >= 1) ? true : false;
fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollSnap(
node->uiNodeHandle, paginations, item->size - NUM_3, paginationParams, item->size + NUM_1);
@ -6269,7 +6269,7 @@ int32_t SetTextFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
}
// family
std::vector<std::string> familyArray;
if (item->string == nullptr) {
if (item->string != nullptr) {
std::string value(item->string);
StringUtils::StringSplitter(value, ',', familyArray);
}