From 4645fd14fc22c7766aa0c1eec9d99dc97938ba04 Mon Sep 17 00:00:00 2001 From: xiongjun_gitee11 Date: Tue, 9 Sep 2025 15:45:30 +0800 Subject: [PATCH] add web arkts 1.2 Signed-off-by: xiongjun_gitee11 --- .../arkts/ArkUIGeneratedNativeModule.ts | 2 + .../src/component/arkts/type_check.ts | 8 +- .../src/component/peers/Deserializer.ts | 16 +++- .../src/component/peers/Serializer.ts | 16 ++++ .../arkui-ohos/src/component/ts/type_check.ts | 8 +- .../arkui-ohos/src/component/web.ts | 41 ++++++++++- .../native/src/generated/Serializers.h | 73 +++++++++++++++++++ .../src/generated/arkoala_api_generated.h | 15 ++++ .../native/src/generated/bridge_generated.cc | 14 ++++ .../native/src/generated/dummy_impl.cc | 11 +++ .../native/src/generated/real_impl.cc | 5 ++ .../pattern/web/ani/web_model_static.cpp | 8 ++ .../pattern/web/ani/web_model_static.h | 1 + .../interface/arkoala_api_generated.h | 15 ++++ .../native/implementation/web_modifier.cpp | 19 ++++- .../interfaces/native/utility/converter.h | 1 + .../interfaces/native/utility/converter2.h | 1 + .../native/utility/converter_enums.cpp | 17 +++++ .../utility/generated/converter_generated.h | 1 + .../pattern/web/ani/web_model_static_test.cpp | 26 +++++++ 20 files changed, 290 insertions(+), 8 deletions(-) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts index eebfb7f9ba9..3926441a768 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts @@ -3584,6 +3584,8 @@ export class ArkUIGeneratedNativeModule { @ani.unsafe.Direct native static _WebAttribute_bindSelectionMenu(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void @ani.unsafe.Direct + native static _WebAttribute_gestureFocusMode(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct native static _WindowScene_construct(id: KInt, flags: KInt): KPointer @ani.unsafe.Direct native static _WindowSceneInterface_setWindowSceneOptions(ptr: KPointer, persistentId: number): void diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/type_check.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/type_check.ts index a01944d04a5..ea0a9784143 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/type_check.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/type_check.ts @@ -39,7 +39,7 @@ import { ReplaceSymbolEffect, ScaleSymbolEffect, SymbolEffect, EffectDirection, import { FontOptions, FontInfo, UIFontAdjustInfo, UIFontAliasInfo, UIFontFallbackInfo, UIFontConfig, UIFontGenericInfo, UIFontFallbackGroupInfo } from "@ohos/font" import { MeasureOptions } from "@ohos/measure" import { DrawingCanvas, RectType } from "./../arkui-drawing" -import { BlurOnKeyboardHideMode, CacheMode, ClientAuthenticationHandler, ConsoleMessage, MessageLevel, ContextMenuEditStateFlags, ContextMenuInputFieldType, ContextMenuMediaType, ContextMenuSourceType, ControllerHandler, DataResubmissionHandler, EventResult, FileSelectorMode, FileSelectorParam, FileSelectorResult, FullScreenExitHandler, HitTestType, HttpAuthHandler, JsGeolocation, JsResult, Literal_Function_callback__Object_fileSelector, Literal_Function_handler_Object_error, Literal_Object_detail, MixedMode, NativeEmbedStatus, NativeMediaPlayerConfig, OnAudioStateChangedEvent, OnConsoleEvent, OnDataResubmittedEvent, OnFirstContentfulPaintEvent, OnOverScrollEvent, OnProgressChangeEvent, OnScaleChangeEvent, OnScrollEvent, OnSearchResultReceiveEvent, OnShowFileSelectorEvent, OverScrollMode, PermissionRequest, ProtectedResourceType, RenderExitReason, RenderMode, RenderProcessNotRespondingReason, ScreenCaptureHandler, ScreenCaptureConfig, SslError, SslErrorHandler, ThreatType, ViewportFit, ScriptItem, ExpandedMenuItemOptions, WebAttribute, JavaScriptProxy, WebDarkMode, WebMediaOptions, Callback_OnPageEndEvent_Void, OnPageEndEvent, Callback_OnPageBeginEvent_Void, OnPageBeginEvent, Callback_OnProgressChangeEvent_Void, Callback_OnTitleReceiveEvent_Void, OnTitleReceiveEvent, Callback_OnGeolocationShowEvent_Void, OnGeolocationShowEvent, Callback_OnAlertEvent_Boolean, OnAlertEvent, Callback_OnBeforeUnloadEvent_Boolean, OnBeforeUnloadEvent, Callback_OnConfirmEvent_Boolean, OnConfirmEvent, Callback_OnPromptEvent_Boolean, OnPromptEvent, Callback_OnConsoleEvent_Boolean, Callback_OnErrorReceiveEvent_Void, OnErrorReceiveEvent, Callback_OnHttpErrorReceiveEvent_Void, OnHttpErrorReceiveEvent, Callback_OnDownloadStartEvent_Void, OnDownloadStartEvent, Callback_OnRefreshAccessedHistoryEvent_Void, OnRefreshAccessedHistoryEvent, Type_WebAttribute_onUrlLoadIntercept_callback, Literal_Union_String_WebResourceRequest_data, WebResourceRequest, Callback_Literal_Function_handler_Object_error_Void, Callback_OnRenderExitedEvent_Void, OnRenderExitedEvent, Callback_OnShowFileSelectorEvent_Boolean, Callback_Literal_Object_detail_Boolean, Type_WebAttribute_onFileSelectorShow_callback, Callback_OnResourceLoadEvent_Void, OnResourceLoadEvent, OnFullScreenEnterCallback, FullScreenEnterEvent, Callback_OnScaleChangeEvent_Void, Callback_OnHttpAuthRequestEvent_Boolean, OnHttpAuthRequestEvent, Callback_OnInterceptRequestEvent_WebResourceResponse, OnInterceptRequestEvent, WebResourceResponse, Callback_OnPermissionRequestEvent_Void, OnPermissionRequestEvent, Callback_OnScreenCaptureRequestEvent_Void, OnScreenCaptureRequestEvent, Callback_OnContextMenuShowEvent_Boolean, OnContextMenuShowEvent, OnContextMenuHideCallback, Callback_OnSearchResultReceiveEvent_Void, Callback_OnScrollEvent_Void, Callback_OnSslErrorEventReceiveEvent_Void, OnSslErrorEventReceiveEvent, OnSslErrorEventCallback, SslErrorEvent, Callback_OnClientAuthenticationEvent_Void, OnClientAuthenticationEvent, Callback_OnWindowNewEvent_Void, OnWindowNewEvent, Callback_OnTouchIconUrlReceivedEvent_Void, OnTouchIconUrlReceivedEvent, Callback_OnFaviconReceivedEvent_Void, OnFaviconReceivedEvent, Callback_OnPageVisibleEvent_Void, OnPageVisibleEvent, Callback_OnDataResubmittedEvent_Void, Callback_OnAudioStateChangedEvent_Void, Callback_OnFirstContentfulPaintEvent_Void, OnFirstMeaningfulPaintCallback, FirstMeaningfulPaint, OnLargestContentfulPaintCallback, LargestContentfulPaint, Callback_OnLoadInterceptEvent_Boolean, OnLoadInterceptEvent, Callback_OnOverScrollEvent_Void, OnSafeBrowsingCheckResultCallback, OnNavigationEntryCommittedCallback, LoadCommittedDetails, OnIntelligentTrackingPreventionCallback, IntelligentTrackingPreventionDetails, WebLayoutMode, NestedScrollOptionsExt, Callback_NativeEmbedDataInfo_Void, NativeEmbedDataInfo, OnNativeEmbedVisibilityChangeCallback, NativeEmbedVisibilityInfo, Callback_NativeEmbedTouchInfo_Void, NativeEmbedTouchInfo, OnOverrideUrlLoadingCallback, OnRenderProcessNotRespondingCallback, RenderProcessNotRespondingData, OnRenderProcessRespondingCallback, OnViewportFitChangedCallback, WebKeyboardCallback, WebKeyboardCallbackInfo, OnAdsBlockedCallback, AdsBlockedDetails, WebKeyboardAvoidMode, EmbedOptions, WebElementType, WebResponseType, SelectionMenuOptionsExt, WebCaptureMode, WebContextMenuParam, WebContextMenuResult, WebController, Literal_String_script_Callback_String_Void_callback_, Literal_String_baseUrl_data_encoding_historyUrl_mimeType, Literal_Union_String_Resource_url_Array_Header_headers, Header, Literal_Object_object__String_name_Array_String_methodList, WebCookie, WebKeyboardController, WebNavigationType, WebResourceError, Literal_String_plainText, WebKeyboardOptions, WebOptions, Callback_Literal_String_plainText_Void, NativeEmbedInfo } from "./../web" +import { BlurOnKeyboardHideMode, CacheMode, ClientAuthenticationHandler, ConsoleMessage, MessageLevel, ContextMenuEditStateFlags, ContextMenuInputFieldType, ContextMenuMediaType, ContextMenuSourceType, ControllerHandler, DataResubmissionHandler, EventResult, FileSelectorMode, FileSelectorParam, FileSelectorResult, FullScreenExitHandler, GestureFocusMode, HitTestType, HttpAuthHandler, JsGeolocation, JsResult, Literal_Function_callback__Object_fileSelector, Literal_Function_handler_Object_error, Literal_Object_detail, MixedMode, NativeEmbedStatus, NativeMediaPlayerConfig, OnAudioStateChangedEvent, OnConsoleEvent, OnDataResubmittedEvent, OnFirstContentfulPaintEvent, OnOverScrollEvent, OnProgressChangeEvent, OnScaleChangeEvent, OnScrollEvent, OnSearchResultReceiveEvent, OnShowFileSelectorEvent, OverScrollMode, PermissionRequest, ProtectedResourceType, RenderExitReason, RenderMode, RenderProcessNotRespondingReason, ScreenCaptureHandler, ScreenCaptureConfig, SslError, SslErrorHandler, ThreatType, ViewportFit, ScriptItem, ExpandedMenuItemOptions, WebAttribute, JavaScriptProxy, WebDarkMode, WebMediaOptions, Callback_OnPageEndEvent_Void, OnPageEndEvent, Callback_OnPageBeginEvent_Void, OnPageBeginEvent, Callback_OnProgressChangeEvent_Void, Callback_OnTitleReceiveEvent_Void, OnTitleReceiveEvent, Callback_OnGeolocationShowEvent_Void, OnGeolocationShowEvent, Callback_OnAlertEvent_Boolean, OnAlertEvent, Callback_OnBeforeUnloadEvent_Boolean, OnBeforeUnloadEvent, Callback_OnConfirmEvent_Boolean, OnConfirmEvent, Callback_OnPromptEvent_Boolean, OnPromptEvent, Callback_OnConsoleEvent_Boolean, Callback_OnErrorReceiveEvent_Void, OnErrorReceiveEvent, Callback_OnHttpErrorReceiveEvent_Void, OnHttpErrorReceiveEvent, Callback_OnDownloadStartEvent_Void, OnDownloadStartEvent, Callback_OnRefreshAccessedHistoryEvent_Void, OnRefreshAccessedHistoryEvent, Type_WebAttribute_onUrlLoadIntercept_callback, Literal_Union_String_WebResourceRequest_data, WebResourceRequest, Callback_Literal_Function_handler_Object_error_Void, Callback_OnRenderExitedEvent_Void, OnRenderExitedEvent, Callback_OnShowFileSelectorEvent_Boolean, Callback_Literal_Object_detail_Boolean, Type_WebAttribute_onFileSelectorShow_callback, Callback_OnResourceLoadEvent_Void, OnResourceLoadEvent, OnFullScreenEnterCallback, FullScreenEnterEvent, Callback_OnScaleChangeEvent_Void, Callback_OnHttpAuthRequestEvent_Boolean, OnHttpAuthRequestEvent, Callback_OnInterceptRequestEvent_WebResourceResponse, OnInterceptRequestEvent, WebResourceResponse, Callback_OnPermissionRequestEvent_Void, OnPermissionRequestEvent, Callback_OnScreenCaptureRequestEvent_Void, OnScreenCaptureRequestEvent, Callback_OnContextMenuShowEvent_Boolean, OnContextMenuShowEvent, OnContextMenuHideCallback, Callback_OnSearchResultReceiveEvent_Void, Callback_OnScrollEvent_Void, Callback_OnSslErrorEventReceiveEvent_Void, OnSslErrorEventReceiveEvent, OnSslErrorEventCallback, SslErrorEvent, Callback_OnClientAuthenticationEvent_Void, OnClientAuthenticationEvent, Callback_OnWindowNewEvent_Void, OnWindowNewEvent, Callback_OnTouchIconUrlReceivedEvent_Void, OnTouchIconUrlReceivedEvent, Callback_OnFaviconReceivedEvent_Void, OnFaviconReceivedEvent, Callback_OnPageVisibleEvent_Void, OnPageVisibleEvent, Callback_OnDataResubmittedEvent_Void, Callback_OnAudioStateChangedEvent_Void, Callback_OnFirstContentfulPaintEvent_Void, OnFirstMeaningfulPaintCallback, FirstMeaningfulPaint, OnLargestContentfulPaintCallback, LargestContentfulPaint, Callback_OnLoadInterceptEvent_Boolean, OnLoadInterceptEvent, Callback_OnOverScrollEvent_Void, OnSafeBrowsingCheckResultCallback, OnNavigationEntryCommittedCallback, LoadCommittedDetails, OnIntelligentTrackingPreventionCallback, IntelligentTrackingPreventionDetails, WebLayoutMode, NestedScrollOptionsExt, Callback_NativeEmbedDataInfo_Void, NativeEmbedDataInfo, OnNativeEmbedVisibilityChangeCallback, NativeEmbedVisibilityInfo, Callback_NativeEmbedTouchInfo_Void, NativeEmbedTouchInfo, OnOverrideUrlLoadingCallback, OnRenderProcessNotRespondingCallback, RenderProcessNotRespondingData, OnRenderProcessRespondingCallback, OnViewportFitChangedCallback, WebKeyboardCallback, WebKeyboardCallbackInfo, OnAdsBlockedCallback, AdsBlockedDetails, WebKeyboardAvoidMode, EmbedOptions, WebElementType, WebResponseType, SelectionMenuOptionsExt, WebCaptureMode, WebContextMenuParam, WebContextMenuResult, WebController, Literal_String_script_Callback_String_Void_callback_, Literal_String_baseUrl_data_encoding_historyUrl_mimeType, Literal_Union_String_Resource_url_Array_Header_headers, Header, Literal_Object_object__String_name_Array_String_methodList, WebCookie, WebKeyboardController, WebNavigationType, WebResourceError, Literal_String_plainText, WebKeyboardOptions, WebOptions, Callback_Literal_String_plainText_Void, NativeEmbedInfo } from "./../web" import { BreakpointsReference, GridRowDirection, Callback_String_Void, BreakPoints, GridRowColumnOption, GridRowSizeOption, GutterOption, GridRowOptions } from "./../gridRow" import { ButtonRole, ButtonStyleMode, ButtonType, ControlSize, ButtonOptions } from "./../button" import { CalendarAlign, CalendarPickerAttribute, Callback_Date_Void, CalendarOptions, CalendarDialogOptions } from "./../calendarPicker" @@ -4162,6 +4162,12 @@ export class TypeChecker { static GestureControl_GestureType_FromNumeric(ordinal: int32): GestureControl.GestureType { return GestureControl.GestureType.fromValue(ordinal) } + static GestureFocusMode_ToNumeric(value: GestureFocusMode): int32 { + return value.valueOf() + } + static GestureFocusMode_FromNumeric(ordinal: int32): GestureFocusMode { + return GestureFocusMode.fromValue(ordinal) + } static GestureJudgeResult_ToNumeric(value: GestureJudgeResult): int32 { return value.valueOf() } diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts index 3071e5569da..f61a195a3ec 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts @@ -19887,7 +19887,21 @@ export class Deserializer extends DeserializerBase { previewMenuOptions_buf = valueDeserializer.readPreviewMenuOptions() } const previewMenuOptions_result : PreviewMenuOptions | undefined = previewMenuOptions_buf - let value : SelectionMenuOptionsExt = ({onAppear: onAppear_result, onDisappear: onDisappear_result, preview: preview_result, menuType: menuType_result, previewMenuOptions: previewMenuOptions_result} as SelectionMenuOptionsExt) + const onMenuShow_buf_runtimeType = (valueDeserializer.readInt8() as int32) + let onMenuShow_buf : (() => void) | undefined + if ((RuntimeType.UNDEFINED) != (onMenuShow_buf_runtimeType)) + { + onMenuShow_buf = valueDeserializer.readCallback_Void() + } + const onMenuShow_result : (() => void) | undefined = onMenuShow_buf + const onMenuHide_buf_runtimeType = (valueDeserializer.readInt8() as int32) + let onMenuHide_buf : (() => void) | undefined + if ((RuntimeType.UNDEFINED) != (onMenuHide_buf_runtimeType)) + { + onMenuHide_buf = valueDeserializer.readCallback_Void() + } + const onMenuHide_result : (() => void) | undefined = onMenuHide_buf + let value : SelectionMenuOptionsExt = ({onAppear: onAppear_result, onDisappear: onDisappear_result, preview: preview_result, menuType: menuType_result, previewMenuOptions: previewMenuOptions_result, onMenuShow: onMenuShow_result, onMenuHide: onMenuHide_result} as SelectionMenuOptionsExt) return value } readSelectOption(): SelectOption { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts index c763b1b4783..11c2f009423 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts @@ -15926,6 +15926,22 @@ export class Serializer extends SerializerBase { const value_previewMenuOptions_value = value_previewMenuOptions! valueSerializer.writePreviewMenuOptions(value_previewMenuOptions_value) } + const value_onMenuShow = value.onMenuShow + let value_onMenuShow_type : int32 = RuntimeType.UNDEFINED + value_onMenuShow_type = runtimeType(value_onMenuShow) + valueSerializer.writeInt8(value_onMenuShow_type as int32) + if ((RuntimeType.UNDEFINED) != (value_onMenuShow_type)) { + const value_onMenuShow_value = value_onMenuShow! + valueSerializer.holdAndWriteCallback(value_onMenuShow_value) + } + const value_onMenuHide = value.onMenuHide + let value_onMenuHide_type : int32 = RuntimeType.UNDEFINED + value_onMenuHide_type = runtimeType(value_onMenuHide) + valueSerializer.writeInt8(value_onMenuHide_type as int32) + if ((RuntimeType.UNDEFINED) != (value_onMenuHide_type)) { + const value_onMenuHide_value = value_onMenuHide! + valueSerializer.holdAndWriteCallback(value_onMenuHide_value) + } } writeSelectOption(value: SelectOption): void { let valueSerializer : Serializer = this diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/ts/type_check.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/ts/type_check.ts index 3df170d3079..d62df318d13 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/ts/type_check.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/ts/type_check.ts @@ -38,7 +38,7 @@ import { ReplaceSymbolEffect, ScaleSymbolEffect, SymbolEffect, EffectDirection, import { FontOptions, FontInfo, UIFontAdjustInfo, UIFontAliasInfo, UIFontFallbackInfo, UIFontConfig, UIFontGenericInfo, UIFontFallbackGroupInfo } from "@ohos/font" import { MeasureOptions } from "@ohos/measure" import { DrawingCanvas, RectType } from "./../arkui-drawing" -import { BlurOnKeyboardHideMode, CacheMode, ClientAuthenticationHandler, ConsoleMessage, MessageLevel, ContextMenuEditStateFlags, ContextMenuInputFieldType, ContextMenuMediaType, ContextMenuSourceType, ControllerHandler, DataResubmissionHandler, EventResult, FileSelectorMode, FileSelectorParam, FileSelectorResult, FullScreenExitHandler, HitTestType, HttpAuthHandler, JsGeolocation, JsResult, Literal_Function_callback__Object_fileSelector, Literal_Function_handler_Object_error, Literal_Object_detail, MixedMode, NativeEmbedStatus, NativeMediaPlayerConfig, OnAudioStateChangedEvent, OnConsoleEvent, OnDataResubmittedEvent, OnFirstContentfulPaintEvent, OnOverScrollEvent, OnProgressChangeEvent, OnScaleChangeEvent, OnScrollEvent, OnSearchResultReceiveEvent, OnShowFileSelectorEvent, OverScrollMode, PermissionRequest, ProtectedResourceType, RenderExitReason, RenderMode, RenderProcessNotRespondingReason, ScreenCaptureHandler, ScreenCaptureConfig, SslError, SslErrorHandler, ThreatType, ViewportFit, ScriptItem, ExpandedMenuItemOptions, WebAttribute, JavaScriptProxy, WebDarkMode, WebMediaOptions, Callback_OnPageEndEvent_Void, OnPageEndEvent, Callback_OnPageBeginEvent_Void, OnPageBeginEvent, Callback_OnProgressChangeEvent_Void, Callback_OnTitleReceiveEvent_Void, OnTitleReceiveEvent, Callback_OnGeolocationShowEvent_Void, OnGeolocationShowEvent, Callback_OnAlertEvent_Boolean, OnAlertEvent, Callback_OnBeforeUnloadEvent_Boolean, OnBeforeUnloadEvent, Callback_OnConfirmEvent_Boolean, OnConfirmEvent, Callback_OnPromptEvent_Boolean, OnPromptEvent, Callback_OnConsoleEvent_Boolean, Callback_OnErrorReceiveEvent_Void, OnErrorReceiveEvent, Callback_OnHttpErrorReceiveEvent_Void, OnHttpErrorReceiveEvent, Callback_OnDownloadStartEvent_Void, OnDownloadStartEvent, Callback_OnRefreshAccessedHistoryEvent_Void, OnRefreshAccessedHistoryEvent, Type_WebAttribute_onUrlLoadIntercept_callback, Literal_Union_String_WebResourceRequest_data, WebResourceRequest, Callback_Literal_Function_handler_Object_error_Void, Callback_OnRenderExitedEvent_Void, OnRenderExitedEvent, Callback_OnShowFileSelectorEvent_Boolean, Callback_Literal_Object_detail_Boolean, Type_WebAttribute_onFileSelectorShow_callback, Callback_OnResourceLoadEvent_Void, OnResourceLoadEvent, OnFullScreenEnterCallback, FullScreenEnterEvent, Callback_OnScaleChangeEvent_Void, Callback_OnHttpAuthRequestEvent_Boolean, OnHttpAuthRequestEvent, Callback_OnInterceptRequestEvent_WebResourceResponse, OnInterceptRequestEvent, WebResourceResponse, Callback_OnPermissionRequestEvent_Void, OnPermissionRequestEvent, Callback_OnScreenCaptureRequestEvent_Void, OnScreenCaptureRequestEvent, Callback_OnContextMenuShowEvent_Boolean, OnContextMenuShowEvent, OnContextMenuHideCallback, Callback_OnSearchResultReceiveEvent_Void, Callback_OnScrollEvent_Void, Callback_OnSslErrorEventReceiveEvent_Void, OnSslErrorEventReceiveEvent, OnSslErrorEventCallback, SslErrorEvent, Callback_OnClientAuthenticationEvent_Void, OnClientAuthenticationEvent, Callback_OnWindowNewEvent_Void, OnWindowNewEvent, Callback_OnTouchIconUrlReceivedEvent_Void, OnTouchIconUrlReceivedEvent, Callback_OnFaviconReceivedEvent_Void, OnFaviconReceivedEvent, Callback_OnPageVisibleEvent_Void, OnPageVisibleEvent, Callback_OnDataResubmittedEvent_Void, Callback_OnAudioStateChangedEvent_Void, Callback_OnFirstContentfulPaintEvent_Void, OnFirstMeaningfulPaintCallback, FirstMeaningfulPaint, OnLargestContentfulPaintCallback, LargestContentfulPaint, Callback_OnLoadInterceptEvent_Boolean, OnLoadInterceptEvent, Callback_OnOverScrollEvent_Void, OnSafeBrowsingCheckResultCallback, OnNavigationEntryCommittedCallback, LoadCommittedDetails, OnIntelligentTrackingPreventionCallback, IntelligentTrackingPreventionDetails, WebLayoutMode, NestedScrollOptionsExt, Callback_NativeEmbedDataInfo_Void, NativeEmbedDataInfo, OnNativeEmbedVisibilityChangeCallback, NativeEmbedVisibilityInfo, Callback_NativeEmbedTouchInfo_Void, NativeEmbedTouchInfo, OnOverrideUrlLoadingCallback, OnRenderProcessNotRespondingCallback, RenderProcessNotRespondingData, OnRenderProcessRespondingCallback, OnViewportFitChangedCallback, WebKeyboardCallback, WebKeyboardCallbackInfo, OnAdsBlockedCallback, AdsBlockedDetails, WebKeyboardAvoidMode, EmbedOptions, WebElementType, WebResponseType, SelectionMenuOptionsExt, WebCaptureMode, WebContextMenuParam, WebContextMenuResult, WebController, Literal_String_script_Callback_String_Void_callback_, Literal_String_baseUrl_data_encoding_historyUrl_mimeType, Literal_Union_String_Resource_url_Array_Header_headers, Header, Literal_Object_object__String_name_Array_String_methodList, WebCookie, WebKeyboardController, WebNavigationType, WebResourceError, Literal_String_plainText, WebKeyboardOptions, WebOptions, Callback_Literal_String_plainText_Void, NativeEmbedInfo } from "./../web" +import { BlurOnKeyboardHideMode, CacheMode, ClientAuthenticationHandler, ConsoleMessage, MessageLevel, ContextMenuEditStateFlags, ContextMenuInputFieldType, ContextMenuMediaType, ContextMenuSourceType, ControllerHandler, DataResubmissionHandler, EventResult, FileSelectorMode, FileSelectorParam, FileSelectorResult, FullScreenExitHandler, GestureFocusMode, HitTestType, HttpAuthHandler, JsGeolocation, JsResult, Literal_Function_callback__Object_fileSelector, Literal_Function_handler_Object_error, Literal_Object_detail, MixedMode, NativeEmbedStatus, NativeMediaPlayerConfig, OnAudioStateChangedEvent, OnConsoleEvent, OnDataResubmittedEvent, OnFirstContentfulPaintEvent, OnOverScrollEvent, OnProgressChangeEvent, OnScaleChangeEvent, OnScrollEvent, OnSearchResultReceiveEvent, OnShowFileSelectorEvent, OverScrollMode, PermissionRequest, ProtectedResourceType, RenderExitReason, RenderMode, RenderProcessNotRespondingReason, ScreenCaptureHandler, ScreenCaptureConfig, SslError, SslErrorHandler, ThreatType, ViewportFit, ScriptItem, ExpandedMenuItemOptions, WebAttribute, JavaScriptProxy, WebDarkMode, WebMediaOptions, Callback_OnPageEndEvent_Void, OnPageEndEvent, Callback_OnPageBeginEvent_Void, OnPageBeginEvent, Callback_OnProgressChangeEvent_Void, Callback_OnTitleReceiveEvent_Void, OnTitleReceiveEvent, Callback_OnGeolocationShowEvent_Void, OnGeolocationShowEvent, Callback_OnAlertEvent_Boolean, OnAlertEvent, Callback_OnBeforeUnloadEvent_Boolean, OnBeforeUnloadEvent, Callback_OnConfirmEvent_Boolean, OnConfirmEvent, Callback_OnPromptEvent_Boolean, OnPromptEvent, Callback_OnConsoleEvent_Boolean, Callback_OnErrorReceiveEvent_Void, OnErrorReceiveEvent, Callback_OnHttpErrorReceiveEvent_Void, OnHttpErrorReceiveEvent, Callback_OnDownloadStartEvent_Void, OnDownloadStartEvent, Callback_OnRefreshAccessedHistoryEvent_Void, OnRefreshAccessedHistoryEvent, Type_WebAttribute_onUrlLoadIntercept_callback, Literal_Union_String_WebResourceRequest_data, WebResourceRequest, Callback_Literal_Function_handler_Object_error_Void, Callback_OnRenderExitedEvent_Void, OnRenderExitedEvent, Callback_OnShowFileSelectorEvent_Boolean, Callback_Literal_Object_detail_Boolean, Type_WebAttribute_onFileSelectorShow_callback, Callback_OnResourceLoadEvent_Void, OnResourceLoadEvent, OnFullScreenEnterCallback, FullScreenEnterEvent, Callback_OnScaleChangeEvent_Void, Callback_OnHttpAuthRequestEvent_Boolean, OnHttpAuthRequestEvent, Callback_OnInterceptRequestEvent_WebResourceResponse, OnInterceptRequestEvent, WebResourceResponse, Callback_OnPermissionRequestEvent_Void, OnPermissionRequestEvent, Callback_OnScreenCaptureRequestEvent_Void, OnScreenCaptureRequestEvent, Callback_OnContextMenuShowEvent_Boolean, OnContextMenuShowEvent, OnContextMenuHideCallback, Callback_OnSearchResultReceiveEvent_Void, Callback_OnScrollEvent_Void, Callback_OnSslErrorEventReceiveEvent_Void, OnSslErrorEventReceiveEvent, OnSslErrorEventCallback, SslErrorEvent, Callback_OnClientAuthenticationEvent_Void, OnClientAuthenticationEvent, Callback_OnWindowNewEvent_Void, OnWindowNewEvent, Callback_OnTouchIconUrlReceivedEvent_Void, OnTouchIconUrlReceivedEvent, Callback_OnFaviconReceivedEvent_Void, OnFaviconReceivedEvent, Callback_OnPageVisibleEvent_Void, OnPageVisibleEvent, Callback_OnDataResubmittedEvent_Void, Callback_OnAudioStateChangedEvent_Void, Callback_OnFirstContentfulPaintEvent_Void, OnFirstMeaningfulPaintCallback, FirstMeaningfulPaint, OnLargestContentfulPaintCallback, LargestContentfulPaint, Callback_OnLoadInterceptEvent_Boolean, OnLoadInterceptEvent, Callback_OnOverScrollEvent_Void, OnSafeBrowsingCheckResultCallback, OnNavigationEntryCommittedCallback, LoadCommittedDetails, OnIntelligentTrackingPreventionCallback, IntelligentTrackingPreventionDetails, WebLayoutMode, NestedScrollOptionsExt, Callback_NativeEmbedDataInfo_Void, NativeEmbedDataInfo, OnNativeEmbedVisibilityChangeCallback, NativeEmbedVisibilityInfo, Callback_NativeEmbedTouchInfo_Void, NativeEmbedTouchInfo, OnOverrideUrlLoadingCallback, OnRenderProcessNotRespondingCallback, RenderProcessNotRespondingData, OnRenderProcessRespondingCallback, OnViewportFitChangedCallback, WebKeyboardCallback, WebKeyboardCallbackInfo, OnAdsBlockedCallback, AdsBlockedDetails, WebKeyboardAvoidMode, EmbedOptions, WebElementType, WebResponseType, SelectionMenuOptionsExt, WebCaptureMode, WebContextMenuParam, WebContextMenuResult, WebController, Literal_String_script_Callback_String_Void_callback_, Literal_String_baseUrl_data_encoding_historyUrl_mimeType, Literal_Union_String_Resource_url_Array_Header_headers, Header, Literal_Object_object__String_name_Array_String_methodList, WebCookie, WebKeyboardController, WebNavigationType, WebResourceError, Literal_String_plainText, WebKeyboardOptions, WebOptions, Callback_Literal_String_plainText_Void, NativeEmbedInfo } from "./../web" import { BreakpointsReference, GridRowDirection, Callback_String_Void, BreakPoints, GridRowColumnOption, GridRowSizeOption, GutterOption, GridRowOptions } from "./../gridRow" import { ButtonRole, ButtonStyleMode, ButtonType, ControlSize, ButtonOptions } from "./../button" import { CalendarAlign, CalendarPickerAttribute, Callback_Date_Void, CalendarOptions, CalendarDialogOptions } from "./../calendarPicker" @@ -20124,6 +20124,12 @@ export class TypeChecker { static GestureControl_GestureType_FromNumeric(ordinal: int32): GestureControl.GestureType { return ordinal as GestureControl.GestureType } + static GestureFocusMode_ToNumeric(value: GestureFocusMode): int32 { + return value as int32 + } + static GestureFocusMode_FromNumeric(ordinal: int32): GestureFocusMode { + return ordinal as GestureFocusMode + } static GestureJudgeResult_ToNumeric(value: GestureJudgeResult): int32 { return value as int32 } diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/web.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/web.ts index 0dead8258bd..41e6f922561 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/web.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/web.ts @@ -3109,6 +3109,18 @@ export class ArkWebPeer extends ArkCommonMethodPeer { ArkUIGeneratedNativeModule._WebAttribute_bindSelectionMenu(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) thisSerializer.release() } + gestureFocusModeAttribute(value: GestureFocusMode | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + let value_type : int32 = RuntimeType.UNDEFINED + value_type = runtimeType(value) + thisSerializer.writeInt8(value_type as int32) + if ((RuntimeType.UNDEFINED) != (value_type)) { + const value_value = (value as GestureFocusMode) + thisSerializer.writeInt32(TypeChecker.GestureFocusMode_ToNumeric(value_value)) + } + ArkUIGeneratedNativeModule._WebAttribute_gestureFocusMode(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } } export type OnNavigationEntryCommittedCallback = (loadCommittedDetails: LoadCommittedDetails) => void; export type OnSslErrorEventCallback = (sslErrorEvent: SslErrorEvent) => void; @@ -3587,10 +3599,13 @@ export enum WebKeyboardAvoidMode { OVERLAYS_CONTENT = 2 } export enum WebElementType { - IMAGE = 1 + IMAGE = 1, + LINK = 2, + TEXT = 3 } export enum WebResponseType { - LONG_PRESS = 1 + LONG_PRESS = 1, + RIGHT_CLICK = 2 } export interface SelectionMenuOptionsExt { onAppear?: Callback; @@ -3598,6 +3613,12 @@ export interface SelectionMenuOptionsExt { preview?: CustomBuilder; menuType?: MenuType; previewMenuOptions?: PreviewMenuOptions; + onMenuShow?: Callback; + onMenuHide?: Callback; +} +export enum GestureFocusMode { + DEFAULT = 0, + GESTURE_TAP_AND_LONG_PRESS = 1 } export type Callback_OnPageEndEvent_Void = (parameter: OnPageEndEvent) => void; export type Callback_OnPageBeginEvent_Void = (parameter: OnPageBeginEvent) => void; @@ -3783,6 +3804,7 @@ export interface WebAttribute extends CommonMethod { nativeEmbedOptions(value: EmbedOptions | undefined): this registerNativeEmbedRule(tag: string | undefined, type: string | undefined): this bindSelectionMenu(elementType: WebElementType | undefined, content: CustomBuilder | undefined, responseType: WebResponseType | undefined, options?: SelectionMenuOptionsExt): this + gestureFocusMode(value: GestureFocusMode | undefined): this } export class ArkWebStyle extends ArkCommonMethodStyle implements WebAttribute { javaScriptAccess_value?: boolean | undefined @@ -3910,6 +3932,7 @@ export class ArkWebStyle extends ArkCommonMethodStyle implements WebAttribute { runJavaScriptOnDocumentEnd_value?: Array | undefined runJavaScriptOnHeadEnd_value?: Array | undefined nativeEmbedOptions_value?: EmbedOptions + gestureFocusMode_value?: GestureFocusMode | undefined public javaScriptAccess(value: boolean | undefined): this { return this } @@ -4290,7 +4313,10 @@ export class ArkWebStyle extends ArkCommonMethodStyle implements WebAttribute { } public bindSelectionMenu(elementType: WebElementType | undefined, content: CustomBuilder | undefined, responseType: WebResponseType | undefined, options?: SelectionMenuOptionsExt): this { return this - } + } + public gestureFocusMode(value: GestureFocusMode | undefined): this { + return this + } } export interface SslErrorEvent { handler: SslErrorHandler; @@ -5351,7 +5377,14 @@ export class ArkWebComponent extends ArkCommonMethodComponent implements WebAttr } return this } - + public gestureFocusMode(value: GestureFocusMode | undefined): this { + if (this.checkPriority("gestureFocusMode")) { + const value_casted = value as (GestureFocusMode | undefined) + this.getPeer()?.gestureFocusModeAttribute(value_casted) + return this + } + return this + } public applyAttributesFinish(): void { // we call this function outside of class, so need to make it public super.applyAttributesFinish() diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h index 507d6095555..0926ceaafae 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h @@ -4200,6 +4200,35 @@ inline Ark_RuntimeType runtimeType(const Opt_GestureControl_GestureType& value) return (value.tag != INTEROP_TAG_UNDEFINED) ? (INTEROP_RUNTIME_OBJECT) : (INTEROP_RUNTIME_UNDEFINED); } template <> +inline Ark_RuntimeType runtimeType(const Ark_GestureFocusMode& value) +{ + return INTEROP_RUNTIME_NUMBER; +} +template <> +inline void WriteToString(std::string* result, const Ark_GestureFocusMode value) { + result->append("Ark_GestureFocusMode("); + WriteToString(result, (Ark_Int32) value); + result->append(")"); +} +template <> +inline void WriteToString(std::string* result, const Opt_GestureFocusMode* value) { + result->append("{.tag="); + result->append(tagNameExact((Ark_Tag)(value->tag))); + result->append(", .value="); + if (value->tag != INTEROP_TAG_UNDEFINED) { + WriteToString(result, value->value); + } else { + Ark_Undefined undefined = { 0 }; + WriteToString(result, undefined); + } + result->append("}"); +} +template <> +inline Ark_RuntimeType runtimeType(const Opt_GestureFocusMode& value) +{ + return (value.tag != INTEROP_TAG_UNDEFINED) ? (INTEROP_RUNTIME_OBJECT) : (INTEROP_RUNTIME_UNDEFINED); +} +template <> inline Ark_RuntimeType runtimeType(const Ark_GestureGroupInterface& value) { return INTEROP_RUNTIME_OBJECT; @@ -55172,6 +55201,13 @@ inline void WriteToString(std::string* result, const Ark_SelectionMenuOptionsExt result->append(", "); result->append(".previewMenuOptions="); WriteToString(result, &value->previewMenuOptions); + // Callback_Void onMenuShow + result->append(".onMenuShow="); + WriteToString(result, &value->onMenuShow); + // Callback_Void onMenuHide + result->append(", "); + result->append(".onMenuHide="); + WriteToString(result, &value->onMenuHide); result->append("}"); } template <> @@ -81065,6 +81101,26 @@ class Serializer : public SerializerBase { const auto value_previewMenuOptions_value = value_previewMenuOptions.value; valueSerializer.writePreviewMenuOptions(value_previewMenuOptions_value); } + const auto value_onMenuShow = value.onMenuShow; + Ark_Int32 value_onMenuShow_type = INTEROP_RUNTIME_UNDEFINED; + value_onMenuShow_type = runtimeType(value_onMenuShow); + valueSerializer.writeInt8(value_onMenuShow_type); + if ((INTEROP_RUNTIME_UNDEFINED) != (value_onMenuShow_type)) { + const auto value_onMenuShow_value = value_onMenuShow.value; + valueSerializer.writeCallbackResource(value_onMenuShow_value.resource); + valueSerializer.writePointer(reinterpret_cast(value_onMenuShow_value.call)); + valueSerializer.writePointer(reinterpret_cast(value_onMenuShow_value.callSync)); + } + const auto value_onMenuHide = value.onMenuHide; + Ark_Int32 value_onMenuHide_type = INTEROP_RUNTIME_UNDEFINED; + value_onMenuHide_type = runtimeType(value_onMenuHide); + valueSerializer.writeInt8(value_onMenuHide_type); + if ((INTEROP_RUNTIME_UNDEFINED) != (value_onMenuHide_type)) { + const auto value_onMenuHide_value = value_onMenuHide.value; + valueSerializer.writeCallbackResource(value_onMenuHide_value.resource); + valueSerializer.writePointer(reinterpret_cast(value_onMenuHide_value.call)); + valueSerializer.writePointer(reinterpret_cast(value_onMenuHide_value.callSync)); + } } void writeSelectOption(Ark_SelectOption value) { @@ -109076,6 +109132,23 @@ class Deserializer : public DeserializerBase { previewMenuOptions_buf.value = valueDeserializer.readPreviewMenuOptions(); } value.previewMenuOptions = previewMenuOptions_buf; + + const auto onMenuShow_buf_runtimeType = static_cast(valueDeserializer.readInt8()); + Opt_Callback_Void onMenuShow_buf = {}; + onMenuShow_buf.tag = onMenuShow_buf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((INTEROP_RUNTIME_UNDEFINED) != (onMenuShow_buf_runtimeType)) + { + onMenuShow_buf.value = {valueDeserializer.readCallbackResource(), reinterpret_cast(valueDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_Callback_Void)))), reinterpret_cast(valueDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_Callback_Void))))}; + } + value.onMenuShow = onMenuShow_buf; + const auto onMenuHide_buf_runtimeType = static_cast(valueDeserializer.readInt8()); + Opt_Callback_Void onMenuHide_buf = {}; + onMenuHide_buf.tag = onMenuHide_buf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((INTEROP_RUNTIME_UNDEFINED) != (onMenuHide_buf_runtimeType)) + { + onMenuHide_buf.value = {valueDeserializer.readCallbackResource(), reinterpret_cast(valueDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_Callback_Void)))), reinterpret_cast(valueDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_Callback_Void))))}; + } + value.onMenuHide = onMenuHide_buf; return value; } Ark_SelectOption readSelectOption() diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h index 2e526a0e7c7..7550d63f146 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h @@ -4488,6 +4488,14 @@ typedef struct Opt_GestureControl_GestureType { Ark_Tag tag; Ark_GestureControl_GestureType value; } Opt_GestureControl_GestureType; +typedef enum Ark_GestureFocusMode { + ARK_GESTURE_FOCUS_MODE_DEFAULT = 0, + ARK_GESTURE_FOCUS_MODE_GESTURE_TAP_AND_LONG_PRESS = 1, +} Ark_GestureFocusMode; +typedef struct Opt_GestureFocusMode { + Ark_Tag tag; + Ark_GestureFocusMode value; +} Opt_GestureFocusMode; typedef enum Ark_GestureJudgeResult { ARK_GESTURE_JUDGE_RESULT_CONTINUE = 0, ARK_GESTURE_JUDGE_RESULT_REJECT = 1, @@ -6774,6 +6782,8 @@ typedef struct Opt_WebDarkMode { } Opt_WebDarkMode; typedef enum Ark_WebElementType { ARK_WEB_ELEMENT_TYPE_IMAGE = 1, + ARK_WEB_ELEMENT_TYPE_LINK = 2, + ARK_WEB_ELEMENT_TYPE_TEXT = 3, } Ark_WebElementType; typedef struct Opt_WebElementType { Ark_Tag tag; @@ -6809,6 +6819,7 @@ typedef struct Opt_WebNavigationType { } Opt_WebNavigationType; typedef enum Ark_WebResponseType { ARK_WEB_RESPONSE_TYPE_LONG_PRESS = 1, + ARK_WEB_RESPONSE_TYPE_RIGHT_CLICK = 2, } Ark_WebResponseType; typedef struct Opt_WebResponseType { Ark_Tag tag; @@ -18064,6 +18075,8 @@ typedef struct Ark_SelectionMenuOptionsExt { Opt_CustomNodeBuilder preview; Opt_MenuType menuType; Opt_PreviewMenuOptions previewMenuOptions; + Opt_Callback_Void onMenuShow; + Opt_Callback_Void onMenuHide; } Ark_SelectionMenuOptionsExt; typedef struct Opt_SelectionMenuOptionsExt { Ark_Tag tag; @@ -24165,6 +24178,8 @@ typedef struct GENERATED_ArkUIWebModifier { const Opt_CustomNodeBuilder* content, const Opt_WebResponseType* responseType, const Opt_SelectionMenuOptionsExt* options); + void (*setGestureFocusMode)(Ark_NativePointer node, + const Opt_GestureFocusMode* value); } GENERATED_ArkUIWebModifier; typedef struct GENERATED_ArkUIWindowSceneModifier { diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc index 20dd68fcf89..03e1558e993 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc @@ -30914,6 +30914,20 @@ void impl_WebAttribute_bindSelectionMenu(Ark_NativePointer thisPtr, KSerializerB GetNodeModifiers()->getWebModifier()->setBindSelectionMenu(self, (const Opt_WebElementType*)&elementType_value, (const Opt_CustomNodeBuilder*)&content_value, (const Opt_WebResponseType*)&responseType_value, (const Opt_SelectionMenuOptionsExt*)&options_value); } KOALA_INTEROP_DIRECT_V3(WebAttribute_bindSelectionMenu, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_WebAttribute_gestureFocusMode(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto value_value_buf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_GestureFocusMode value_value_buf = {}; + value_value_buf.tag = value_value_buf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((INTEROP_RUNTIME_UNDEFINED) != (value_value_buf_runtimeType)) + { + value_value_buf.value = static_cast(thisDeserializer.readInt32()); + } + Opt_GestureFocusMode value_value = value_value_buf;; + GetNodeModifiers()->getWebModifier()->setGestureFocusMode(self, (const Opt_GestureFocusMode*)&value_value); +} +KOALA_INTEROP_DIRECT_V3(WebAttribute_gestureFocusMode, Ark_NativePointer, KSerializerBuffer, int32_t) Ark_NativePointer impl_WindowScene_construct(Ark_Int32 id, Ark_Int32 flags) { return GetNodeModifiers()->getWindowSceneModifier()->construct(id, flags); } diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/dummy_impl.cc b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/dummy_impl.cc index 03ea3870743..baec1e7d80e 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/dummy_impl.cc +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/dummy_impl.cc @@ -20007,6 +20007,16 @@ namespace OHOS::Ace::NG::GeneratedModifier { out.append(") \n"); appendGroupedLog(1, out); } + void GestureFocusModeImpl(Ark_NativePointer node, + const Opt_GestureFocusMode* value) + { + if (!needGroupedLog(1)) + return; + string out("gestureFocusMode("); + WriteToString(&out, value); + out.append(") \n"); + appendGroupedLog(1, out); + } } // WebAttributeModifier namespace WindowSceneModifier { Ark_NativePointer ConstructImpl(Ark_Int32 id, @@ -23288,6 +23298,7 @@ namespace OHOS::Ace::NG::GeneratedModifier { WebAttributeModifier::NativeEmbedOptionsImpl, WebAttributeModifier::RegisterNativeEmbedRuleImpl, WebAttributeModifier::BindSelectionMenuImpl, + WebAttributeModifier::GestureFocusModeImpl, }; return &ArkUIWebModifierImpl; } diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/real_impl.cc b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/real_impl.cc index 4b5fcaa2eb5..2a7e1c064ef 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/real_impl.cc +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/real_impl.cc @@ -8834,6 +8834,10 @@ namespace OHOS::Ace::NG::GeneratedModifier { const Opt_SelectionMenuOptionsExt* options) { } + void GestureFocusModeImpl(Ark_NativePointer node, + const Opt_GestureFocusMode* value) + { + } } // WebAttributeModifier namespace WindowSceneModifier { Ark_NativePointer ConstructImpl(Ark_Int32 id, @@ -11696,6 +11700,7 @@ namespace OHOS::Ace::NG::GeneratedModifier { WebAttributeModifier::NativeEmbedOptionsImpl, WebAttributeModifier::RegisterNativeEmbedRuleImpl, WebAttributeModifier::BindSelectionMenuImpl, + WebAttributeModifier::GestureFocusModeImpl, }; return &ArkUIWebModifierImpl; } diff --git a/frameworks/core/components_ng/pattern/web/ani/web_model_static.cpp b/frameworks/core/components_ng/pattern/web/ani/web_model_static.cpp index 01b438691d8..e76906f0c0b 100644 --- a/frameworks/core/components_ng/pattern/web/ani/web_model_static.cpp +++ b/frameworks/core/components_ng/pattern/web/ani/web_model_static.cpp @@ -1306,4 +1306,12 @@ void WebModelStatic::SetAllowWindowOpenMethod(FrameNode* frameNode, bool isAllow CHECK_NULL_VOID(webPatternStatic); webPatternStatic->UpdateAllowWindowOpenMethod(isAllowWindowOpenMethod); } + +void WebModelStatic::SetGestureFocusMode(FrameNode* frameNode, const GestureFocusMode& mode) +{ + CHECK_NULL_VOID(frameNode); + auto webPatternStatic = AceType::DynamicCast(frameNode->GetPattern()); + CHECK_NULL_VOID(webPatternStatic); + webPatternStatic->UpdateGestureFocusMode(mode); +} } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/web/ani/web_model_static.h b/frameworks/core/components_ng/pattern/web/ani/web_model_static.h index 3a99b9664ad..24f129d09d6 100644 --- a/frameworks/core/components_ng/pattern/web/ani/web_model_static.h +++ b/frameworks/core/components_ng/pattern/web/ani/web_model_static.h @@ -198,6 +198,7 @@ public: static void SetZoomAccessEnabled(FrameNode* frameNode, bool isZoomAccessEnabled); static void SetMultiWindowAccessEnabled(FrameNode* frameNode, bool isMultiWindowAccessEnable); static void SetAllowWindowOpenMethod(FrameNode* frameNode, bool isAllowWindowOpenMethod); + static void SetGestureFocusMode(FrameNode* frameNode, const GestureFocusMode& mode); }; } // namespace OHOS::Ace::NG #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_WEB_ANI_WEB_MODEL_STATIC_H diff --git a/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h b/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h index 06752078405..b01b2f78817 100644 --- a/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h +++ b/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h @@ -4486,6 +4486,14 @@ typedef struct Opt_GestureControl_GestureType { Ark_Tag tag; Ark_GestureControl_GestureType value; } Opt_GestureControl_GestureType; +typedef enum Ark_GestureFocusMode { + ARK_GESTURE_FOCUS_MODE_DEFAULT = 0, + ARK_GESTURE_FOCUS_MODE_GESTURE_TAP_AND_LONG_PRESS = 1, +} Ark_GestureFocusMode; +typedef struct Opt_GestureFocusMode { + Ark_Tag tag; + Ark_GestureFocusMode value; +} Opt_GestureFocusMode; typedef enum Ark_GestureJudgeResult { ARK_GESTURE_JUDGE_RESULT_CONTINUE = 0, ARK_GESTURE_JUDGE_RESULT_REJECT = 1, @@ -6774,6 +6782,8 @@ typedef struct Opt_WebDarkMode { } Opt_WebDarkMode; typedef enum Ark_WebElementType { ARK_WEB_ELEMENT_TYPE_IMAGE = 1, + ARK_WEB_ELEMENT_TYPE_LINK = 2, + ARK_WEB_ELEMENT_TYPE_TEXT = 3, } Ark_WebElementType; typedef struct Opt_WebElementType { Ark_Tag tag; @@ -6809,6 +6819,7 @@ typedef struct Opt_WebNavigationType { } Opt_WebNavigationType; typedef enum Ark_WebResponseType { ARK_WEB_RESPONSE_TYPE_LONG_PRESS = 1, + ARK_WEB_RESPONSE_TYPE_RIGHT_CLICK = 2, } Ark_WebResponseType; typedef struct Opt_WebResponseType { Ark_Tag tag; @@ -18065,6 +18076,8 @@ typedef struct Ark_SelectionMenuOptionsExt { Opt_CustomNodeBuilder preview; Opt_MenuType menuType; Opt_PreviewMenuOptions previewMenuOptions; + Opt_Callback_Void onMenuShow; + Opt_Callback_Void onMenuHide; } Ark_SelectionMenuOptionsExt; typedef struct Opt_SelectionMenuOptionsExt { Ark_Tag tag; @@ -24165,6 +24178,8 @@ typedef struct GENERATED_ArkUIWebModifier { const Opt_CustomNodeBuilder* content, const Opt_WebResponseType* responseType, const Opt_SelectionMenuOptionsExt* options); + void (*setGestureFocusMode)(Ark_NativePointer node, + const Opt_GestureFocusMode* value); } GENERATED_ArkUIWebModifier; typedef struct GENERATED_ArkUIWindowSceneModifier { diff --git a/frameworks/core/interfaces/native/implementation/web_modifier.cpp b/frameworks/core/interfaces/native/implementation/web_modifier.cpp index c5861a6a53a..aa163b24faf 100644 --- a/frameworks/core/interfaces/native/implementation/web_modifier.cpp +++ b/frameworks/core/interfaces/native/implementation/web_modifier.cpp @@ -22,6 +22,7 @@ #include "core/interfaces/native/implementation/web_modifier_callbacks.h" #endif // WEB_SUPPORTED #include "core/interfaces/native/utility/converter.h" +#include "core/interfaces/native/utility/converter2.h" #include "core/interfaces/native/utility/reverse_converter.h" #include "core/interfaces/native/utility/callback_helper.h" @@ -2275,6 +2276,8 @@ void RegisterNativeEmbedRuleImpl(Ark_NativePointer node, WebModelStatic::RegisterNativeEmbedRule(frameNode, *convValueTag, *convValueType); #endif // WEB_SUPPORTED } + +#ifdef WEB_SUPPORTED void InitCallbackParams_(FrameNode* frameNode, MenuParam& dst, const Opt_Callback_Void& onAppear, const Opt_Callback_Void& onDisappear) { @@ -2296,7 +2299,7 @@ void InitCallbackParams_(FrameNode* frameNode, MenuParam& dst, const Opt_Callbac dst.onAppear = std::move(onAppear); } } -#ifdef WEB_SUPPORTED + std::function&)> GetPreviewHandler( Ark_NativePointer node, const CustomNodeBuilder& preview) { @@ -2316,6 +2319,7 @@ std::function&)> GetPre return previewHandler; } #endif // WEB_SUPPORTED + void BindSelectionMenuImpl(Ark_NativePointer node, const Opt_WebElementType* elementType, const Opt_CustomNodeBuilder* content, @@ -2371,6 +2375,18 @@ void BindSelectionMenuImpl(Ark_NativePointer node, }, node); #endif // WEB_SUPPORTED } + +void GestureFocusModeImpl(Ark_NativePointer node, + const Opt_GestureFocusMode* value) +{ +#ifdef WEB_SUPPORTED + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = Converter::OptConvert(*value); + CHECK_EQUAL_VOID(convValue.has_value(), false); + WebModelStatic::SetGestureFocusMode(frameNode, convValue.value()); +#endif // WEB_SUPPORTED +} } // WebAttributeModifier const GENERATED_ArkUIWebModifier* GetWebModifier() { @@ -2504,6 +2520,7 @@ const GENERATED_ArkUIWebModifier* GetWebModifier() WebAttributeModifier::NativeEmbedOptionsImpl, WebAttributeModifier::RegisterNativeEmbedRuleImpl, WebAttributeModifier::BindSelectionMenuImpl, + WebAttributeModifier::GestureFocusModeImpl, }; return &ArkUIWebModifierImpl; } diff --git a/frameworks/core/interfaces/native/utility/converter.h b/frameworks/core/interfaces/native/utility/converter.h index 09d3b8003a4..097348387cd 100644 --- a/frameworks/core/interfaces/native/utility/converter.h +++ b/frameworks/core/interfaces/native/utility/converter.h @@ -715,6 +715,7 @@ namespace Converter { template<> void AssignCast(std::optional& dst, const Ark_Number& src); template<> void AssignCast(std::optional& dst, const Ark_String& src); template<> void AssignCast(std::optional& dst, const Ark_ColoringStrategy& src); + template<> void AssignCast(std::optional& dst, const Ark_GestureFocusMode& src); template<> void AssignCast(std::optional& dst, const Ark_GestureMask& src); template<> void AssignCast(std::optional& dst, const Ark_GestureMode& src); template<> void AssignCast(std::optional& dst, const Ark_LinearGradient& src); diff --git a/frameworks/core/interfaces/native/utility/converter2.h b/frameworks/core/interfaces/native/utility/converter2.h index 4611784f0ec..739cde63a6c 100755 --- a/frameworks/core/interfaces/native/utility/converter2.h +++ b/frameworks/core/interfaces/native/utility/converter2.h @@ -33,6 +33,7 @@ namespace Converter { template<> void AssignCast(std::optional& dst, const Ark_RichEditorSpanType& src); template<> void AssignCast(std::optional& dst, const Ark_ResponseType& src); template<> void AssignCast(std::optional& dst, const Ark_RichEditorResponseType& src); + template<> NG::PreviewMenuOptions Convert(const Ark_PreviewMenuOptions& src); template<> SelectMenuParam Convert(const Ark_SelectionMenuOptions& src); } // namespace OHOS::Ace::NG::Converter } // namespace OHOS::Ace::NG diff --git a/frameworks/core/interfaces/native/utility/converter_enums.cpp b/frameworks/core/interfaces/native/utility/converter_enums.cpp index 6a667f37e61..e4dfcd48573 100644 --- a/frameworks/core/interfaces/native/utility/converter_enums.cpp +++ b/frameworks/core/interfaces/native/utility/converter_enums.cpp @@ -263,6 +263,20 @@ void AssignCast(std::optional& dst, const Ark_ColoringS } } +template<> +void AssignCast(std::optional& dst, const Ark_GestureFocusMode& src) +{ + switch (src) { + case ARK_GESTURE_FOCUS_MODE_DEFAULT: + dst = GestureFocusMode::DEFAULT; + break; + case ARK_GESTURE_FOCUS_MODE_GESTURE_TAP_AND_LONG_PRESS: + dst = GestureFocusMode::GESTURE_TAP_AND_LONG_PRESS; + break; + default: LOGE("Unexpected enum value in Ark_GestureFocusMode: %{public}d", src); + } +} + template<> void AssignCast(std::optional& dst, const Ark_GestureMask& src) { @@ -1247,6 +1261,8 @@ void AssignCast(std::optional& dst, const Ark_WebElementType& sr { switch (src) { case ARK_WEB_ELEMENT_TYPE_IMAGE: dst = WebElementType::IMAGE; break; + case ARK_WEB_ELEMENT_TYPE_LINK: dst = WebElementType::LINK; break; + case ARK_WEB_ELEMENT_TYPE_TEXT: dst = WebElementType::TEXT; break; default: LOGE("Unexpected enum value in Ark_WebElementType: %{public}d", src); } } @@ -1863,6 +1879,7 @@ void AssignCast(std::optional& dst, const Ark_WebResponseType& src { switch (src) { case ARK_WEB_RESPONSE_TYPE_LONG_PRESS: dst = ResponseType::LONG_PRESS; break; + case ARK_WEB_RESPONSE_TYPE_RIGHT_CLICK: dst = ResponseType::RIGHT_CLICK; break; default: LOGE("Unexpected enum value in Ark_WebResponseType: %{public}d", src); } } diff --git a/frameworks/core/interfaces/native/utility/generated/converter_generated.h b/frameworks/core/interfaces/native/utility/generated/converter_generated.h index 16a0b14f064..9420aed817a 100644 --- a/frameworks/core/interfaces/native/utility/generated/converter_generated.h +++ b/frameworks/core/interfaces/native/utility/generated/converter_generated.h @@ -3370,6 +3370,7 @@ ASSIGN_OPT(Opt_FullscreenInfo) ASSIGN_OPT(Opt_Function) ASSIGN_OPT(Opt_FunctionKey) ASSIGN_OPT(Opt_GestureControl_GestureType) +ASSIGN_OPT(Opt_GestureFocusMode) ASSIGN_OPT(Opt_GestureGroupInterface) ASSIGN_OPT(Opt_GestureJudgeResult) ASSIGN_OPT(Opt_GestureMask) diff --git a/test/unittest/core/pattern/web/ani/web_model_static_test.cpp b/test/unittest/core/pattern/web/ani/web_model_static_test.cpp index 810d4340d7b..24a97c16ff5 100644 --- a/test/unittest/core/pattern/web/ani/web_model_static_test.cpp +++ b/test/unittest/core/pattern/web/ani/web_model_static_test.cpp @@ -2485,4 +2485,30 @@ HWTEST_F(WebModelStaticTest, SetAdsBlockedEventId001, TestSize.Level1) EXPECT_NE(callCount, 0); #endif } +/** + * @tc.name: SetGestureFocusMode001 + * @tc.desc: Test web_model_static.cpp + * @tc.type: FUNC + */ +HWTEST_F(WebModelStaticTest, SetGestureFocusMode001, TestSize.Level1) +{ +#ifdef OHOS_STANDARD_SYSTEM + int callCount = 0; + auto* stack = ViewStackProcessor::GetInstance(); + auto nodeId = stack->ClaimNodeId(); + auto frameNode = WebModelStatic::CreateFrameNode(nodeId); + ASSERT_NE(frameNode, nullptr); + stack->Push(frameNode); + auto webPatternStatic = ViewStackProcessor::GetInstance()->GetMainFrameNodePattern(); + ASSERT_NE(webPatternStatic, nullptr); + + WebModelStatic::SetGestureFocusMode(AccessibilityManager::RawPtr(frameNode), + GestureFocusMode::GESTURE_TAP_AND_LONG_PRESS); + EXPECT_EQ(webPatternStatic->GetOrCreateWebProperty()->CheckGestureFocusMode( + GestureFocusMode::GESTURE_TAP_AND_LONG_PRESS), true); + WebModelStatic::SetGestureFocusMode(AccessibilityManager::RawPtr(frameNode), + GestureFocusMode::DEFAULT); + EXPECT_EQ(webPatternStatic->GetOrCreateWebProperty()->CheckGestureFocusMode(GestureFocusMode::DEFAULT), true); +#endif +} } // namespace OHOS::Ace::NG -- Gitee