已合并
ArkWeb 新增文字长按框选震动特性 #40330
zhufenghao创建于 2024年8月13日
ArkWeb 新增文字长按框选震动特性 #40330
已合并
zhufenghao创建于 2024年8月13日
refs/pull/40330/head合入到master
2 个文件变更+14-8
@@ -40,6 +40,7 @@
40#include "core/components_ng/pattern/web/web_pattern.h"40#include "core/components_ng/pattern/web/web_pattern.h"
41#include "core/pipeline_ng/pipeline_context.h"41#include "core/pipeline_ng/pipeline_context.h"
42#include "adapter/ohos/capability/html/span_to_html.h"42#include "adapter/ohos/capability/html/span_to_html.h"
43+#include "core/common/vibrator/vibrator_utils.h"
43#ifdef ENABLE_ROSEN_BACKEND44#ifdef ENABLE_ROSEN_BACKEND
44#include "core/components_ng/render/adapter/rosen_render_context.h"45#include "core/components_ng/render/adapter/rosen_render_context.h"
45#endif46#endif
@@ -5174,6 +5175,7 @@ bool WebDelegate::OnContextMenuShow(const std::shared_ptr<BaseEventInfo>& info)
5174 CHECK_NULL_VOID(webEventHub);5175 CHECK_NULL_VOID(webEventHub);
5175 auto propOnContextMenuShowEvent = webEventHub->GetOnContextMenuShowEvent();5176 auto propOnContextMenuShowEvent = webEventHub->GetOnContextMenuShowEvent();
5176 CHECK_NULL_VOID(propOnContextMenuShowEvent);5177 CHECK_NULL_VOID(propOnContextMenuShowEvent);
5178+ NG::VibratorUtils::StartVibraFeedback("longPress.light");
5177 result = propOnContextMenuShowEvent(info);5179 result = propOnContextMenuShowEvent(info);
5178 return;5180 return;
5179#else5181#else
@@ -5188,6 +5190,7 @@ bool WebDelegate::OnContextMenuShow(const std::shared_ptr<BaseEventInfo>& info)
5188 CHECK_NULL_VOID(webEventHub);5190 CHECK_NULL_VOID(webEventHub);
5189 auto propOnContextMenuShowEvent = webEventHub->GetOnContextMenuShowEvent();5191 auto propOnContextMenuShowEvent = webEventHub->GetOnContextMenuShowEvent();
5190 CHECK_NULL_VOID(propOnContextMenuShowEvent);5192 CHECK_NULL_VOID(propOnContextMenuShowEvent);
5193+ NG::VibratorUtils::StartVibraFeedback("longPress.light");
5191 result = propOnContextMenuShowEvent(info);5194 result = propOnContextMenuShowEvent(info);
5192 return;5195 return;
5193 }5196 }
@@ -27,16 +27,25 @@
27#if !defined(PREVIEW) && !defined(ACE_UNITTEST) && defined(OHOS_PLATFORM)27#if !defined(PREVIEW) && !defined(ACE_UNITTEST) && defined(OHOS_PLATFORM)
28#include "interfaces/inner_api/ui_session/ui_session_manager.h"28#include "interfaces/inner_api/ui_session/ui_session_manager.h"
29#endif29#endif
30+#include "auto_fill_type.h"
31+#include "page_node_info.h"
32+ 
33+#include "adapter/ohos/capability/html/span_to_html.h"
30#include "base/geometry/ng/offset_t.h"34#include "base/geometry/ng/offset_t.h"
35+#include "base/geometry/rect.h"
31#include "base/image/file_uri_helper.h"36#include "base/image/file_uri_helper.h"
32#include "base/mousestyle/mouse_style.h"37#include "base/mousestyle/mouse_style.h"
33#include "base/utils/date_util.h"38#include "base/utils/date_util.h"
34#include "base/utils/linear_map.h"39#include "base/utils/linear_map.h"
35#include "base/utils/time_util.h"40#include "base/utils/time_util.h"
36#include "base/utils/utils.h"41#include "base/utils/utils.h"
42+#include "core/common/ace_engine_ext.h"
37#include "core/common/ai/data_detector_mgr.h"43#include "core/common/ai/data_detector_mgr.h"
38#include "core/common/ai/image_analyzer_manager.h"44#include "core/common/ai/image_analyzer_manager.h"
39#include "core/common/ime/input_method_manager.h"45#include "core/common/ime/input_method_manager.h"
46+#include "core/common/udmf/udmf_client.h"
47+#include "core/common/udmf/unified_data.h"
48+#include "core/common/vibrator/vibrator_utils.h"
40#include "core/components/dialog/dialog_theme.h"49#include "core/components/dialog/dialog_theme.h"
41#include "core/components/picker/picker_data.h"50#include "core/components/picker/picker_data.h"
42#include "core/components/text_overlay/text_overlay_theme.h"51#include "core/components/text_overlay/text_overlay_theme.h"
@@ -60,14 +69,6 @@
60#include "frameworks/base/utils/system_properties.h"69#include "frameworks/base/utils/system_properties.h"
61#include "frameworks/core/components_ng/base/ui_node.h"70#include "frameworks/core/components_ng/base/ui_node.h"
62 71 
63-#include "adapter/ohos/capability/html/span_to_html.h"
64-#include "base/geometry/rect.h"
65-#include "core/common/ace_engine_ext.h"
66-#include "core/common/udmf/udmf_client.h"
67-#include "core/common/udmf/unified_data.h"
68-#include "page_node_info.h"
69-#include "auto_fill_type.h"
70- 
71namespace OHOS::Ace::NG {72namespace OHOS::Ace::NG {
72namespace {73namespace {
73const std::string IMAGE_POINTER_CONTEXT_MENU_PATH = "etc/webview/ohos_nweb/context-menu.svg";74const std::string IMAGE_POINTER_CONTEXT_MENU_PATH = "etc/webview/ohos_nweb/context-menu.svg";
@@ -409,6 +410,7 @@ void WebPattern::OnContextMenuShow(const std::shared_ptr<BaseEventInfo>& info)
409 CHECK_NULL_VOID(contextMenuParam_);410 CHECK_NULL_VOID(contextMenuParam_);
410 contextMenuResult_ = eventInfo->GetContextMenuResult();411 contextMenuResult_ = eventInfo->GetContextMenuResult();
411 CHECK_NULL_VOID(contextMenuResult_);412 CHECK_NULL_VOID(contextMenuResult_);
413+ VibratorUtils::StartVibraFeedback("longPress.light");
412 ShowContextSelectOverlay(RectF(), RectF());414 ShowContextSelectOverlay(RectF(), RectF());
413}415}
414 416 
@@ -3470,6 +3472,7 @@ bool WebPattern::RunQuickMenu(std::shared_ptr<OHOS::NWeb::NWebQuickMenuParams> p
3470 }3472 }
3471 RegisterSelectOverlayCallback(selectInfo, params, callback);3473 RegisterSelectOverlayCallback(selectInfo, params, callback);
3472 RegisterSelectOverlayEvent(selectInfo);3474 RegisterSelectOverlayEvent(selectInfo);
3475+ VibratorUtils::StartVibraFeedback("longPress.light");
3473 selectOverlayProxy_ = pipeline->GetSelectOverlayManager()->CreateAndShowSelectOverlay(selectInfo, WeakClaim(this));3476 selectOverlayProxy_ = pipeline->GetSelectOverlayManager()->CreateAndShowSelectOverlay(selectInfo, WeakClaim(this));
3474 if (selectInfo.isNewAvoid && selectOverlayProxy_) {3477 if (selectInfo.isNewAvoid && selectOverlayProxy_) {
3475 selectOverlayProxy_->ShowOrHiddenMenu(false);3478 selectOverlayProxy_->ShowOrHiddenMenu(false);