diff --git a/adapter/ohos/entrance/ace_container.cpp b/adapter/ohos/entrance/ace_container.cpp index 5d894954fa8fc54c565c3f8488427a5ffab0cfa5..5718977a7139d5d2bd573046317e00a2ea354707 100644 --- a/adapter/ohos/entrance/ace_container.cpp +++ b/adapter/ohos/entrance/ace_container.cpp @@ -2857,6 +2857,10 @@ void AceContainer::AttachView(std::shared_ptr window, const RefPtrAttachPipelineContext(pipelineContext_); + if ((type_ == FrontendType::STATIC_HYBRID_DYNAMIC || type_ == FrontendType::DYNAMIC_HYBRID_STATIC) && + subFrontend_) { + subFrontend_->AttachPipelineContext(pipelineContext_); + } } else if (frontend_->GetType() == FrontendType::DECLARATIVE_JS) { if (declarativeFrontend) { declarativeFrontend->AttachSubPipelineContext(pipelineContext_); diff --git a/frameworks/bridge/arkts_frontend/arkts_frontend.cpp b/frameworks/bridge/arkts_frontend/arkts_frontend.cpp index 8fa5df5feee555923e702bef783c9c2e99404a42..b41d412a6707a983674865d8ada576ab470dffb5 100644 --- a/frameworks/bridge/arkts_frontend/arkts_frontend.cpp +++ b/frameworks/bridge/arkts_frontend/arkts_frontend.cpp @@ -493,6 +493,19 @@ void ArktsFrontend::OpenStateMgmtInterop() return; } +napi_value ArktsFrontend::GetContextValue() +{ + auto container = Container::Current(); + CHECK_NULL_RETURN(container, nullptr); + auto type = container->GetFrontendType(); + if (type == FrontendType::STATIC_HYBRID_DYNAMIC && container->GetSubFrontend()) { + // support 1.1 call getUIContext when STATIC_HYBRID_DYNAMIC + return container->GetSubFrontend()->GetContextValue(); + } else { + return nullptr; // Default behavior + } +} + bool ArktsFrontend::HandleMessage(void *frameNode, int32_t type, const std::string& param) { auto* env = ArktsAniUtils::GetAniEnv(vm_); diff --git a/frameworks/bridge/arkts_frontend/arkts_frontend.h b/frameworks/bridge/arkts_frontend/arkts_frontend.h index bbd6638ea43a455a02957658a793b1c3b9232064..0dd19f65b6dcb95916feb3f95516888c32a7ffcf 100644 --- a/frameworks/bridge/arkts_frontend/arkts_frontend.h +++ b/frameworks/bridge/arkts_frontend/arkts_frontend.h @@ -266,6 +266,7 @@ public: void RebuildAllPages() override {} void NotifyAppStorage(const std::string& key, const std::string& value) override {} bool HandleMessage(void* frameNode, int32_t type, const std::string& param) override; + napi_value GetContextValue() override; RefPtr GetEventHandler() override { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/SymbolGlyphModifier.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/SymbolGlyphModifier.ts index 335e2595e7ef3e434946548ad3a0a18b37d181ac..000a11e3219be155e364e18a929acef20aa76a20 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/SymbolGlyphModifier.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/SymbolGlyphModifier.ts @@ -16,15 +16,21 @@ import { int32 } from '@koalaui/common' import { AttributeModifier } from 'arkui/component/common'; import { SymbolGlyphAttribute } from 'arkui/component/symbolglyph'; -import { RuntimeType, runtimeType } from "@koalaui/interop"; +import { KPointer, RuntimeType, runtimeType } from "@koalaui/interop"; import { AttributeUpdaterFlag, CommonMethodModifier } from './CommonMethodModifier'; +import { applyUIAttributes } from './handwritten/modifiers/ArkCommonModifier'; import { PeerNode } from './PeerNode'; import { ArkSymbolGlyphPeer, SymbolEffect, SymbolEffectStrategy, SymbolRenderingStrategy } from './component/symbolglyph'; import { FontWeight } from './component/enums'; import { ResourceColor } from "./component/units"; import { Resource } from 'global.resource'; +class ArkSymbolGlyphPeerCustom extends ArkSymbolGlyphPeer { + public constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { + super(peerPtr, id, name, flags) + } +} export class SymbolGlyphModifier extends CommonMethodModifier implements SymbolGlyphAttribute, AttributeModifier { constructor(src?: Resource) { super() @@ -61,6 +67,17 @@ export class SymbolGlyphModifier extends CommonMethodModifier implements SymbolG _symbolEffect0_value?: SymbolEffect | undefined _symbolEffect1_value?: boolean | number | undefined + public static applySymbolGlyphModifierToNode(modifier: SymbolGlyphModifier, nodePtr: KPointer): void { + const peerId = PeerNode.nextId() + const node = new ArkSymbolGlyphPeerCustom(nodePtr, peerId, "SymbolGlyph") + const node_casted = node as PeerNode + let currentState = node_casted.getStateStyleMutable() + if (currentState === undefined) { + currentState = node_casted.getOrCreateStateStyleMutable()! + } + applyUIAttributes(modifier, modifier, currentState.value) + modifier.applyModifierPatch(node_casted) + } public setSymbolGlyphOptions(value: Resource | undefined): this { if (this._setSymbolGlyphOptions_flag === AttributeUpdaterFlag.INITIAL || this._setSymbolGlyphOptions0_value !== value || !Type.of(value).isPrimitive()) { @@ -441,4 +458,4 @@ export class SymbolGlyphModifier extends CommonMethodModifier implements SymbolG } } } -} \ No newline at end of file +} diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts index 09e2e11867776b2aca080739707ac5dd9aae1632..a9323fa0d8e2c594ad0ba5ffe3fdce473607b3c5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/arkts/ArkUIAniModule.ts @@ -30,6 +30,7 @@ import { dragController } from "@ohos/arkui/dragController" import { componentSnapshot } from "@ohos/arkui/componentSnapshot" import { DrawableDescriptor } from "@ohos.arkui.drawableDescriptor" import { uiObserver } from "@ohos/arkui/observer" +import { SymbolGlyphModifier } from "../../SymbolGlyphModifier" export class ArkUIAniModule { static { @@ -194,6 +195,9 @@ export class ArkUIAniModule { native static _StyledString_SetPixelMap(peerPtr: KPointer, pixelmap: image.PixelMap): void native static _StyledString_GetPixelMap(peerPtr: KPointer): image.PixelMap + // for search + native static _Search_SetSearchIcon_Symbol(ptr: KPointer, value: SymbolGlyphModifier): void + // for ImageSpan native static _ImageSpan_Set_PixelMap(ptr: KPointer, pixelmap: image.PixelMap): void native static _ImageSpan_SetAlt_PixelMap(ptr: KPointer, pixelmap: image.PixelMap): void diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn index 574e984fab630abc9b45d48552814c2c8415a384..68a8c56eb2ca5442b13e000829aad567b522da81 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/BUILD.gn @@ -51,6 +51,7 @@ ohos_shared_library("arkoala_native_ani") { "interop/interop_module.cpp", "load.cpp", "module.cpp", + "search/search_module.cpp", "shape/shape_module_methods.cpp", "styled_string/styled_string_module.cpp", "utils/ani_utils.cpp", diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp index 04bb6897fa465440e6ba0304405bebe521aa4d72..bc0d33e561a08e5697f43fc22f7c31fccb00c3cb 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/module.cpp @@ -38,6 +38,7 @@ #include "web/web_module_methods.h" #include "video/video_module_methods.h" #include "rich_editor/rich_editor_module.h" +#include "search/search_module.h" #include "stateMgmt/stateMgmt_module.h" #include "shape/shape_module_methods.h" #include "xcomponent/xcomponent_module_methods.h" @@ -622,6 +623,11 @@ ANI_EXPORT ani_status ANI_Constructor(ani_vm* vm, uint32_t* result) "J:L@ohos/multimedia/image/image/PixelMap;", reinterpret_cast(OHOS::Ace::Ani::StyledStringModule::GetPixelMap) }, + ani_native_function { + "_Search_SetSearchIcon_Symbol", + nullptr, + reinterpret_cast(OHOS::Ace::Ani::SetSearchIconSymbol) + }, ani_native_function { "_ImageSpan_Set_PixelMap", "JL@ohos/multimedia/image/image/PixelMap;:V", diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/search/search_module.cpp b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/search/search_module.cpp new file mode 100644 index 0000000000000000000000000000000000000000..84a8f14a7ec227b5845db54f9966fe1eb733fceb --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/search/search_module.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "search_module.h" + +#include "bridge/arkts_frontend/arkts_ani_utils.h" +#include "core/pipeline/pipeline_base.h" +#include "load.h" +#include "log/log.h" + +namespace OHOS::Ace::Ani { + +void SetSearchIconSymbol(ani_env* env, [[maybe_unused]] ani_object obj, ani_long node, + ani_object symbolModifierAni) +{ + auto* arkNode = reinterpret_cast(node); + const auto* modifier = GetNodeAniModifier(); + if (!modifier || !arkNode) { + return; + } + + ani_class cls; + static const char *className = "Larkui/SymbolGlyphModifier/SymbolGlyphModifier;"; + auto ani_status = env->FindClass(className, &cls); + if (ani_status != ANI_OK) { + HILOGE("SearchIcon findClass failed, className: %{public}s", className); + return; + } + + ani_static_method etsFunc = nullptr; + if (ANI_OK != env->Class_FindStaticMethod(cls, "applySymbolGlyphModifierToNode", nullptr, &etsFunc)) { + HILOGE("SearchIcon findMethod failed"); + return; + } + + std::function)> symbolApply = + [env, cls, etsFunc, symbolModifierAni](WeakPtr frameNode) -> void { + auto node = frameNode.Upgrade(); + env->Class_CallStaticMethod_Void(cls, etsFunc, symbolModifierAni, node.GetRawPtr()); + }; + + modifier->getSearchAniModifier()->setSearchIconSymbol(arkNode, symbolApply); +} +} // namespace OHOS::Ace::Ani diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/search/search_module.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/search/search_module.h new file mode 100644 index 0000000000000000000000000000000000000000..49083c2e904a8630ee7eec9f27f6a28e4b1a23bd --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/ani/native/search/search_module.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_SEARCH_MODULE_H +#define KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_SEARCH_MODULE_H + +#include "ani.h" + +namespace OHOS::Ace::Ani { +void SetSearchIconSymbol(ani_env* env, [[maybe_unused]] ani_object obj, ani_long node, + ani_object symbolModifierAni); +} // namespace OHOS::Ace::Ani + +#endif // KOALA_PROJECTS_ARKOALA_ARKTS_ARKUI_OHOS_ANI_NATIVE_SEARCH_MODULE_H diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/search.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/search.ts index 36a10a87ed02b2e85e7f1a826be3d7f598cb9410..3c7f2177965c55b605bc0970a0f54eed86365cc7 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/search.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/search.ts @@ -1152,8 +1152,7 @@ export class ArkSearchComponent extends ArkCommonMethodComponent implements Sear } public searchIcon(value: IconOptions | SymbolGlyphModifier | undefined): this { if (this.checkPriority("searchIcon")) { - const value_casted = value as (IconOptions | SymbolGlyphModifier | undefined) - this.getPeer()?.searchIconAttribute(value_casted) + hookSetSearchIconSymbol(this, value) return this } return this diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/search.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/search.ts index 955f8d334b40d0621dd16e419439b954884097f4..518f994e67400f328415d6775458de6bc2f948a5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/search.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/handwritten/component/search.ts @@ -2,6 +2,7 @@ import { InteropNativeModule, RuntimeType } from "@koalaui/interop"; import { int32 } from "@koalaui/common"; import { ArkUIGeneratedNativeModule } from "#components"; import { SearchOpsHandWritten } from "./../handwritten" +import { ArkUIAniModule } from "arkui.ani"; function SearchOptionsValueIsBindable(value?: SearchOptions) : boolean { if ((RuntimeType.UNDEFINED) != runtimeType(value)) { @@ -22,3 +23,14 @@ function hookSetSearchOptions(searchComponent: ArkSearchComponent, options?: Sea (options!.value as Bindable)); } } + +function hookSetSearchIconSymbol(searchComponent: ArkSearchComponent, + value: IconOptions | SymbolGlyphModifier | undefined): void { + const value_casted = value as (IconOptions | SymbolGlyphModifier | undefined) + if (value_casted !== undefined && value_casted instanceof SymbolGlyphModifier) { + ArkUIAniModule._Search_SetSearchIcon_Symbol(searchComponent.getPeer().getPeerPtr(), + value_casted as SymbolGlyphModifier) + return + } + searchComponent.getPeer()?.searchIconAttribute(value_casted) +} diff --git a/frameworks/core/components_ng/pattern/search/search_model_static.cpp b/frameworks/core/components_ng/pattern/search/search_model_static.cpp index 607fe851aab8ca95e82153a6614d74a07eea64a6..4d41fcc7ac69f674aa5375058dff1bdd7792e995 100644 --- a/frameworks/core/components_ng/pattern/search/search_model_static.cpp +++ b/frameworks/core/components_ng/pattern/search/search_model_static.cpp @@ -623,4 +623,16 @@ void SearchModelStatic::SetOnChangeEvent(FrameNode* frameNode, }; eventHub->SetOnChangeEvent(std::move(searchChangeFunc)); } + +void SearchModelStatic::SetSearchSymbolIcon(FrameNode *frameNode, + std::function)>& iconSymbol) +{ + auto layoutProperty = frameNode->GetLayoutProperty(); + CHECK_NULL_VOID(layoutProperty); + layoutProperty->SetSearchIconSymbol(iconSymbol); + auto pattern = ViewStackProcessor::GetInstance()->GetMainFrameNodePattern(frameNode); + CHECK_NULL_VOID(pattern); + pattern->SetSearchSymbolIcon(); +} + } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/search/search_model_static.h b/frameworks/core/components_ng/pattern/search/search_model_static.h index 67a06074948ab6a8ab6b598e80b028a2faf1afbe..0c1d5bb88abc7b471368599d2e82aebd1146fd4c 100644 --- a/frameworks/core/components_ng/pattern/search/search_model_static.h +++ b/frameworks/core/components_ng/pattern/search/search_model_static.h @@ -68,7 +68,7 @@ public: static void SetSearchDefaultIcon(FrameNode *frameNode); static void SetCancelDefaultIcon(FrameNode* frameNode); static void SetOnChangeEvent(FrameNode* frameNode, std::function&& onChangeEvent); - + static void SetSearchSymbolIcon(FrameNode *frameNode, std::function)>& iconSymbol); private: }; diff --git a/frameworks/core/components_ng/pattern/text/span_model_static.cpp b/frameworks/core/components_ng/pattern/text/span_model_static.cpp index e0d38a6dfb1ee7978e0804f64b76be6e1332628e..9f271eb7e5bb032dc8640d8aaad2de1071e32238 100644 --- a/frameworks/core/components_ng/pattern/text/span_model_static.cpp +++ b/frameworks/core/components_ng/pattern/text/span_model_static.cpp @@ -117,8 +117,7 @@ void SpanModelStatic::SetFontFamily(UINode* uiNode, const std::optional& value) { if (value) { - SetTextDecoration(uiNode, value.value()); - // ACE_UPDATE_NODE_SPAN_PROPERTY(TextDecoration, value.value(), uiNode); + ACE_UPDATE_NODE_SPAN_PROPERTY(TextDecoration, {value.value()}, uiNode); } else { ACE_RESET_NODE_SPAN_PROPERTY(TextDecoration, uiNode); } @@ -169,4 +168,4 @@ void SpanModelStatic::SetBaselineOffset(UINode* uiNode, const std::optional #include +#include "base/memory/referenced.h" +#include "core/components_ng/base/frame_node.h" + #ifdef __cplusplus extern "C" { #endif @@ -404,6 +407,10 @@ struct ArkUIAniImageSpanModifier { void (*setAltPixelMap)(ArkUINodeHandle node, void* pixelmap); void (*setDrawingColorFilter)(ArkUINodeHandle node, void* colorFilter); }; +struct ArkUIAniSearchModifier { + void (*setSearchIconSymbol)(ArkUINodeHandle node, + std::function)>& symbolApply); +}; struct ArkUIAniStyledStringModifier { void (*setPixelMap)(ArkUIStyledString peer, void* nativePixelMap); void* (*getPixelMap)(ArkUIStyledString peer); @@ -483,6 +490,7 @@ struct ArkUIAniModifiers { const ArkUIAniInteropModifier* (*getInteropAniModifier)(); const ArkUIAniDragControllerModifier* (*getDragControllerAniModifier)(); const ArkUIAniStyledStringModifier* (*getStyledStringAniModifier)(); + const ArkUIAniSearchModifier* (*getSearchAniModifier)(); const ArkUIAniImageSpanModifier* (*getImageSpanAniModifier)(); const ArkUIAniVideoModifier* (*getArkUIAniVideoModifier)(); const ArkUIAniShapeModifier* (*getArkUIAniShapeModifier)(); diff --git a/frameworks/core/interfaces/native/BUILD.gn b/frameworks/core/interfaces/native/BUILD.gn index 88dced4a58cd3a0b81fb6309b5773a0857b466e3..beaae80842fd69dd488cc6ad79fce936a7683425 100644 --- a/frameworks/core/interfaces/native/BUILD.gn +++ b/frameworks/core/interfaces/native/BUILD.gn @@ -161,6 +161,7 @@ template("ace_core_interfaces_native_node") { "ani/image_ani_modifier.cpp", "ani/image_span_ani_modifier.cpp", "ani/node_ani_modifier.cpp", + "ani/search_ani_modifier.cpp", "ani/styled_string_ani_modifier.cpp", "ani/web_ani_modifier.cpp", "ani/waterflow_ani_modifier.cpp", diff --git a/frameworks/core/interfaces/native/ani/node_ani_modifier.cpp b/frameworks/core/interfaces/native/ani/node_ani_modifier.cpp index 62d08e120c283a273a7056e50b025c9924d4b499..fea96d1bab5e90e6a8e8cafa39bcf05a7dd98881 100644 --- a/frameworks/core/interfaces/native/ani/node_ani_modifier.cpp +++ b/frameworks/core/interfaces/native/ani/node_ani_modifier.cpp @@ -21,6 +21,7 @@ #include "content_slot_ani_modifier.h" #include "image_ani_modifier.h" #include "image_span_ani_modifier.h" +#include "search_ani_modifier.h" #include "styled_string_ani_modifier.h" #include "web_ani_modifier.h" #include "custom_node_ani_modifier.h" @@ -58,6 +59,7 @@ const ArkUIAniModifiers* GetArkUIAniModifiers() .getInteropAniModifier = OHOS::Ace::NG::GetInteropAniModifier, .getDragControllerAniModifier = OHOS::Ace::NG::GetDragControllerAniModifier, .getStyledStringAniModifier = OHOS::Ace::NG::GetStyledStringAniModifier, + .getSearchAniModifier = OHOS::Ace::NG::GetSearchAniModifier, .getImageSpanAniModifier = OHOS::Ace::NG::GetImageSpanAniModifier, .getArkUIAniVideoModifier = OHOS::Ace::NG::GetVideoAniModifier, .getArkUIAniShapeModifier = OHOS::Ace::NG::GetShapeAniModifier, diff --git a/frameworks/core/interfaces/native/ani/search_ani_modifier.cpp b/frameworks/core/interfaces/native/ani/search_ani_modifier.cpp new file mode 100644 index 0000000000000000000000000000000000000000..77f95d86b1efe1edcc7f0b195dcdb39b3f71918f --- /dev/null +++ b/frameworks/core/interfaces/native/ani/search_ani_modifier.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "search_ani_modifier.h" + +#include "base/log/log.h" +#include "core/components_ng/base/frame_node.h" +#include "core/components_ng/pattern/search/search_model_static.h" + +namespace OHOS::Ace::NG { + +void SetSearchIconSymbolModifier(ArkUINodeHandle node, + std::function)>& symbolApply) +{ + auto frameNode = reinterpret_cast(node); + SearchModelStatic::SetSearchSymbolIcon(frameNode, symbolApply); +} + +const ArkUIAniSearchModifier* GetSearchAniModifier() +{ + static const ArkUIAniSearchModifier impl = { + .setSearchIconSymbol = OHOS::Ace::NG::SetSearchIconSymbolModifier + }; + return &impl; +} + +} // namespace OHOS::Ace::NG diff --git a/frameworks/core/interfaces/native/ani/search_ani_modifier.h b/frameworks/core/interfaces/native/ani/search_ani_modifier.h new file mode 100644 index 0000000000000000000000000000000000000000..01274f009953667c47fdfcf5648e9f92174de75e --- /dev/null +++ b/frameworks/core/interfaces/native/ani/search_ani_modifier.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NATIVE_ANI_SEARCH_ANI_MODIFIER_H +#define FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NATIVE_ANI_SEARCH_ANI_MODIFIER_H + +#include "core/interfaces/ani/ani_api.h" + +namespace OHOS::Ace::NG { +const ArkUIAniSearchModifier* GetSearchAniModifier(); +} // namespace OHOS::Ace::NG + +#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NATIVE_ANI_SEARCH_ANI_MODIFIER_H \ No newline at end of file diff --git a/frameworks/core/interfaces/native/utility/converter.cpp b/frameworks/core/interfaces/native/utility/converter.cpp index dddf53b40c1abc913d9856b8ea183794ce87d177..e11659485d3623e7abe41751fd9a01048295b97a 100644 --- a/frameworks/core/interfaces/native/utility/converter.cpp +++ b/frameworks/core/interfaces/native/utility/converter.cpp @@ -830,7 +830,7 @@ template<> Color Convert(const Ark_Number& src) { uint32_t value = static_cast(Convert(src)); - return Color((value <= 0xFFFFFF && value > 0) ? value + 0xFF000000U : value); + return Color(ColorAlphaAdapt(value)); } template<>