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) {
void AwRenderViewHostExt::SmoothScroll(int target_x,
int target_y,
base::TimeDelta duration) {
web_contents()->GetMainFrame()->Send(
new AwViewMsg_SmoothScroll(web_contents()->GetMainFrame()->GetRoutingID(),
target_x, target_y, duration));
if (local_main_frame_remote_)
local_main_frame_remote_->SmoothScroll(target_x, target_y, duration);
}
void AwRenderViewHostExt::RenderFrameCreated(
......
......@@ -5,6 +5,7 @@
module android_webview.mojom;
import "mojo/public/mojom/base/string16.mojom";
import "mojo/public/mojom/base/time.mojom";
import "skia/public/mojom/skcolor.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
import "url/mojom/url.mojom";
......@@ -104,6 +105,11 @@ interface LocalMainFrame {
// method whenever we want to guarantee that page's scale will be recalculated
// by Blink.
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
......
......@@ -20,12 +20,6 @@
// RenderView messages
// 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
// These are messages sent from the renderer to the browser process.
......
......@@ -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) {
if (element.IsNull() || !render_frame() || !render_frame()->GetRenderView())
return;
......@@ -341,9 +332,9 @@ void AwRenderFrameExt::DocumentHasImage(DocumentHasImageCallback callback) {
std::move(callback).Run(has_images);
}
void AwRenderFrameExt::OnSmoothScroll(int target_x,
int target_y,
base::TimeDelta duration) {
void AwRenderFrameExt::SmoothScroll(int32_t target_x,
int32_t target_y,
base::TimeDelta duration) {
blink::WebView* webview = GetWebView();
if (!webview)
return;
......
......@@ -44,12 +44,9 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
mojo::ScopedInterfaceEndpointHandle* handle) override;
void DidCommitProvisionalLoad(ui::PageTransition transition) override;
bool OnMessageReceived(const IPC::Message& message) override;
void FocusedElementChanged(const blink::WebElement& element) override;
void OnDestruct() override;
void OnSmoothScroll(int target_x, int target_y, base::TimeDelta duration);
// mojom::LocalMainFrame overrides:
void SetBackgroundColor(SkColor c) override;
void SetInitialPageScale(double page_scale_factor) override;
......@@ -58,6 +55,9 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
const gfx::SizeF& touch_area) override;
void DocumentHasImage(DocumentHasImageCallback callback) override;
void ResetScrollAndScaleState() override;
void SmoothScroll(int32_t target_x,
int32_t target_y,
base::TimeDelta duration) override;
void BindLocalMainFrame(
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