1 /*
2 * Copyright (c) 2021-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
16 #include "frameworks/bridge/declarative_frontend/jsview/js_xcomponent.h"
17
18 #include "base/log/ace_scoring_log.h"
19 #include "base/memory/referenced.h"
20 #include "base/utils/utils.h"
21 #include "bridge/declarative_frontend/engine/js_ref_ptr.h"
22 #include "bridge/declarative_frontend/jsview/js_view_common_def.h"
23 #include "bridge/declarative_frontend/jsview/js_xcomponent_controller.h"
24 #include "bridge/declarative_frontend/jsview/models/xcomponent_model_impl.h"
25 #include "core/components/common/layout/constants.h"
26 #include "core/components_ng/base/view_stack_processor.h"
27 #include "core/components_ng/pattern/xcomponent/xcomponent_model.h"
28 #include "core/components_ng/pattern/xcomponent/xcomponent_model_ng.h"
29 #include "frameworks/core/components_ng/base/view_abstract_model.h"
30 #include "frameworks/core/components_ng/pattern/xcomponent/xcomponent_pattern.h"
31
32 namespace OHOS::Ace {
33 namespace {
ConvertToXComponentType(const std::string & type)34 XComponentType ConvertToXComponentType(const std::string& type)
35 {
36 if (type == "surface") {
37 return XComponentType::SURFACE;
38 }
39 if (type == "component") {
40 return XComponentType::COMPONENT;
41 }
42 if (type == "node") {
43 return XComponentType::NODE;
44 }
45 return XComponentType::SURFACE;
46 }
47 } // namespace
48
49 std::unique_ptr<XComponentModel> XComponentModel::instance_ = nullptr;
50 std::mutex XComponentModel::mutex_;
51
GetInstance()52 XComponentModel* XComponentModel::GetInstance()
53 {
54 if (!instance_) {
55 std::lock_guard<std::mutex> lock(mutex_);
56 if (!instance_) {
57 #ifdef NG_BUILD
58 instance_.reset(new NG::XComponentModelNG());
59 #else
60 if (Container::IsCurrentUseNewPipeline()) {
61 instance_.reset(new NG::XComponentModelNG());
62 } else {
63 instance_.reset(new Framework::XComponentModelImpl());
64 }
65 #endif
66 }
67 }
68 return instance_.get();
69 }
70
71 } // namespace OHOS::Ace
72
73 namespace OHOS::Ace::Framework {
JSBind(BindingTarget globalObj)74 void JSXComponent::JSBind(BindingTarget globalObj)
75 {
76 JSClass<JSXComponent>::Declare("XComponent");
77 JSClass<JSXComponent>::StaticMethod("create", &JSXComponent::Create);
78 JSClass<JSXComponent>::StaticMethod("onLoad", &JSXComponent::JsOnLoad);
79 JSClass<JSXComponent>::StaticMethod("onDestroy", &JSXComponent::JsOnDestroy);
80 JSClass<JSXComponent>::StaticMethod("onAppear", &JSXComponent::JsOnAppear);
81 JSClass<JSXComponent>::StaticMethod("onDisAppear", &JSXComponent::JsOnDisAppear);
82
83 JSClass<JSXComponent>::StaticMethod("onTouch", &JSXComponent::JsOnTouch);
84 JSClass<JSXComponent>::StaticMethod("onClick", &JSXComponent::JsOnClick);
85 JSClass<JSXComponent>::StaticMethod("onKeyEvent", &JSXComponent::JsOnKeyEvent);
86 JSClass<JSXComponent>::StaticMethod("onMouse", &JSXComponent::JsOnMouse);
87 JSClass<JSXComponent>::StaticMethod("onHover", &JSXComponent::JsOnHover);
88 JSClass<JSXComponent>::StaticMethod("onFocus", &JSXComponent::JsOnFocus);
89 JSClass<JSXComponent>::StaticMethod("onBlur", &JSXComponent::JsOnBlur);
90
91 JSClass<JSXComponent>::StaticMethod("backgroundColor", &JSXComponent::JsBackgroundColor);
92 JSClass<JSXComponent>::StaticMethod("backgroundImage", &JSXComponent::JsBackgroundImage);
93 JSClass<JSXComponent>::StaticMethod("backgroundImageSize", &JSXComponent::JsBackgroundImageSize);
94 JSClass<JSXComponent>::StaticMethod("backgroundImagePosition", &JSXComponent::JsBackgroundImagePosition);
95 JSClass<JSXComponent>::StaticMethod("opacity", &JSXComponent::JsOpacity);
96 JSClass<JSXComponent>::StaticMethod("blur", &JSXComponent::JsBlur);
97 JSClass<JSXComponent>::StaticMethod("backdropBlur", &JSXComponent::JsBackdropBlur);
98 JSClass<JSXComponent>::StaticMethod("grayscale", &JSXComponent::JsGrayscale);
99 JSClass<JSXComponent>::StaticMethod("brightness", &JSXComponent::JsBrightness);
100 JSClass<JSXComponent>::StaticMethod("saturate", &JSXComponent::JsSaturate);
101 JSClass<JSXComponent>::StaticMethod("contrast", &JSXComponent::JsContrast);
102 JSClass<JSXComponent>::StaticMethod("invert", &JSXComponent::JsInvert);
103 JSClass<JSXComponent>::StaticMethod("sepia", &JSXComponent::JsSepia);
104 JSClass<JSXComponent>::StaticMethod("hueRotate", &JSXComponent::JsHueRotate);
105 JSClass<JSXComponent>::StaticMethod("colorBlend", &JSXComponent::JsColorBlend);
106 JSClass<JSXComponent>::StaticMethod("sphericalEffect", &JSXComponent::JsSphericalEffect);
107 JSClass<JSXComponent>::StaticMethod("lightUpEffect", &JSXComponent::JsLightUpEffect);
108 JSClass<JSXComponent>::StaticMethod("pixelStretchEffect", &JSXComponent::JsPixelStretchEffect);
109 JSClass<JSXComponent>::StaticMethod("linearGradientBlur", &JSXComponent::JsLinearGradientBlur);
110
111 JSClass<JSXComponent>::InheritAndBind<JSContainerBase>(globalObj);
112 }
113
Create(const JSCallbackInfo & info)114 void JSXComponent::Create(const JSCallbackInfo& info)
115 {
116 if (info.Length() < 1 || !info[0]->IsObject()) {
117 return;
118 }
119 auto paramObject = JSRef<JSObject>::Cast(info[0]);
120 auto id = paramObject->GetProperty("id");
121 if (!id->IsString()) {
122 return;
123 }
124
125 auto type = paramObject->GetProperty("type");
126 auto libraryname = paramObject->GetProperty("libraryname");
127 auto controllerObj = paramObject->GetProperty("controller");
128 std::shared_ptr<InnerXComponentController> xcomponentController = nullptr;
129 if (controllerObj->IsObject()) {
130 auto* jsXComponentController = JSRef<JSObject>::Cast(controllerObj)->Unwrap<JSXComponentController>();
131 if (jsXComponentController) {
132 XComponentClient::GetInstance().AddControllerToJSXComponentControllersMap(
133 id->ToString(), jsXComponentController);
134 xcomponentController = jsXComponentController->GetController();
135 }
136 }
137 XComponentType xcomponentType = XComponentType::SURFACE;
138 if (type->IsString()) {
139 xcomponentType = ConvertToXComponentType(type->ToString());
140 } else if (type->IsNumber()) {
141 xcomponentType = static_cast<XComponentType>(type->ToNumber<int32_t>());
142 }
143 XComponentModel::GetInstance()->Create(
144 id->ToString(), xcomponentType, libraryname->ToString(), xcomponentController);
145
146 auto detachCallback = [](const std::string& xcomponentId) {
147 XComponentClient::GetInstance().DeleteControllerFromJSXComponentControllersMap(xcomponentId);
148 XComponentClient::GetInstance().DeleteFromJsValMapById(xcomponentId);
149 };
150 XComponentModel::GetInstance()->SetDetachCallback(std::move(detachCallback));
151
152 if (info.Length() > 1 && info[1]->IsString()) {
153 auto soPath = info[1]->ToString();
154 XComponentModel::GetInstance()->SetSoPath(soPath);
155 }
156 }
157
Create(const XComponentParams & params)158 void* JSXComponent::Create(const XComponentParams& params)
159 {
160 auto* jsXComponent = new JSXComponent();
161 auto frameNode = AceType::DynamicCast<NG::FrameNode>(XComponentModel::GetInstance()->Create(params.elmtId,
162 static_cast<float>(params.width), static_cast<float>(params.height), params.xcomponentId,
163 static_cast<XComponentType>(params.xcomponentType), params.libraryName, nullptr));
164 jsXComponent->SetFrameNode(frameNode);
165 auto pattern = frameNode->GetPattern<NG::XComponentPattern>();
166 CHECK_NULL_RETURN(pattern, nullptr);
167 pattern->SetRenderType(static_cast<NodeRenderType>(params.renderType));
168 pattern->SetExportTextureSurfaceId(params.surfaceId);
169
170 auto container = Container::Current();
171 CHECK_NULL_RETURN(container, nullptr);
172 auto pipelineContext = AceType::DynamicCast<NG::PipelineContext>(container->GetPipelineContext());
173 CHECK_NULL_RETURN(pipelineContext, nullptr);
174 auto taskExecutor = pipelineContext->GetTaskExecutor();
175 CHECK_NULL_RETURN(taskExecutor, nullptr);
176 taskExecutor->PostTask(
177 [weak = AceType::WeakClaim(AceType::RawPtr(frameNode))]() {
178 auto frameNode = weak.Upgrade();
179 CHECK_NULL_VOID(frameNode);
180 auto xcPattern = frameNode->GetPattern<NG::XComponentPattern>();
181 CHECK_NULL_VOID(xcPattern);
182 xcPattern->XComponentSizeInit();
183 xcPattern->SetXcomponentInit(true);
184 },
185 TaskExecutor::TaskType::JS);
186
187 return jsXComponent;
188 }
189
ChangeRenderType(int32_t renderType)190 bool JSXComponent::ChangeRenderType(int32_t renderType)
191 {
192 auto xcFrameNode = AceType::DynamicCast<NG::FrameNode>(frameNode_);
193 CHECK_NULL_RETURN(xcFrameNode, false);
194 auto pattern = xcFrameNode->GetPattern<NG::XComponentPattern>();
195 CHECK_NULL_RETURN(pattern, false);
196 return pattern->ChangeRenderType(static_cast<NodeRenderType>(renderType));
197 }
198
JsOnLoad(const JSCallbackInfo & args)199 void JSXComponent::JsOnLoad(const JSCallbackInfo& args)
200 {
201 if (args.Length() < 1 || !args[0]->IsFunction()) {
202 return;
203 }
204 auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(args[0]));
205 WeakPtr<NG::FrameNode> targetNode = NG::ViewStackProcessor::GetInstance()->GetMainFrameNode();
206 auto onLoad = [execCtx = args.GetExecutionContext(), func = std::move(jsFunc), node = targetNode](
207 const std::string& xcomponentId) {
208 JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
209 ACE_SCORING_EVENT("XComponent.onLoad");
210 PipelineContext::SetCallBackNode(node);
211 std::vector<std::string> keys = { "load", xcomponentId };
212 func->ExecuteNew(keys, "");
213 };
214 XComponentModel::GetInstance()->SetOnLoad(std::move(onLoad));
215 }
216
RegisterOnCreate(const JsiExecutionContext & execCtx,const Local<JSValueRef> & func)217 void JSXComponent::RegisterOnCreate(const JsiExecutionContext& execCtx, const Local<JSValueRef>& func)
218 {
219 auto frameNode = AceType::DynamicCast<NG::FrameNode>(frameNode_);
220 CHECK_NULL_VOID(frameNode);
221
222 if (!func->IsFunction()) {
223 return;
224 }
225
226 auto jsFunc = panda::Global<panda::FunctionRef>(execCtx.vm_, Local<panda::FunctionRef>(func));
227 auto onLoad = [execCtx, funcRef = std::move(jsFunc), node = AceType::WeakClaim(AceType::RawPtr(frameNode))](
228 const std::string& xcomponentId) {
229 JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
230 ACE_SCORING_EVENT("XComponentNode.onCreate");
231 PipelineContext::SetCallBackNode(node);
232 std::vector<Local<JSValueRef>> argv;
233 JSRef<JSVal> jsVal;
234 if (XComponentClient::GetInstance().GetJSVal(xcomponentId, jsVal)) {
235 argv.emplace_back(jsVal->GetLocalHandle());
236 }
237 funcRef->Call(execCtx.vm_, JSNApi::GetGlobalObject(execCtx.vm_), argv.data(), argv.size());
238 };
239 XComponentModel::GetInstance()->RegisterOnCreate(frameNode, std::move(onLoad));
240 }
241
RegisterOnDestroy(const JsiExecutionContext & execCtx,const Local<JSValueRef> & func)242 void JSXComponent::RegisterOnDestroy(const JsiExecutionContext& execCtx, const Local<JSValueRef>& func)
243 {
244 auto frameNode = AceType::DynamicCast<NG::FrameNode>(frameNode_);
245 CHECK_NULL_VOID(frameNode);
246
247 if (!func->IsFunction()) {
248 return;
249 }
250
251 auto jsFunc = panda::Global<panda::FunctionRef>(execCtx.vm_, Local<panda::FunctionRef>(func));
252 auto onDestroy = [execCtx, funcRef = std::move(jsFunc), node = AceType::WeakClaim(AceType::RawPtr(frameNode))]() {
253 JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
254 ACE_SCORING_EVENT("XComponentNode.onDestroy");
255 PipelineContext::SetCallBackNode(node);
256 funcRef->Call(execCtx.vm_, JSNApi::GetGlobalObject(execCtx.vm_), nullptr, 0);
257 };
258 XComponentModel::GetInstance()->RegisterOnDestroy(frameNode, std::move(onDestroy));
259 }
260
JsOnDestroy(const JSCallbackInfo & args)261 void JSXComponent::JsOnDestroy(const JSCallbackInfo& args)
262 {
263 if (args.Length() < 1 || !args[0]->IsFunction()) {
264 return;
265 }
266 auto jsFunc = AceType::MakeRefPtr<JsFunction>(JSRef<JSObject>(), JSRef<JSFunc>::Cast(args[0]));
267 WeakPtr<NG::FrameNode> targetNode = NG::ViewStackProcessor::GetInstance()->GetMainFrameNode();
268 auto onDestroy = [execCtx = args.GetExecutionContext(), func = std::move(jsFunc), node = targetNode]() {
269 JAVASCRIPT_EXECUTION_SCOPE_WITH_CHECK(execCtx);
270 ACE_SCORING_EVENT("XComponent.onDestroy");
271 PipelineContext::SetCallBackNode(node);
272 std::vector<std::string> keys = { "destroy" };
273 func->Execute(keys, "");
274 };
275 XComponentModel::GetInstance()->SetOnDestroy(std::move(onDestroy));
276 }
277
JsOnAppear(const JSCallbackInfo & args)278 void JSXComponent::JsOnAppear(const JSCallbackInfo& args)
279 {
280 auto type = XComponentModel::GetInstance()->GetType();
281 if (type != XComponentType::NODE) {
282 return;
283 }
284 JSInteractableView::JsOnAppear(args);
285 }
286
JsOnDisAppear(const JSCallbackInfo & args)287 void JSXComponent::JsOnDisAppear(const JSCallbackInfo& args)
288 {
289 auto type = XComponentModel::GetInstance()->GetType();
290 if (type != XComponentType::NODE) {
291 return;
292 }
293 JSInteractableView::JsOnDisAppear(args);
294 }
295
JsOnTouch(const JSCallbackInfo & args)296 void JSXComponent::JsOnTouch(const JSCallbackInfo& args)
297 {
298 auto type = XComponentModel::GetInstance()->GetType();
299 if (type != XComponentType::NODE) {
300 return;
301 }
302 JSInteractableView::JsOnTouch(args);
303 }
304
JsOnClick(const JSCallbackInfo & args)305 void JSXComponent::JsOnClick(const JSCallbackInfo& args)
306 {
307 auto type = XComponentModel::GetInstance()->GetType();
308 if (type != XComponentType::NODE) {
309 return;
310 }
311 JSViewAbstract::JsOnClick(args);
312 }
313
JsOnKeyEvent(const JSCallbackInfo & args)314 void JSXComponent::JsOnKeyEvent(const JSCallbackInfo& args)
315 {
316 auto type = XComponentModel::GetInstance()->GetType();
317 if (type != XComponentType::NODE) {
318 return;
319 }
320 JSViewAbstract::JsOnKeyEvent(args);
321 }
322
JsOnMouse(const JSCallbackInfo & args)323 void JSXComponent::JsOnMouse(const JSCallbackInfo& args)
324 {
325 auto type = XComponentModel::GetInstance()->GetType();
326 if (type != XComponentType::NODE) {
327 return;
328 }
329 JSViewAbstract::JsOnMouse(args);
330 }
331
JsOnHover(const JSCallbackInfo & args)332 void JSXComponent::JsOnHover(const JSCallbackInfo& args)
333 {
334 auto type = XComponentModel::GetInstance()->GetType();
335 if (type != XComponentType::NODE) {
336 return;
337 }
338 JSViewAbstract::JsOnHover(args);
339 }
340
341
JsOnFocus(const JSCallbackInfo & args)342 void JSXComponent::JsOnFocus(const JSCallbackInfo& args)
343 {
344 auto type = XComponentModel::GetInstance()->GetType();
345 if (type != XComponentType::NODE) {
346 return;
347 }
348 JSViewAbstract::JsOnFocus(args);
349 }
350
JsOnBlur(const JSCallbackInfo & args)351 void JSXComponent::JsOnBlur(const JSCallbackInfo& args)
352 {
353 auto type = XComponentModel::GetInstance()->GetType();
354 if (type != XComponentType::NODE) {
355 return;
356 }
357 JSViewAbstract::JsOnBlur(args);
358 }
359
JsBackgroundColor(const JSCallbackInfo & args)360 void JSXComponent::JsBackgroundColor(const JSCallbackInfo& args)
361 {
362 auto type = XComponentModel::GetInstance()->GetType();
363 if (!XComponentModel::IsBackGroundColorAvailable(type)) {
364 return;
365 }
366 if (args.Length() < 1) {
367 return;
368 }
369 Color backgroundColor;
370 if (!ParseJsColor(args[0], backgroundColor)) {
371 backgroundColor = (type == XComponentType::SURFACE) ? Color::BLACK : Color::TRANSPARENT;
372 }
373 ViewAbstractModel::GetInstance()->SetBackgroundColor(backgroundColor);
374 }
375
JsBackgroundImage(const JSCallbackInfo & args)376 void JSXComponent::JsBackgroundImage(const JSCallbackInfo& args)
377 {
378 auto type = XComponentModel::GetInstance()->GetType();
379 if (type != XComponentType::NODE) {
380 return;
381 }
382 JSViewAbstract::JsBackgroundImage(args);
383 }
384
JsBackgroundImageSize(const JSCallbackInfo & args)385 void JSXComponent::JsBackgroundImageSize(const JSCallbackInfo& args)
386 {
387 auto type = XComponentModel::GetInstance()->GetType();
388 if (type != XComponentType::NODE) {
389 return;
390 }
391 JSViewAbstract::JsHueRotate(args);
392 }
393
JsBackgroundImagePosition(const JSCallbackInfo & args)394 void JSXComponent::JsBackgroundImagePosition(const JSCallbackInfo& args)
395 {
396 auto type = XComponentModel::GetInstance()->GetType();
397 if (type != XComponentType::NODE) {
398 return;
399 }
400 JSViewAbstract::JsBackgroundImagePosition(args);
401 }
402
403
JsOpacity(const JSCallbackInfo & args)404 void JSXComponent::JsOpacity(const JSCallbackInfo& args)
405 {
406 auto type = XComponentModel::GetInstance()->GetType();
407 if (type == XComponentType::SURFACE || type == XComponentType::COMPONENT) {
408 return;
409 }
410 JSViewAbstract::JsOpacity(args);
411 }
412
JsBlur(const JSCallbackInfo & args)413 void JSXComponent::JsBlur(const JSCallbackInfo& args)
414 {
415 auto type = XComponentModel::GetInstance()->GetType();
416 if (type != XComponentType::NODE) {
417 return;
418 }
419 JSViewAbstract::JsBlur(args);
420 }
421
JsBackdropBlur(const JSCallbackInfo & args)422 void JSXComponent::JsBackdropBlur(const JSCallbackInfo& args)
423 {
424 auto type = XComponentModel::GetInstance()->GetType();
425 if (type != XComponentType::NODE) {
426 return;
427 }
428 JSViewAbstract::JsBackdropBlur(args);
429 }
430
JsGrayscale(const JSCallbackInfo & args)431 void JSXComponent::JsGrayscale(const JSCallbackInfo& args)
432 {
433 auto type = XComponentModel::GetInstance()->GetType();
434 if (type != XComponentType::NODE) {
435 return;
436 }
437 // JSViewAbstract::JsGrayscale(args);
438 }
439
JsBrightness(const JSCallbackInfo & args)440 void JSXComponent::JsBrightness(const JSCallbackInfo& args)
441 {
442 auto type = XComponentModel::GetInstance()->GetType();
443 if (type != XComponentType::NODE) {
444 return;
445 }
446 JSViewAbstract::JsBrightness(args);
447 }
448
JsSaturate(const JSCallbackInfo & args)449 void JSXComponent::JsSaturate(const JSCallbackInfo& args)
450 {
451 auto type = XComponentModel::GetInstance()->GetType();
452 if (type != XComponentType::NODE) {
453 return;
454 }
455 JSViewAbstract::JsSaturate(args);
456 }
457
JsContrast(const JSCallbackInfo & args)458 void JSXComponent::JsContrast(const JSCallbackInfo& args)
459 {
460 auto type = XComponentModel::GetInstance()->GetType();
461 if (type != XComponentType::NODE) {
462 return;
463 }
464 JSViewAbstract::JsContrast(args);
465 }
466
JsInvert(const JSCallbackInfo & args)467 void JSXComponent::JsInvert(const JSCallbackInfo& args)
468 {
469 auto type = XComponentModel::GetInstance()->GetType();
470 if (type != XComponentType::NODE) {
471 return;
472 }
473 JSViewAbstract::JsInvert(args);
474 }
475
JsSepia(const JSCallbackInfo & args)476 void JSXComponent::JsSepia(const JSCallbackInfo& args)
477 {
478 auto type = XComponentModel::GetInstance()->GetType();
479 if (type != XComponentType::NODE) {
480 return;
481 }
482 JSViewAbstract::JsSepia(args);
483 }
484
JsHueRotate(const JSCallbackInfo & args)485 void JSXComponent::JsHueRotate(const JSCallbackInfo& args)
486 {
487 auto type = XComponentModel::GetInstance()->GetType();
488 if (type != XComponentType::NODE) {
489 return;
490 }
491 JSViewAbstract::JsHueRotate(args);
492 }
493
JsColorBlend(const JSCallbackInfo & args)494 void JSXComponent::JsColorBlend(const JSCallbackInfo& args)
495 {
496 auto type = XComponentModel::GetInstance()->GetType();
497 if (type != XComponentType::NODE) {
498 return;
499 }
500 JSViewAbstract::JsColorBlend(args);
501 }
502
JsSphericalEffect(const JSCallbackInfo & args)503 void JSXComponent::JsSphericalEffect(const JSCallbackInfo& args)
504 {
505 auto type = XComponentModel::GetInstance()->GetType();
506 if (type != XComponentType::NODE) {
507 return;
508 }
509 JSViewAbstract::JsSphericalEffect(args);
510 }
511
JsLightUpEffect(const JSCallbackInfo & args)512 void JSXComponent::JsLightUpEffect(const JSCallbackInfo& args)
513 {
514 auto type = XComponentModel::GetInstance()->GetType();
515 if (type != XComponentType::NODE) {
516 return;
517 }
518 JSViewAbstract::JsLightUpEffect(args);
519 }
520
JsPixelStretchEffect(const JSCallbackInfo & args)521 void JSXComponent::JsPixelStretchEffect(const JSCallbackInfo& args)
522 {
523 auto type = XComponentModel::GetInstance()->GetType();
524 if (type != XComponentType::NODE) {
525 return;
526 }
527 JSViewAbstract::JsPixelStretchEffect(args);
528 }
529
JsLinearGradientBlur(const JSCallbackInfo & args)530 void JSXComponent::JsLinearGradientBlur(const JSCallbackInfo& args)
531 {
532 auto type = XComponentModel::GetInstance()->GetType();
533 if (type != XComponentType::NODE) {
534 return;
535 }
536 JSViewAbstract::JsLinearGradientBlur(args);
537 }
538
539 } // namespace OHOS::Ace::Framework
540