[M108 Migration][VD] Add "hover,over,link" and "hover,out,link" 90/288790/10
authorfeifei08.liu <feifei08.liu@samsunc.com>
Thu, 23 Feb 2023 05:31:57 +0000 (13:31 +0800)
committerBot Blink <blinkbot@samsung.com>
Thu, 2 Mar 2023 05:52:13 +0000 (05:52 +0000)
Implementation of "hover,over,link" and "hover,out,link" callbacks,
notify to client when the mouse hovers over or out a link.

Reference:
- https://review.tizen.org/gerrit/281388/

Change-Id: I490232596f714abd53e8490ce5c0359f4c80bce4
Signed-off-by: feifei08.liu <feifei08.liu@samsung.com>
tizen_src/ewk/efl_integration/eweb_view_callbacks.h
tizen_src/ewk/efl_integration/web_contents_delegate_efl.cc
tizen_src/ewk/efl_integration/web_contents_delegate_efl.h

index 02ec82c..b8e1b1d 100644 (file)
@@ -144,6 +144,10 @@ enum CallbackType {
 #if BUILDFLAG(IS_TIZEN)
   NewWindowNavigationPolicyDecision,
 #endif  // IS_TIZEN
+#if BUILDFLAG(IS_TIZEN_TV)
+  HoverOverLink,
+  HoverOutLink,
+#endif
   URIChanged,
   DidNotAllowScript,
   NotificationPermissionReply,
@@ -307,6 +311,10 @@ DECLARE_EWK_VIEW_CALLBACK(ZoomFinished, "zoom,finished", void);
 DECLARE_EWK_VIEW_CALLBACK(NewWindowNavigationPolicyDecision, "policy,decision,new,window", Ewk_Navigation_Policy_Decision*);
 #endif  // IS_TIZEN
 
+#if BUILDFLAG(IS_TIZEN_TV)
+DECLARE_EWK_VIEW_CALLBACK(HoverOverLink, "hover,over,link", const char*);
+DECLARE_EWK_VIEW_CALLBACK(HoverOutLink, "hover,out,link", const char*);
+#endif
 DECLARE_EWK_VIEW_CALLBACK(ContentsSizeChanged, "contents,size,changed", void);
 DECLARE_EWK_VIEW_CALLBACK(MenuBarVisible, "menubar,visible", bool*);
 DECLARE_EWK_VIEW_CALLBACK(StatusBarVisible, "statusbar,visible", bool*);
index 467fd3b..f31141f 100644 (file)
@@ -677,6 +677,28 @@ void WebContentsDelegateEfl::OnDidGetManifest(
   }
 }
 
+#if BUILDFLAG(IS_TIZEN_TV)
+void WebContentsDelegateEfl::UpdateTargetURL(WebContents* /*source*/,
+                                             const GURL& url) {
+  std::string absolute_link_url(url.spec());
+  if (absolute_link_url == last_hovered_url_)
+    return;
+
+  if (absolute_link_url.empty()) {
+    // If length is 0, it is not link. send "hover,out,link" callback with the
+    // original hovered URL.
+    web_view_->SmartCallback<EWebViewCallbacks::HoverOutLink>().call(
+        last_hovered_url_.c_str());
+  } else {
+    web_view_->SmartCallback<EWebViewCallbacks::HoverOverLink>().call(
+        absolute_link_url.c_str());
+  }
+
+  // Update latest hovered url.
+  last_hovered_url_ = absolute_link_url;
+}
+#endif
+
 void WebContentsDelegateEfl::OnGetMainFrameScrollbarVisible(int callback_id,
                                                             bool visible) {
   web_view_->InvokeMainFrameScrollbarVisibleCallback(callback_id, visible);
index bc6ceeb..8a9a4a7 100644 (file)
@@ -136,6 +136,10 @@ class WebContentsDelegateEfl : public WebContentsDelegate {
                               MediaResponseCallback callback);
 #endif
 
+#if BUILDFLAG(IS_TIZEN_TV)
+  void UpdateTargetURL(WebContents* source, const GURL& url) override;
+#endif
+
 #if defined(TIZEN_AUTOFILL_SUPPORT)
   void UpdateAutofillIfRequired();
 #endif
@@ -148,6 +152,9 @@ class WebContentsDelegateEfl : public WebContentsDelegate {
   EWebView* web_view_;
   bool is_fullscreen_;
   WebContents& web_contents_;
+#if BUILDFLAG(IS_TIZEN_TV)
+  std::string last_hovered_url_;
+#endif
 
   bool did_render_frame_ = false;
   bool did_first_visually_non_empty_paint_ = false;