!45449 自定义属性增强检视意见修改

Merge pull request !45449 from 王丽莉/master0422
This commit is contained in:
openharmony_ci 2024-10-11 12:41:22 +00:00 committed by Gitee
commit 5e328c7729
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 16 additions and 12 deletions

View File

@ -1332,6 +1332,9 @@ std::function<std::string(const std::string&)> ParseGetFunc(ArkUIRuntimeCallInfo
CHECK_NULL_RETURN(vm, resultString);
panda::LocalScope scope(vm);
auto global = JSNApi::GetGlobalObject(vm);
if (global.IsNull()) {
return resultString;
}
auto getCustomProperty = global->Get(vm, panda::StringRef::NewFromUtf8(vm, "__getCustomPropertyString__"));
if (getCustomProperty->IsUndefined() || !getCustomProperty->IsFunction(vm)) {
return resultString;
@ -1346,7 +1349,7 @@ std::function<std::string(const std::string&)> ParseGetFunc(ArkUIRuntimeCallInfo
return resultString;
}
auto value = callValue->ToString(vm)->ToString(vm);
return value.c_str();
return value;
};
}

View File

@ -10594,7 +10594,7 @@ std::function<std::string(const std::string&)> ParseJsGetFunc(const JSCallbackIn
return resultString;
}
auto value = callValue->ToString(vm)->ToString(vm);
return value.c_str();
return value;
};
}

View File

@ -5805,7 +5805,7 @@ void FrameNode::ResetPredictNodes()
void FrameNode::SetJSCustomProperty(std::function<bool()> func, std::function<std::string(const std::string&)> getFunc)
{
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(customPropertyMapLock_);
bool result = func();
if (IsCNode()) {
return;
@ -5832,10 +5832,10 @@ bool FrameNode::GetCapiCustomProperty(const std::string& key, std::string& value
if (!IsCNode()) {
return false;
}
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(customPropertyMapLock_);
auto iter = customPropertyMap_.find(key);
if (iter != customPropertyMap_.end()) {
value = customPropertyMap_[key];
value = iter->second;
return true;
}
return false;
@ -5843,13 +5843,13 @@ bool FrameNode::GetCapiCustomProperty(const std::string& key, std::string& value
void FrameNode::AddCustomProperty(const std::string& key, const std::string& value)
{
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(customPropertyMapLock_);
customPropertyMap_[key] = value;
}
void FrameNode::RemoveCustomProperty(const std::string& key)
{
std::lock_guard<std::mutex> lock(mutex_);
std::lock_guard<std::mutex> lock(customPropertyMapLock_);
auto iter = customPropertyMap_.find(key);
if (iter != customPropertyMap_.end()) {
customPropertyMap_.erase(iter);

View File

@ -1367,7 +1367,7 @@ private:
DragPreviewOption previewOption_ { true, false, false, false, false, false, { .isShowBadge = true } };
std::unordered_map<std::string, std::string> customPropertyMap_;
std::mutex mutex_;
std::mutex customPropertyMapLock_;
RefPtr<Recorder::ExposureProcessor> exposureProcessor_;

View File

@ -492,7 +492,7 @@ void ResetSystemFontStyleChangeEvent(ArkUINodeHandle node)
ViewAbstract::SetSystemFontChangeEvent(frameNode, nullptr);
}
ArkUI_Uint32 getCustomPropertyCapiByKey(ArkUINodeHandle node, ArkUI_CharPtr key, char** value, ArkUI_Uint32* size)
ArkUI_Uint32 GetCustomPropertyCapiByKey(ArkUINodeHandle node, ArkUI_CharPtr key, char** value, ArkUI_Uint32* size)
{
auto* frameNode = reinterpret_cast<FrameNode*>(node);
CHECK_NULL_RETURN(frameNode, 0);
@ -509,6 +509,7 @@ ArkUI_Uint32 getCustomPropertyCapiByKey(ArkUINodeHandle node, ArkUI_CharPtr key,
void FreeCustomPropertyCharPtr(char* value, ArkUI_Uint32 size)
{
CHECK_NULL_VOID(value);
delete[] value;
value = nullptr;
}
@ -551,7 +552,7 @@ const ArkUIFrameNodeModifier* GetFrameNodeModifier()
GetInspectorId, GetNodeType, IsVisible, IsAttached, GetInspectorInfo, GetFrameNodeById, GetFrameNodeByUniqueId,
GetFrameNodeByKey, GetAttachedFrameNodeById, PropertyUpdate, GetLast, GetFirstUINode, GetLayoutSize,
GetLayoutPositionWithoutMargin, SetSystemColorModeChangeEvent, ResetSystemColorModeChangeEvent,
SetSystemFontStyleChangeEvent, ResetSystemFontStyleChangeEvent, getCustomPropertyCapiByKey,
SetSystemFontStyleChangeEvent, ResetSystemFontStyleChangeEvent, GetCustomPropertyCapiByKey,
SetCustomPropertyModiferByKey, AddCustomProperty, RemoveCustomProperty, FreeCustomPropertyCharPtr };
return &modifier;
}

View File

@ -1420,11 +1420,11 @@
"name": "OH_ArkUI_NodeUtils_GetPositionWithTranslateInScreen"
},
{
"first_introduced": "14",
"first_introduced": "13",
"name": "OH_ArkUI_NodeUtils_AddCustomProperty"
},
{
"first_introduced": "14",
"first_introduced": "13",
"name": "OH_ArkUI_NodeUtils_RemoveCustomProperty"
},
{