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

Convert AwViewMsg_DoHitTest to Mojo message

This CL converts AwViewMsg_DoHitTest to android_webview's
LocalMainFrame interface with renaming to HitTest.

Bug: 1146495
Change-Id: I8c819818af62c3a7bdedd9511f0297c023cb26cf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2567058Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarNate Fischer <ntfschr@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Cr-Commit-Position: refs/heads/master@{#833006}
parent 0bfe09cf
...@@ -67,10 +67,10 @@ void AwRenderViewHostExt::RequestNewHitTestDataAt( ...@@ -67,10 +67,10 @@ void AwRenderViewHostExt::RequestNewHitTestDataAt(
const gfx::SizeF& touch_area) { const gfx::SizeF& touch_area) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// We only need to get blink::WebView on the renderer side to invoke the // We only need to get blink::WebView on the renderer side to invoke the
// blink hit test API, so sending this IPC to main frame is enough. // blink hit test Mojo method, so sending this message via LocalMainFrame
web_contents()->GetMainFrame()->Send( // interface is enough.
new AwViewMsg_DoHitTest(web_contents()->GetMainFrame()->GetRoutingID(), if (local_main_frame_remote_)
touch_center, touch_area)); local_main_frame_remote_->HitTest(touch_center, touch_area);
} }
const AwHitTestData& AwRenderViewHostExt::GetLastHitTestData() const { const AwHitTestData& AwRenderViewHostExt::GetLastHitTestData() const {
......
...@@ -72,5 +72,6 @@ mojom("mojom") { ...@@ -72,5 +72,6 @@ mojom("mojom") {
public_deps = [ public_deps = [
"//mojo/public/mojom/base", "//mojo/public/mojom/base",
"//skia/public/mojom", "//skia/public/mojom",
"//ui/gfx/geometry/mojom",
] ]
} }
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
module android_webview.mojom; module android_webview.mojom;
import "skia/public/mojom/skcolor.mojom"; import "skia/public/mojom/skcolor.mojom";
import "ui/gfx/geometry/mojom/geometry.mojom";
// Similar to blink::mojom::LocalMainFrame. This interface adds additional // Similar to blink::mojom::LocalMainFrame. This interface adds additional
// things that webview needs from the main frame. // things that webview needs from the main frame.
...@@ -12,4 +13,13 @@ interface LocalMainFrame { ...@@ -12,4 +13,13 @@ interface LocalMainFrame {
// Sets the base background color for this view. // Sets the base background color for this view.
SetBackgroundColor(skia.mojom.SkColor color); SetBackgroundColor(skia.mojom.SkColor color);
// 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).
// AwRenderViewHostExt::OnUpdateHitTestData receives the result of the hit
// test via AwViewHostMsg_UpdateHitTestData IPC message.
// TODO(crbug.com/1146495): AwViewHostMsg_UpdateHitTestData IPC message should
// be converted to LocalMainFrameHost interface.
HitTest(gfx.mojom.PointF touch_center, gfx.mojom.SizeF touch_area);
}; };
...@@ -35,13 +35,6 @@ IPC_STRUCT_TRAITS_END() ...@@ -35,13 +35,6 @@ IPC_STRUCT_TRAITS_END()
IPC_MESSAGE_ROUTED1(AwViewMsg_DocumentHasImages, IPC_MESSAGE_ROUTED1(AwViewMsg_DocumentHasImages,
uint32_t /* id */) uint32_t /* id */)
// 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).
IPC_MESSAGE_ROUTED2(AwViewMsg_DoHitTest,
gfx::PointF /* touch_center */,
gfx::SizeF /* touch_area */)
// Sets the zoom factor for text only. Used in layout modes other than // Sets the zoom factor for text only. Used in layout modes other than
// Text Autosizing. // Text Autosizing.
IPC_MESSAGE_ROUTED1(AwViewMsg_SetTextZoomFactor, IPC_MESSAGE_ROUTED1(AwViewMsg_SetTextZoomFactor,
......
...@@ -229,7 +229,6 @@ bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) { ...@@ -229,7 +229,6 @@ bool AwRenderFrameExt::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(AwRenderFrameExt, message) IPC_BEGIN_MESSAGE_MAP(AwRenderFrameExt, message)
IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest) IPC_MESSAGE_HANDLER(AwViewMsg_DocumentHasImages, OnDocumentHasImagesRequest)
IPC_MESSAGE_HANDLER(AwViewMsg_DoHitTest, OnDoHitTest)
IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor) IPC_MESSAGE_HANDLER(AwViewMsg_SetTextZoomFactor, OnSetTextZoomFactor)
IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState, IPC_MESSAGE_HANDLER(AwViewMsg_ResetScrollAndScaleState,
OnResetScrollAndScaleState) OnResetScrollAndScaleState)
...@@ -277,8 +276,8 @@ void AwRenderFrameExt::FocusedElementChanged(const blink::WebElement& element) { ...@@ -277,8 +276,8 @@ void AwRenderFrameExt::FocusedElementChanged(const blink::WebElement& element) {
// Only main frame needs to *receive* the hit test request, because all we need // Only main frame needs to *receive* the hit test request, because all we need
// is to get the blink::webView object and invoke a the hitTestResultForTap API // is to get the blink::webView object and invoke a the hitTestResultForTap API
// from it. // from it.
void AwRenderFrameExt::OnDoHitTest(const gfx::PointF& touch_center, void AwRenderFrameExt::HitTest(const gfx::PointF& touch_center,
const gfx::SizeF& touch_area) { const gfx::SizeF& touch_area) {
blink::WebView* webview = GetWebView(); blink::WebView* webview = GetWebView();
if (!webview) if (!webview)
return; return;
......
...@@ -48,8 +48,6 @@ class AwRenderFrameExt : public content::RenderFrameObserver, ...@@ -48,8 +48,6 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
void OnDestruct() override; void OnDestruct() override;
void OnDocumentHasImagesRequest(uint32_t id); void OnDocumentHasImagesRequest(uint32_t id);
void OnDoHitTest(const gfx::PointF& touch_center,
const gfx::SizeF& touch_area);
void OnSetTextZoomFactor(float zoom_factor); void OnSetTextZoomFactor(float zoom_factor);
...@@ -61,6 +59,8 @@ class AwRenderFrameExt : public content::RenderFrameObserver, ...@@ -61,6 +59,8 @@ class AwRenderFrameExt : public content::RenderFrameObserver,
// mojom::LocalMainFrame overrides: // mojom::LocalMainFrame overrides:
void SetBackgroundColor(SkColor c) override; void SetBackgroundColor(SkColor c) override;
void HitTest(const gfx::PointF& touch_center,
const gfx::SizeF& touch_area) 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