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

Convert AwViewMsg_SetTextZoomFactor to Mojo

This CL migrates AwViewMsg_SetTextZoomFactor to
LocalMainFrame interface.

Bug: 1157121
Change-Id: Ieece64440d74fe38b6e7ee6073f98f495aebe058
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2583667
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@{#836373}
parent 19f21b33
......@@ -76,8 +76,8 @@ const mojom::HitTestData& AwRenderViewHostExt::GetLastHitTestData() const {
void AwRenderViewHostExt::SetTextZoomFactor(float factor) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
web_contents()->GetMainFrame()->Send(new AwViewMsg_SetTextZoomFactor(
web_contents()->GetMainFrame()->GetRoutingID(), factor));
if (local_main_frame_remote_)
local_main_frame_remote_->SetTextZoomFactor(factor);
}
void AwRenderViewHostExt::ResetScrollAndScaleState() {
......
......@@ -81,6 +81,10 @@ interface LocalMainFrame {
// Sets the base background color for this view.
SetBackgroundColor(skia.mojom.SkColor color);
// Sets the zoom factor for text only. Used in layout modes other than
// Text Autosizing.
SetTextZoomFactor(float zoom_factor);
// Do hit test at the given webview coordinate. "Webview" coordinates are
// physical pixel values with the 0,0 at the top left of the current displayed
// view (ie 0,0 is not the top left of the page if the page is scrolled).
......
......@@ -20,11 +20,6 @@
// RenderView messages
// These are messages sent from the browser to the renderer process.
// Sets the zoom factor for text only. Used in layout modes other than
// Text Autosizing.
IPC_MESSAGE_ROUTED1(AwViewMsg_SetTextZoomFactor,
float /* zoom_factor */)
// Resets WebKit WebView scrolling and scale state. We need to send this
// message whenever we want to guarantee that page's scale will be
// recalculated by WebKit.
......
......@@ -240,7 +240,6 @@ void AwRenderFrameExt::DidCommitProvisionalLoad(
bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AwRenderFrameExt, message)
IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor)
IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState,
OnResetScrollAndScaleState)
IPC_MESSAGE_HANDLER(AwViewMsg_SetInitialPageScale, OnSetInitialPageScale)
......@@ -301,21 +300,6 @@ void AwRenderFrameExt::HitTest(const gfx::PointF& touch_center,
GetFrameHost()->UpdateHitTestData(std::move(data));
}
void AwRenderFrameExt::OnSetTextZoomFactor(float zoom_factor) {
// TODO(crbug.com/1085428): This will need to be set on every local root
// when site isolation is used in android webview.
DCHECK(render_frame()->IsMainFrame());
blink::WebView* webview = GetWebView();
if (!webview)
return;
// Hide selection and autofill popups.
webview->CancelPagePopup();
render_frame()->GetWebFrame()->FrameWidget()->SetTextZoomFactor(zoom_factor);
}
void AwRenderFrameExt::OnResetScrollAndScaleState() {
blink::WebView* webview = GetWebView();
if (!webview)
......@@ -340,6 +324,21 @@ void AwRenderFrameExt::SetBackgroundColor(SkColor c) {
webview->SetBaseBackgroundColor(c);
}
void AwRenderFrameExt::SetTextZoomFactor(float zoom_factor) {
// TODO(crbug.com/1085428): This will need to be set on every local root
// when site isolation is used in android webview.
DCHECK(render_frame()->IsMainFrame());
blink::WebView* webview = GetWebView();
if (!webview)
return;
// Hide selection and autofill popups.
webview->CancelPagePopup();
render_frame()->GetWebFrame()->FrameWidget()->SetTextZoomFactor(zoom_factor);
}
void AwRenderFrameExt::DocumentHasImage(DocumentHasImageCallback callback) {
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
......
......@@ -48,8 +48,6 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
void FocusedElementChanged(const blink::WebElement& element) override;
void OnDestruct() override;
void OnSetTextZoomFactor(float zoom_factor);
void OnResetScrollAndScaleState();
void OnSetInitialPageScale(double page_scale_factor);
......@@ -58,6 +56,7 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
// mojom::LocalMainFrame overrides:
void SetBackgroundColor(SkColor c) override;
void SetTextZoomFactor(float zoom_factor) override;
void HitTest(const gfx::PointF& touch_center,
const gfx::SizeF& touch_area) override;
void DocumentHasImage(DocumentHasImageCallback callback) override;
......
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