Commit 1bf9bcb1 authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Chromium LUCI CQ

Convert AwViewMsg_SmoothScroll to Mojo

This CL migrates AwViewMsg_SmoothScroll to LocalMainFrame
interface.

Bug: 1157126
Change-Id: I6f179fa63bb0effffb3518b4bf2ed731cd763cf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583591
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836411}
parent 38391991
...@@ -108,9 +108,8 @@ void AwRenderViewHostExt::SetWillSuppressErrorPage(bool suppress) { ...@@ -108,9 +108,8 @@ void AwRenderViewHostExt::SetWillSuppressErrorPage(bool suppress) {
void AwRenderViewHostExt::SmoothScroll(int target_x, void AwRenderViewHostExt::SmoothScroll(int target_x,
int target_y, int target_y,
base::TimeDelta duration) { base::TimeDelta duration) {
web_contents()->GetMainFrame()->Send( if (local_main_frame_remote_)
new AwViewMsg_SmoothScroll(web_contents()->GetMainFrame()->GetRoutingID(), local_main_frame_remote_->SmoothScroll(target_x, target_y, duration);
target_x, target_y, duration));
} }
void AwRenderViewHostExt::RenderFrameCreated( void AwRenderViewHostExt::RenderFrameCreated(
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
module android_webview.mojom; module android_webview.mojom;
import "mojo/public/mojom/base/string16.mojom"; import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
import "skia/public/mojom/skcolor.mojom"; import "skia/public/mojom/skcolor.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom"; import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom"; import "url/mojom/url.mojom";
...@@ -104,6 +105,11 @@ interface LocalMainFrame { ...@@ -104,6 +105,11 @@ interface LocalMainFrame {
// method whenever we want to guarantee that page's scale will be recalculated // method whenever we want to guarantee that page's scale will be recalculated
// by Blink. // by Blink.
ResetScrollAndScaleState(); ResetScrollAndScaleState();
// Tells Blink to smooth scroll to the specified location within |duration|
// miliseconds.
SmoothScroll(
int32 target_x, int32 target_y, mojo_base.mojom.TimeDelta duration);
}; };
// Similar to blink::mojom::FrameHost. Implemented in Browser, this // Similar to blink::mojom::FrameHost. Implemented in Browser, this
......
...@@ -20,12 +20,6 @@ ...@@ -20,12 +20,6 @@
// RenderView messages // RenderView messages
// These are messages sent from the browser to the renderer process. // These are messages sent from the browser to the renderer process.
// Tells blink to smooth scroll to the specified location within |duration_ms|.
IPC_MESSAGE_ROUTED3(AwViewMsg_SmoothScroll,
int /* target_x */,
int /* target_y */,
base::TimeDelta /* duration */)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// RenderView messages // RenderView messages
// These are messages sent from the renderer to the browser process. // These are messages sent from the renderer to the browser process.
......
...@@ -237,15 +237,6 @@ void AwRenderFrameExt::DidCommitProvisionalLoad( ...@@ -237,15 +237,6 @@ void AwRenderFrameExt::DidCommitProvisionalLoad(
} }
} }
bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AwRenderFrameExt, message)
IPC_MESSAGE_HANDLER(AwViewMsg_SmoothScroll, OnSmoothScroll)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
void AwRenderFrameExt::FocusedElementChanged(const blink::WebElement& element) { void AwRenderFrameExt::FocusedElementChanged(const blink::WebElement& element) {
if (element.IsNull() || !render_frame() || !render_frame()->GetRenderView()) if (element.IsNull() || !render_frame() || !render_frame()->GetRenderView())
return; return;
...@@ -341,9 +332,9 @@ void AwRenderFrameExt::DocumentHasImage(DocumentHasImageCallback callback) { ...@@ -341,9 +332,9 @@ void AwRenderFrameExt::DocumentHasImage(DocumentHasImageCallback callback) {
std::move(callback).Run(has_images); std::move(callback).Run(has_images);
} }
void AwRenderFrameExt::OnSmoothScroll(int target_x, void AwRenderFrameExt::SmoothScroll(int32_t target_x,
int target_y, int32_t target_y,
base::TimeDelta duration) { base::TimeDelta duration) {
blink::WebView* webview = GetWebView(); blink::WebView* webview = GetWebView();
if (!webview) if (!webview)
return; return;
......
...@@ -44,12 +44,9 @@ class AwRenderFrameExt : public content::RenderFrameObserver, ...@@ -44,12 +44,9 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
mojo::ScopedInterfaceEndpointHandle* handle) override; mojo::ScopedInterfaceEndpointHandle* handle) override;
void DidCommitProvisionalLoad(ui::PageTransition transition) override; void DidCommitProvisionalLoad(ui::PageTransition transition) override;
bool OnMessageReceived(const IPC::Message& message) override;
void FocusedElementChanged(const blink::WebElement& element) override; void FocusedElementChanged(const blink::WebElement& element) override;
void OnDestruct() override; void OnDestruct() override;
void OnSmoothScroll(int target_x, int target_y, base::TimeDelta duration);
// mojom::LocalMainFrame overrides: // mojom::LocalMainFrame overrides:
void SetBackgroundColor(SkColor c) override; void SetBackgroundColor(SkColor c) override;
void SetInitialPageScale(double page_scale_factor) override; void SetInitialPageScale(double page_scale_factor) override;
...@@ -58,6 +55,9 @@ class AwRenderFrameExt : public content::RenderFrameObserver, ...@@ -58,6 +55,9 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
const gfx::SizeF& touch_area) override; const gfx::SizeF& touch_area) override;
void DocumentHasImage(DocumentHasImageCallback callback) override; void DocumentHasImage(DocumentHasImageCallback callback) override;
void ResetScrollAndScaleState() override; void ResetScrollAndScaleState() override;
void SmoothScroll(int32_t target_x,
int32_t target_y,
base::TimeDelta duration) override;
void BindLocalMainFrame( void BindLocalMainFrame(
mojo::PendingAssociatedReceiver<mojom::LocalMainFrame> pending_receiver); mojo::PendingAssociatedReceiver<mojom::LocalMainFrame> pending_receiver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment