[M120 Migration] Support signal "tooltip,text,unset", "tooltip,text,set" 01/308901/3
authorfangfengrong <fr.fang@samsung.com>
Tue, 2 Apr 2024 11:15:17 +0000 (19:15 +0800)
committerfengrong fang <fr.fang@samsung.com>
Thu, 11 Apr 2024 01:37:04 +0000 (01:37 +0000)
When mouse move over some HTML element,
we will notify WebBrowser about the tooltip information.

When mouse move over HTML element,
we will get related information form EventHandle.

Extract the tooltip string. Send tooltip set
notification when tooltip is not empty.
Otherwise, send tooltip unset notification.

Reference:
https://review.tizen.org/gerrit/#/c/291995

Change-Id: I8d40ce93583036a05238b85d483dcc2d3fe045c9
Signed-off-by: fangfengrong <fr.fang@samsung.com>
content/browser/renderer_host/render_widget_host_view_aura.cc
content/public/browser/web_contents_delegate.h
third_party/blink/renderer/core/page/chrome_client_impl.cc
third_party/blink/renderer/core/page/chrome_client_impl.h
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.cc
tizen_src/chromium_impl/content/browser/renderer_host/rwhv_aura_common_helper_efl.h
tizen_src/ewk/efl_integration/eweb_view.cc
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 d8f0ffd..def9115 100644 (file)
@@ -1074,6 +1074,8 @@ void RenderWidgetHostViewAura::Destroy() {
 
 void RenderWidgetHostViewAura::UpdateTooltipUnderCursor(
     const std::u16string& tooltip_text) {
+  if (efl_helper_)
+    efl_helper_->UpdateTooltipUnderCursor(tooltip_text);
   if (GetCursorManager()->IsViewUnderCursor(this))
     UpdateTooltip(tooltip_text);
 }
index 57d3318..de949f9 100644 (file)
@@ -412,6 +412,7 @@ class CONTENT_EXPORT WebContentsDelegate {
   virtual void MoveFocusToBrowser(int direction) {}
   virtual void ShowMicOpenedNotification(bool show) {}
 #endif
+  virtual void UpdateTooltipUnderCursor(const std::u16string& text) {}
 
   // Returns a pointer to a service to manage JavaScript dialogs. May return
   // nullptr in which case dialogs aren't shown.
index 2e1c196..ca16347 100644 (file)
@@ -657,6 +657,12 @@ void ChromeClientImpl::ShowMouseOverURL(const HitTestResult& result) {
 void ChromeClientImpl::UpdateTooltipUnderCursor(LocalFrame& frame,
                                                 const String& tooltip_text,
                                                 TextDirection dir) {
+  // Only set tool tip text if it has changed since the last time this function
+  // was called.
+  if (tooltip_text == cached_tooltip_text_)
+    return;
+  cached_tooltip_text_ = tooltip_text;
+
   WebFrameWidgetImpl* widget =
       WebLocalFrameImpl::FromFrame(frame)->LocalRootFrameWidget();
   if (!tooltip_text.empty()) {
index cd83178..f46329f 100644 (file)
@@ -340,6 +340,7 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
   bool did_request_non_empty_tool_tip_;
   absl::optional<bool> before_unload_confirm_panel_result_for_testing_;
   HeapHashSet<WeakMember<CommitObserver>> commit_observers_;
+  String cached_tooltip_text_;
 
   FRIEND_TEST_ALL_PREFIXES(FileChooserQueueTest, DerefQueuedChooser);
 };
index b314e4f..f07a065 100644 (file)
@@ -571,6 +571,11 @@ void RWHVAuraCommonHelperEfl::OnGetFocusedNodeBounds(
   web_contents_->GetDelegate()->OnDidChangeFocusedNodeBounds(rect);
 }
 
+void RWHVAuraCommonHelperEfl::UpdateTooltipUnderCursor(
+    const std::u16string& text) {
+  web_contents_->GetDelegate()->UpdateTooltipUnderCursor(text);
+}
+
 void RWHVAuraCommonHelperEfl::BackgroundColorReceived(
     int callback_id, SkColor bg_color) {
   web_contents_->GetDelegate()->BackgroundColorReceived(callback_id, bg_color);
index c0cf7ae..55e9235 100644 (file)
@@ -181,6 +181,7 @@ class CONTENT_EXPORT RWHVAuraCommonHelperEfl {
   void OnGetMainFrameScrollbarVisible(int callback_id, bool visible);
   void TextInputStateChanged(const ui::mojom::TextInputState& params);
   void OnSelectionRectReceived(const gfx::Rect& selection_rect);
+  void UpdateTooltipUnderCursor(const std::u16string&);
 
  protected:
   void SetOffscreenMode() { is_offscreen_mode_ = true; }
index 20fa95d..cd0e1b4 100644 (file)
@@ -2705,6 +2705,7 @@ void EWebView::InvokeWebProcessCrashedCallback() {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   const GURL last_url = GetURL();
   bool callback_handled = false;
+  SmartCallback<EWebViewCallbacks::TooltipTextUnset>().call();
   SmartCallback<EWebViewCallbacks::WebProcessCrashed>().call(&callback_handled);
   if (!callback_handled)
     LoadHTMLString(kRendererCrashedHTMLMessage, NULL,
index 6830c60..623402b 100644 (file)
@@ -248,7 +248,6 @@ DECLARE_EWK_VIEW_CALLBACK(FaviconChanged, "favicon,changed", void);
 DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadFailed, "load,provisional,failed", Ewk_Error*);
 DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,decision,navigation", Ewk_Navigation_Policy_Decision*);
 DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned*);
-DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void);
 DECLARE_EWK_VIEW_CALLBACK(Vibrate, "vibrate", uint32_t*);
 */
 
@@ -263,6 +262,7 @@ DECLARE_EWK_VIEW_CALLBACK(URLChanged, "url,changed", const char*);
 DECLARE_EWK_VIEW_CALLBACK(URIChanged, "uri,changed", const char*);
 DECLARE_EWK_VIEW_CALLBACK(LoadProgress, "load,progress", double*);
 DECLARE_EWK_VIEW_CALLBACK(TooltipTextSet, "tooltip,text,set", const char*);
+DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void);
 DECLARE_EWK_VIEW_CALLBACK(EnterFullscreen, "fullscreen,enterfullscreen", void);
 DECLARE_EWK_VIEW_CALLBACK(ExitFullscreen, "fullscreen,exitfullscreen", void);
 DECLARE_EWK_VIEW_CALLBACK(UserMediaPermission, "usermedia,permission,request", _Ewk_User_Media_Permission_Request*);
index 7eb7f0f..b2317f9 100644 (file)
@@ -904,4 +904,16 @@ void WebContentsDelegateEfl::VideoPlayingStatusReceived(bool is_playing,
     LOG(INFO) << "web_view_ is null";
 }
 #endif
+
+void WebContentsDelegateEfl::UpdateTooltipUnderCursor(
+    const std::u16string& text) {
+  std::string tooltip = base::UTF16ToUTF8(text);
+  LOG(INFO) << __func__ << " " << tooltip.c_str();
+  if (tooltip.empty()) {
+    web_view_->SmartCallback<EWebViewCallbacks::TooltipTextUnset>().call();
+  } else {
+    web_view_->SmartCallback<EWebViewCallbacks::TooltipTextSet>().call(
+        tooltip.c_str());
+  }
+}
 }  // namespace content
index 4e1b834..f1433cd 100644 (file)
@@ -93,6 +93,8 @@ class WebContentsDelegateEfl : public WebContentsDelegate {
                                 const std::string& url) override;
   void WillDraw(int rotation, gfx::Size frame_data_output_size) override;
 #endif
+  void UpdateTooltipUnderCursor(const std::u16string& text) override;
+
   void RequestCertificateConfirm(
       WebContents* web_contents,
       int cert_error,