[M108 Migration] Remove EWK_BRINGUP from ewk_view_scroll_by code 14/288514/4
authorayush.k123 <ayush.k123@samsung.com>
Fri, 17 Feb 2023 05:52:49 +0000 (11:22 +0530)
committerBot Blink <blinkbot@samsung.com>
Mon, 20 Feb 2023 07:40:39 +0000 (07:40 +0000)
This patch sets scroll offset via mojo connection instead of legacy ipc.

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

Change-Id: Ib2607477ab3b4bcc4f2b8524349803ada5661f76
Signed-off-by: Ayush Kumar <ayush.k123@samsung.com>
content/test/test_page_broadcast.cc
content/test/test_page_broadcast.h
third_party/blink/public/mojom/page/page.mojom
third_party/blink/renderer/core/exported/web_view_impl.cc
third_party/blink/renderer/core/exported/web_view_impl.h
tizen_src/ewk/efl_integration/eweb_view.cc

index 41c3473..57fad67 100644 (file)
@@ -47,6 +47,8 @@ void TestPageBroadcast::SetHistoryOffsetAndLength(int32_t history_offset,
 
 #if BUILDFLAG(IS_EFL)
 void TestPageBroadcast::ScrollFocusedNodeIntoView() {}
+
+void TestPageBroadcast::SetScrollOffset(float x, float y) {}
 #endif
 
 void TestPageBroadcast::SetPageBaseBackgroundColor(
index 15977c3..c501cfc 100644 (file)
@@ -35,6 +35,7 @@ class TestPageBroadcast : public blink::mojom::PageBroadcast {
                                  int32_t history_length) override;
 #if BUILDFLAG(IS_EFL)
   void ScrollFocusedNodeIntoView() override;
+  void SetScrollOffset(float x, float y) override;
 #endif
   void SetPageBaseBackgroundColor(absl::optional<SkColor> color) override;
   void CreateRemoteMainFrame(
index 07f3ff8..d48ab58 100644 (file)
@@ -107,6 +107,9 @@ interface PageBroadcast {
   [EnableIf=is_efl]
   ScrollFocusedNodeIntoView();
 
+  [EnableIf=is_efl]
+  SetScrollOffset(float x, float y);
+
   // Sent to whole page, but should only be used by the main frame.
   SetPageBaseBackgroundColor(skia.mojom.SkColor? color);
 
index dc80bce..8d44cb5 100644 (file)
@@ -4257,6 +4257,11 @@ bool WebViewImpl::MoveFocusToPrevious(TraverseFocusThrough filter) {
 
   return handled;
 }
+
+void WebViewImpl::SetScrollOffset(float x, float y) {
+  if (auto* focused_frame = FocusedFrame())
+    focused_frame->SetScrollOffset(gfx::PointF(x, y));
+}
 #endif
 
 #if defined(TIZEN_VIDEO_HOLE)
index 11556ab..29c90f5 100644 (file)
@@ -235,6 +235,7 @@ class CORE_EXPORT WebViewImpl final : public WebView,
   bool HasAcceleratedCanvasWithinViewport() const override;
   void SetLongPollingGlobalTimeout(uint64_t timeout) override;
   void ScrollFocusedNodeIntoView() override;
+  void SetScrollOffset(float x, float y) override;
 #endif
 
   // Functions to add and remove observers for this object.
index b6bc1a0..4d4baa0 100644 (file)
@@ -1307,15 +1307,13 @@ void EWebView::ChangeScroll(int& x, int& y) {
 }
 
 void EWebView::SetScroll(int x, int y) {
-  RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
-  if (!render_view_host)
-    return;
-
-  ChangeScroll(x, y);
-#if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
-  render_view_host->Send(
-      new EwkViewMsg_SetScroll(render_view_host->GetRoutingID(), x, y));
-#endif
+  if (auto* render_view_host = web_contents_->GetRenderViewHost()) {
+    if (auto& broadcast = static_cast<RenderViewHostImpl*>(render_view_host)
+                              ->GetAssociatedPageBroadcast()) {
+      ChangeScroll(x, y);
+      broadcast->SetScrollOffset(x, y);
+    }
+  }
 }
 
 void EWebView::UseSettingsFont() {