[M108 Migration] Add "custom,scroll,begin","custom,scroll,end" support 08/288708/4
authorayush.k123 <ayush.k123@samsung.com>
Wed, 22 Feb 2023 02:45:01 +0000 (08:15 +0530)
committerBot Blink <blinkbot@samsung.com>
Wed, 22 Feb 2023 14:13:41 +0000 (14:13 +0000)
Handles and context menu should be temporarily hidden durnig scrolling.
But specific applications like email-app uses their own scrolling
mechanism within chromium-efl does not know about this happening.
This breaks chromium-EFL behaviour.

To meet these requirements email-app provided smart callbacks to
notify engine that custom scrolling is started and finished.

The patch is a counterpart of above smart callbacks.

Reference: https://review.tizen.org/gerrit/281741

Change-Id: I5ab6d978b50b4e9ed4302ad28fcc65f1c248453b
Signed-off-by: Ayush Kumar <ayush.k123@samsung.com>
tizen_src/ewk/efl_integration/eweb_view.cc

index 4638300..5d6f3a4 100644 (file)
@@ -115,6 +115,12 @@ static const char* kRendererCrashedHTMLMessage =
 // that the web view is only partially visible.
 static const char* kVisibleContentChangedSignalName = "visible,content,changed";
 
+// email-app specific signal which informs that custom scrolling is started.
+const char* kCustomScrollBeginSignalName = "custom,scroll,begin";
+
+// email-app specific signal which informs that custom scrolling is finished.
+const char* kCustomScrollEndSignalName = "custom,scroll,end";
+
 inline void SetDefaultStringIfNull(const char*& variable,
                                    const char* default_string) {
   if (!variable) {
@@ -284,15 +290,17 @@ void EWebView::VisibleContentChangedCallback(void* user_data,
 void EWebView::OnCustomScrollBeginCallback(void* user_data,
                                            Evas_Object* /*object*/,
                                            void* /*event_info*/) {
-  auto view = static_cast<EWebView*>(user_data);
-  view->GetSelectionController()->SetControlsTemporarilyHidden(true, true);
+  auto* view = static_cast<EWebView*>(user_data);
+  if (auto* selection_controller = view->GetSelectionController())
+    selection_controller->SetControlsTemporarilyHidden(true,true);
 }
 
 void EWebView::OnCustomScrollEndCallback(void* user_data,
                                          Evas_Object* /*object*/,
                                          void* /*event_info*/) {
-  auto view = static_cast<EWebView*>(user_data);
-  view->GetSelectionController()->SetControlsTemporarilyHidden(false, true);
+  auto* view = static_cast<EWebView*>(user_data);
+  if (auto* selection_controller = view->GetSelectionController())
+    selection_controller->SetControlsTemporarilyHidden(false,true);
 }
 
 EWebView::EWebView(Ewk_Context* context, Evas_Object* object)
@@ -314,6 +322,10 @@ EWebView::EWebView(Ewk_Context* context, Evas_Object* object)
                                   kVisibleContentChangedSignalName,
                                   VisibleContentChangedCallback, this);
 
+   evas_object_smart_callback_add(evas_object_, kCustomScrollBeginSignalName,
+                                   OnCustomScrollBeginCallback, this);
+   evas_object_smart_callback_add(evas_object_, kCustomScrollEndSignalName,
+                                   OnCustomScrollEndCallback, this);
    evas_object_event_callback_add(evas_object_, EVAS_CALLBACK_FOCUS_IN,
                                   OnViewFocusIn, this);
    evas_object_event_callback_add(evas_object_, EVAS_CALLBACK_FOCUS_OUT,
@@ -445,6 +457,10 @@ EWebView::~EWebView() {
     evas_object_smart_callback_del(evas_object_,
                                    kVisibleContentChangedSignalName,
                                    VisibleContentChangedCallback);
+    evas_object_smart_callback_del(evas_object_, kCustomScrollBeginSignalName,
+                                   OnCustomScrollBeginCallback);
+    evas_object_smart_callback_del(evas_object_, kCustomScrollEndSignalName,
+                                   OnCustomScrollEndCallback);
   }
 }