1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "bridge/declarative_frontend/engine/jsi/nativeModule/arkts_native_menu_bridge.h"
16 #include "core/interfaces/arkoala/arkoala_api.h"
17 #include "frameworks/bridge/declarative_frontend/engine/jsi/nativeModule/arkts_utils.h"
18
19 namespace OHOS::Ace::NG {
20 const std::string FORMAT_FONT = "%s|%s|%s";
21 const std::string DEFAULT_ERR_CODE = "-1";
22 constexpr int ARG_INDEX_0 = 0;
23 constexpr int ARG_INDEX_1 = 1;
24 constexpr int ARG_INDEX_2 = 2;
25 constexpr int ARG_INDEX_3 = 3;
26 constexpr int ARG_INDEX_4 = 4;
27 constexpr int ARG_INDEX_5 = 5;
28
BuildMenuDividerOptions(EcmaVM * vm,Local<JSValueRef> strokeWidthArg,Local<JSValueRef> colorArg,Local<JSValueRef> startMarginArg,Local<JSValueRef> endMarginArg)29 ArkUIMenuDividerOptions BuildMenuDividerOptions(EcmaVM* vm, Local<JSValueRef> strokeWidthArg,
30 Local<JSValueRef> colorArg, Local<JSValueRef> startMarginArg, Local<JSValueRef> endMarginArg)
31 {
32 ArkUIDimensionType strokeWidthOption;
33 ArkUIDimensionType startMarginOption;
34 ArkUIDimensionType endMarginOption;
35
36 CalcDimension strokeWidth;
37 if (!ArkTSUtils::ParseJsLengthMetrics(vm, strokeWidthArg, strokeWidth)) {
38 strokeWidth = Dimension(0.0);
39 }
40 strokeWidthOption.value = strokeWidth.Value();
41 strokeWidthOption.units = static_cast<int32_t>(strokeWidth.Unit());
42
43 Color color;
44 if (!ArkTSUtils::ParseJsColorAlpha(vm, colorArg, color)) {
45 color = Color::TRANSPARENT;
46 }
47
48 CalcDimension startMargin;
49 if (!ArkTSUtils::ParseJsLengthMetrics(vm, startMarginArg, startMargin)) {
50 startMargin = Dimension(0.0);
51 }
52 startMarginOption.value = startMargin.Value();
53 startMarginOption.units = static_cast<int32_t>(startMargin.Unit());
54
55 CalcDimension endMargin;
56 if (!ArkTSUtils::ParseJsLengthMetrics(vm, endMarginArg, endMargin)) {
57 endMargin = Dimension(0.0);
58 }
59 endMarginOption.value = endMargin.Value();
60 endMarginOption.units = static_cast<int32_t>(endMargin.Unit());
61
62 ArkUIMenuDividerOptions dividerOptions;
63 dividerOptions.strokeWidth = strokeWidthOption;
64 dividerOptions.color = color.GetValue();
65 dividerOptions.startMargin = startMarginOption;
66 dividerOptions.endMargin = endMarginOption;
67 return dividerOptions;
68 }
69
SetMenuDivider(ArkUIRuntimeCallInfo * runtimeCallInfo,bool isGroupDivider)70 ArkUINativeModuleValue SetMenuDivider(ArkUIRuntimeCallInfo* runtimeCallInfo, bool isGroupDivider)
71 {
72 EcmaVM* vm = runtimeCallInfo->GetVM();
73 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
74 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_0);
75 Local<JSValueRef> strokeWidthArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_1);
76 Local<JSValueRef> colorArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_2);
77 Local<JSValueRef> startMarginArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_3);
78 Local<JSValueRef> endMarginArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_4);
79 Local<JSValueRef> modeArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_5);
80 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
81 if (strokeWidthArg->IsUndefined() && colorArg->IsUndefined() && startMarginArg->IsUndefined()
82 && endMarginArg->IsUndefined() && modeArg->IsUndefined()) {
83 if (isGroupDivider) {
84 GetArkUINodeModifiers()->getMenuModifier()->resetMenuItemGroupDivider(nativeNode);
85 } else {
86 GetArkUINodeModifiers()->getMenuModifier()->resetMenuItemDivider(nativeNode);
87 }
88 return panda::JSValueRef::Undefined(vm);
89 }
90 auto dividerOptions = BuildMenuDividerOptions(vm, strokeWidthArg, colorArg, startMarginArg, endMarginArg);
91 int32_t mode = 0;
92 if (modeArg->IsNumber()) {
93 mode = modeArg->Int32Value(vm);
94 }
95 dividerOptions.mode = mode;
96 if (isGroupDivider) {
97 GetArkUINodeModifiers()->getMenuModifier()->setMenuItemGroupDivider(nativeNode, ÷rOptions);
98 } else {
99 GetArkUINodeModifiers()->getMenuModifier()->setMenuItemDivider(nativeNode, ÷rOptions);
100 }
101 return panda::JSValueRef::Undefined(vm);
102 }
103
ResetMenuDivider(ArkUIRuntimeCallInfo * runtimeCallInfo,bool isGroupDivider)104 ArkUINativeModuleValue ResetMenuDivider(ArkUIRuntimeCallInfo* runtimeCallInfo, bool isGroupDivider)
105 {
106 EcmaVM* vm = runtimeCallInfo->GetVM();
107 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
108 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
109 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
110 if (isGroupDivider) {
111 GetArkUINodeModifiers()->getMenuModifier()->resetMenuItemGroupDivider(nativeNode);
112 } else {
113 GetArkUINodeModifiers()->getMenuModifier()->resetMenuItemDivider(nativeNode);
114 }
115 return panda::JSValueRef::Undefined(vm);
116 }
117
SetMenuFontColor(ArkUIRuntimeCallInfo * runtimeCallInfo)118 ArkUINativeModuleValue MenuBridge::SetMenuFontColor(ArkUIRuntimeCallInfo* runtimeCallInfo)
119 {
120 EcmaVM* vm = runtimeCallInfo->GetVM();
121 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
122 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
123 Local<JSValueRef> secondArg = runtimeCallInfo->GetCallArgRef(1);
124 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
125 Color color;
126 if (!ArkTSUtils::ParseJsColorAlpha(vm, secondArg, color)) {
127 GetArkUINodeModifiers()->getMenuModifier()->resetMenuFontColor(nativeNode);
128 } else {
129 GetArkUINodeModifiers()->getMenuModifier()->setMenuFontColor(nativeNode, color.GetValue());
130 }
131
132 return panda::JSValueRef::Undefined(vm);
133 }
134
ResetMenuFontColor(ArkUIRuntimeCallInfo * runtimeCallInfo)135 ArkUINativeModuleValue MenuBridge::ResetMenuFontColor(ArkUIRuntimeCallInfo* runtimeCallInfo)
136 {
137 EcmaVM* vm = runtimeCallInfo->GetVM();
138 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
139 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
140 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
141 GetArkUINodeModifiers()->getMenuModifier()->resetMenuFontColor(nativeNode);
142 return panda::JSValueRef::Undefined(vm);
143 }
144
SetFont(ArkUIRuntimeCallInfo * runtimeCallInfo)145 ArkUINativeModuleValue MenuBridge::SetFont(ArkUIRuntimeCallInfo* runtimeCallInfo)
146 {
147 EcmaVM* vm = runtimeCallInfo->GetVM();
148 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
149 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
150 Local<JSValueRef> sizeArg = runtimeCallInfo->GetCallArgRef(1); // 1: index of font size value
151 Local<JSValueRef> weightArg = runtimeCallInfo->GetCallArgRef(2); // 2: index of font weight value
152 Local<JSValueRef> familyArg = runtimeCallInfo->GetCallArgRef(3); // 3: index of font family value
153 Local<JSValueRef> styleArg = runtimeCallInfo->GetCallArgRef(4); // 4: index of font style value
154 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
155 if (sizeArg->IsUndefined() && weightArg->IsUndefined() && familyArg->IsUndefined() && styleArg->IsUndefined()) {
156 GetArkUINodeModifiers()->getMenuModifier()->resetFont(nativeNode);
157 return panda::JSValueRef::Undefined(vm);
158 }
159
160 CalcDimension fontSize;
161 if (!ArkTSUtils::ParseJsDimensionFp(vm, sizeArg, fontSize, false)) {
162 fontSize = Dimension(0.0);
163 }
164 std::string weight = DEFAULT_ERR_CODE;
165 if (weightArg->IsNumber()) {
166 weight = std::to_string(weightArg->Int32Value(vm));
167 } else {
168 if (!ArkTSUtils::ParseJsString(vm, weightArg, weight) || weight.empty()) {
169 weight = DEFAULT_ERR_CODE;
170 }
171 }
172
173 int32_t style = -1;
174 if (styleArg->IsNumber()) {
175 style = styleArg->Int32Value(vm);
176 }
177
178 std::string family;
179 if (!ArkTSUtils::ParseJsFontFamiliesToString(vm, familyArg, family) || family.empty()) {
180 family = DEFAULT_ERR_CODE;
181 }
182 std::string fontSizeStr = fontSize.ToString();
183 std::string fontInfo =
184 StringUtils::FormatString(FORMAT_FONT.c_str(), fontSizeStr.c_str(), weight.c_str(), family.c_str());
185
186 GetArkUINodeModifiers()->getMenuModifier()->setFont(nativeNode, fontInfo.c_str(), style);
187 return panda::JSValueRef::Undefined(vm);
188 }
189
ResetFont(ArkUIRuntimeCallInfo * runtimeCallInfo)190 ArkUINativeModuleValue MenuBridge::ResetFont(ArkUIRuntimeCallInfo* runtimeCallInfo)
191 {
192 EcmaVM* vm = runtimeCallInfo->GetVM();
193 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
194 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
195 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
196 GetArkUINodeModifiers()->getMenuModifier()->resetFont(nativeNode);
197 return panda::JSValueRef::Undefined(vm);
198 }
199
ParseRadius(EcmaVM * vm,ArkUIRuntimeCallInfo * runtimeCallInfo,ArkUINodeHandle nativeNode,std::vector<ArkUI_Float32> & radiusValues,std::vector<int32_t> & radiusUnits)200 bool MenuBridge::ParseRadius(EcmaVM* vm, ArkUIRuntimeCallInfo* runtimeCallInfo, ArkUINodeHandle nativeNode,
201 std::vector<ArkUI_Float32>& radiusValues, std::vector<int32_t>& radiusUnits)
202 {
203 Local<JSValueRef> topLeftArgs = runtimeCallInfo->GetCallArgRef(1); // 1: index of top left value
204 Local<JSValueRef> topRightArgs = runtimeCallInfo->GetCallArgRef(2); // 2: index of top right value
205 Local<JSValueRef> bottomLeftArgs = runtimeCallInfo->GetCallArgRef(3); // 3: index of bottom left value
206 Local<JSValueRef> bottomRightArgs = runtimeCallInfo->GetCallArgRef(4); // 4: index of bottom right value
207 Local<JSValueRef> isObjectArgs = runtimeCallInfo->GetCallArgRef(5); // 5: check is object radius
208 if (topLeftArgs->IsUndefined() && topRightArgs->IsUndefined() && bottomLeftArgs->IsUndefined() &&
209 bottomRightArgs->IsUndefined()) {
210 GetArkUINodeModifiers()->getMenuModifier()->resetRadius(nativeNode);
211 return false;
212 }
213
214 CalcDimension topLeft;
215 CalcDimension topRight;
216 CalcDimension bottomLeft;
217 CalcDimension bottomRight;
218 if (isObjectArgs->IsBoolean() && !isObjectArgs->ToBoolean(vm)->Value()) {
219 if (!ArkTSUtils::ParseJsDimensionVpNG(vm, topLeftArgs, topLeft, true)) {
220 GetArkUINodeModifiers()->getMenuModifier()->resetRadius(nativeNode);
221 return false;
222 }
223 if (LessNotEqual(topLeft.Value(), 0.0)) {
224 GetArkUINodeModifiers()->getMenuModifier()->resetRadius(nativeNode);
225 return false;
226 }
227 topRight = topLeft;
228 bottomLeft = topLeft;
229 bottomRight = topLeft;
230 } else {
231 if (!ArkTSUtils::ParseJsDimensionVpNG(vm, topLeftArgs, topLeft, true)) {
232 topLeft = CalcDimension(0.0, DimensionUnit::VP);
233 }
234
235 if (!ArkTSUtils::ParseJsDimensionVpNG(vm, topRightArgs, topRight, true)) {
236 topRight = CalcDimension(0.0, DimensionUnit::VP);
237 }
238
239 if (!ArkTSUtils::ParseJsDimensionVpNG(vm, bottomLeftArgs, bottomLeft, true)) {
240 bottomLeft = CalcDimension(0.0, DimensionUnit::VP);
241 }
242
243 if (!ArkTSUtils::ParseJsDimensionVpNG(vm, bottomRightArgs, bottomRight, true)) {
244 bottomRight = CalcDimension(0.0, DimensionUnit::VP);
245 }
246 }
247 radiusUnits.push_back(static_cast<int32_t>(topLeft.Unit()));
248 radiusUnits.push_back(static_cast<int32_t>(topRight.Unit()));
249 radiusUnits.push_back(static_cast<int32_t>(bottomLeft.Unit()));
250 radiusUnits.push_back(static_cast<int32_t>(bottomRight.Unit()));
251 radiusValues.push_back(topLeft.Value());
252 radiusValues.push_back(topRight.Value());
253 radiusValues.push_back(bottomLeft.Value());
254 radiusValues.push_back(bottomRight.Value());
255 return true;
256 }
257
SetRadius(ArkUIRuntimeCallInfo * runtimeCallInfo)258 ArkUINativeModuleValue MenuBridge::SetRadius(ArkUIRuntimeCallInfo* runtimeCallInfo)
259 {
260 EcmaVM* vm = runtimeCallInfo->GetVM();
261 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
262 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
263 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
264 std::vector<ArkUI_Float32> radiusValues;
265 std::vector<int32_t> radiusUnits;
266 if (!ParseRadius(vm, runtimeCallInfo, nativeNode, radiusValues, radiusUnits)) {
267 return panda::JSValueRef::Undefined(vm);
268 }
269 GetArkUINodeModifiers()->getMenuModifier()->setRadius(nativeNode, radiusValues.data(), radiusUnits.data());
270 return panda::JSValueRef::Undefined(vm);
271 }
272
ResetRadius(ArkUIRuntimeCallInfo * runtimeCallInfo)273 ArkUINativeModuleValue MenuBridge::ResetRadius(ArkUIRuntimeCallInfo* runtimeCallInfo)
274 {
275 EcmaVM* vm = runtimeCallInfo->GetVM();
276 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
277 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
278 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
279 GetArkUINodeModifiers()->getMenuModifier()->resetRadius(nativeNode);
280 return panda::JSValueRef::Undefined(vm);
281 }
282
SetWidth(ArkUIRuntimeCallInfo * runtimeCallInfo)283 ArkUINativeModuleValue MenuBridge::SetWidth(ArkUIRuntimeCallInfo* runtimeCallInfo)
284 {
285 EcmaVM* vm = runtimeCallInfo->GetVM();
286 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
287 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
288 Local<JSValueRef> widthArg = runtimeCallInfo->GetCallArgRef(1);
289 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
290 CalcDimension width;
291 if (!ArkTSUtils::ParseJsDimensionVp(vm, widthArg, width, false)) {
292 GetArkUINodeModifiers()->getMenuModifier()->resetMenuWidth(nativeNode);
293 return panda::JSValueRef::Undefined(vm);
294 }
295 GetArkUINodeModifiers()->getMenuModifier()->setMenuWidth(
296 nativeNode, width.Value(), static_cast<int32_t>(width.Unit()));
297 return panda::JSValueRef::Undefined(vm);
298 }
299
ResetWidth(ArkUIRuntimeCallInfo * runtimeCallInfo)300 ArkUINativeModuleValue MenuBridge::ResetWidth(ArkUIRuntimeCallInfo* runtimeCallInfo)
301 {
302 EcmaVM* vm = runtimeCallInfo->GetVM();
303 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
304 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
305 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
306 GetArkUINodeModifiers()->getMenuModifier()->resetMenuWidth(nativeNode);
307 return panda::JSValueRef::Undefined(vm);
308 }
309
SetMenuItemDivider(ArkUIRuntimeCallInfo * runtimeCallInfo)310 ArkUINativeModuleValue MenuBridge::SetMenuItemDivider(ArkUIRuntimeCallInfo* runtimeCallInfo)
311 {
312 return SetMenuDivider(runtimeCallInfo, false);
313 }
314
ResetMenuItemDivider(ArkUIRuntimeCallInfo * runtimeCallInfo)315 ArkUINativeModuleValue MenuBridge::ResetMenuItemDivider(ArkUIRuntimeCallInfo* runtimeCallInfo)
316 {
317 return ResetMenuDivider(runtimeCallInfo, false);
318 }
319
SetMenuItemGroupDivider(ArkUIRuntimeCallInfo * runtimeCallInfo)320 ArkUINativeModuleValue MenuBridge::SetMenuItemGroupDivider(ArkUIRuntimeCallInfo* runtimeCallInfo)
321 {
322 return SetMenuDivider(runtimeCallInfo, true);
323 }
324
ResetMenuItemGroupDivider(ArkUIRuntimeCallInfo * runtimeCallInfo)325 ArkUINativeModuleValue MenuBridge::ResetMenuItemGroupDivider(ArkUIRuntimeCallInfo* runtimeCallInfo)
326 {
327 return ResetMenuDivider(runtimeCallInfo, true);
328 }
329
SetSubMenuExpandingMode(ArkUIRuntimeCallInfo * runtimeCallInfo)330 ArkUINativeModuleValue MenuBridge::SetSubMenuExpandingMode(ArkUIRuntimeCallInfo* runtimeCallInfo)
331 {
332 EcmaVM* vm = runtimeCallInfo->GetVM();
333 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
334 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
335 Local<JSValueRef> secondArg = runtimeCallInfo->GetCallArgRef(1);
336 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
337 if (secondArg->IsUndefined() || secondArg->IsNull()) {
338 GetArkUINodeModifiers()->getMenuModifier()->resetSubMenuExpandingMode(nativeNode);
339 return panda::JSValueRef::Undefined(vm);
340 }
341 if (secondArg->IsNumber()) {
342 GetArkUINodeModifiers()->getMenuModifier()->setSubMenuExpandingMode(nativeNode,
343 secondArg->ToNumber(vm)->Value());
344 } else {
345 GetArkUINodeModifiers()->getMenuModifier()->resetSubMenuExpandingMode(nativeNode);
346 }
347 return panda::JSValueRef::Undefined(vm);
348 }
349
ResetSubMenuExpandingMode(ArkUIRuntimeCallInfo * runtimeCallInfo)350 ArkUINativeModuleValue MenuBridge::ResetSubMenuExpandingMode(ArkUIRuntimeCallInfo* runtimeCallInfo)
351 {
352 EcmaVM* vm = runtimeCallInfo->GetVM();
353 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
354 Local<JSValueRef> firstArg = runtimeCallInfo->GetCallArgRef(0);
355 auto nativeNode = nodePtr(firstArg->ToNativePointer(vm)->Value());
356 GetArkUINodeModifiers()->getMenuModifier()->resetSubMenuExpandingMode(nativeNode);
357 return panda::JSValueRef::Undefined(vm);
358 }
359
SetFontSize(ArkUIRuntimeCallInfo * runtimeCallInfo)360 ArkUINativeModuleValue MenuBridge::SetFontSize(ArkUIRuntimeCallInfo* runtimeCallInfo)
361 {
362 EcmaVM* vm = runtimeCallInfo->GetVM();
363 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
364 int32_t argsNumber = runtimeCallInfo->GetArgsNumber();
365 if (argsNumber != ARG_INDEX_2) {
366 return panda::JSValueRef::Undefined(vm);
367 }
368 Local<JSValueRef> nativeNodeArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_0);
369 Local<JSValueRef> fontSizeArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_1);
370 auto nativeNode = nodePtr(nativeNodeArg->ToNativePointer(vm)->Value());
371 CalcDimension fontSize;
372 if (!ArkTSUtils::ParseJsDimensionFp(vm, fontSizeArg, fontSize) || fontSize.IsNegative() ||
373 fontSize.Unit() == DimensionUnit::PERCENT) {
374 GetArkUINodeModifiers()->getMenuModifier()->resetMenuFontSize(nativeNode);
375 } else {
376 GetArkUINodeModifiers()->getMenuModifier()->setMenuFontSize(
377 nativeNode, fontSize.Value(), static_cast<int>(fontSize.Unit()));
378 }
379 return panda::JSValueRef::Undefined(vm);
380 }
381
ResetFontSize(ArkUIRuntimeCallInfo * runtimeCallInfo)382 ArkUINativeModuleValue MenuBridge::ResetFontSize(ArkUIRuntimeCallInfo* runtimeCallInfo)
383 {
384 EcmaVM* vm = runtimeCallInfo->GetVM();
385 CHECK_NULL_RETURN(vm, panda::NativePointerRef::New(vm, nullptr));
386 Local<JSValueRef> nativeNodeArg = runtimeCallInfo->GetCallArgRef(ARG_INDEX_0);
387 auto nativeNode = nodePtr(nativeNodeArg->ToNativePointer(vm)->Value());
388 GetArkUINodeModifiers()->getMenuModifier()->resetMenuFontSize(nativeNode);
389 return panda::JSValueRef::Undefined(vm);
390 }
391
392 } // namespace OHOS::Ace::NG
393