Commit d1f6c4dd authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Convert ViewMsg_AnimateDoubleTapZoom to a blink MainFrame mojom message

This CL converts ViewMsg_AnimateDoubleTapZoom to a blink MainFrame. It
introduces AnimateDoubleTapZoom to LocalMainFrame and blink::LocalFrame
implements it.

Bug: 1047466
Change-Id: Ibc721c9cf11b1f4629c83fa25ae911474451afe4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2083981
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746759}
parent cb8ff730
......@@ -789,6 +789,13 @@ void RenderViewHostImpl::SetInitialFocus(bool reverse) {
->SetInitialFocus(reverse);
}
void RenderViewHostImpl::AnimateDoubleTapZoom(const gfx::Point& point,
const gfx::Rect& rect) {
static_cast<RenderFrameHostImpl*>(GetMainFrame())
->GetAssociatedLocalMainFrame()
->AnimateDoubleTapZoom(point, rect);
}
void RenderViewHostImpl::RenderWidgetDidFirstVisuallyNonEmptyPaint() {
did_first_visually_non_empty_paint_ = true;
delegate_->DidFirstVisuallyNonEmptyPaint(this);
......
......@@ -166,6 +166,10 @@ class CONTENT_EXPORT RenderViewHostImpl
// https://crbug.com/763548.
void DispatchRenderViewCreated();
// Tells the renderer process to request a page-scale animation based on the
// specified point/rect.
void AnimateDoubleTapZoom(const gfx::Point& point, const gfx::Rect& rect);
// Tells the renderer process to run the page's unload handler.
// A completion callback is invoked by the renderer when the handler
// execution completes.
......
......@@ -3126,8 +3126,7 @@ void RenderWidgetHostImpl::OnAnimateDoubleTapZoomInMainFrame(
}
auto* root_rvhi = RenderViewHostImpl::From(root_view->GetRenderWidgetHost());
root_rvhi->Send(new ViewMsg_AnimateDoubleTapZoom(
root_rvhi->GetRoutingID(), transformed_point, transformed_rect_to_zoom));
root_rvhi->AnimateDoubleTapZoom(transformed_point, transformed_rect_to_zoom);
}
void RenderWidgetHostImpl::OnZoomToFindInPageRectInMainFrame(
......
......@@ -127,12 +127,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_PpapiBrokerPermissionResult,
bool /* result */)
#endif
// Sent to the main-frame's view to request performing a page scale animation
// based on the point/rect provided.
IPC_MESSAGE_ROUTED2(ViewMsg_AnimateDoubleTapZoom,
gfx::Point /* tap point */,
gfx::Rect /* rect_to_zoom */)
// Sent to the main-frame's view to request performing a zoom-to-find-in-page
// based on the rect provided.
IPC_MESSAGE_ROUTED1(ViewMsg_ZoomToFindInPageRect, gfx::Rect /*rect_to_zoom */)
......
......@@ -1174,8 +1174,6 @@ bool RenderViewImpl::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_MoveOrResizeStarted, OnMoveOrResizeStarted)
IPC_MESSAGE_HANDLER(ViewMsg_EnablePreferredSizeChangedMode,
OnEnablePreferredSizeChangedMode)
IPC_MESSAGE_HANDLER(ViewMsg_AnimateDoubleTapZoom,
OnAnimateDoubleTapZoomInMainFrame)
IPC_MESSAGE_HANDLER(ViewMsg_ZoomToFindInPageRect, OnZoomToFindInPageRect)
IPC_MESSAGE_HANDLER(ViewMsg_SetBackgroundOpaque, OnSetBackgroundOpaque)
......@@ -1924,12 +1922,6 @@ void RenderViewImpl::SetFocusAndActivateForTesting(bool enable) {
}
}
void RenderViewImpl::OnAnimateDoubleTapZoomInMainFrame(
const gfx::Point& point,
const blink::WebRect& bound) {
GetWebView()->AnimateDoubleTapZoom(point, bound);
}
void RenderViewImpl::OnZoomToFindInPageRect(
const blink::WebRect& rect_to_zoom) {
GetWebView()->ZoomToFindInPageRect(rect_to_zoom);
......
......@@ -405,8 +405,6 @@ class CONTENT_EXPORT RenderViewImpl : public blink::WebViewClient,
void OnDisableScrollbarsForSmallWindows(
const gfx::Size& disable_scrollbars_size_limit);
void OnEnablePreferredSizeChangedMode();
void OnAnimateDoubleTapZoomInMainFrame(const gfx::Point& point,
const blink::WebRect& rect_to_zoom);
void OnZoomToFindInPageRect(const blink::WebRect& rect_to_zoom);
void OnMoveOrResizeStarted();
void OnExitFullscreen();
......
......@@ -602,6 +602,9 @@ interface RemoteFrame {
//
// This interface will only be provided when the LocalFrame is a main frame.
interface LocalMainFrame {
// Requests performing a page scale animation based on the point/rect provided.
AnimateDoubleTapZoom(gfx.mojom.Point point, gfx.mojom.Rect rect);
// Scales the view without affecting layout by using the visual viewport.
SetScaleFactor(float scale);
......
......@@ -278,9 +278,6 @@ class WebView {
// WebView.
virtual WebSize ContentsPreferredMinimumSize() = 0;
// Requests a page-scale animation based on the specified point/rect.
virtual void AnimateDoubleTapZoom(const gfx::Point&, const WebRect&) = 0;
// Requests a page-scale animation based on the specified rect.
virtual void ZoomToFindInPageRect(const WebRect&) = 0;
......
......@@ -178,8 +178,6 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void SetIgnoreViewportTagScaleLimits(bool) override;
WebSize ContentsPreferredMinimumSize() override;
void SetDisplayMode(blink::mojom::DisplayMode) override;
void AnimateDoubleTapZoom(const gfx::Point&,
const WebRect& block_bounds) override;
void ZoomToFindInPageRect(const WebRect&) override;
void SetDeviceScaleFactor(float) override;
void SetZoomFactorForDeviceScaleFactor(float) override;
......@@ -216,6 +214,9 @@ class CORE_EXPORT WebViewImpl final : public WebView,
void PaintContent(cc::PaintCanvas*, const gfx::Rect&) override;
void SetTextAutosizerPageInfo(const WebTextAutosizerPageInfo&) override;
// Requests a page-scale animation based on the specified point/rect.
void AnimateDoubleTapZoom(const gfx::Point&, const WebRect& block_bounds);
float DefaultMinimumPageScaleFactor() const;
float DefaultMaximumPageScaleFactor() const;
float ClampPageScaleFactorToLimits(float) const;
......
......@@ -2019,6 +2019,11 @@ void LocalFrame::EvictFromBackForwardCache() {
GetLocalFrameHostRemote().EvictFromBackForwardCache();
}
void LocalFrame::AnimateDoubleTapZoom(const gfx::Point& point,
const gfx::Rect& rect) {
GetPage()->GetChromeClient().AnimateDoubleTapZoom(point, rect);
}
void LocalFrame::SetScaleFactor(float scale_factor) {
DCHECK(IsMainFrame());
......
......@@ -528,6 +528,8 @@ class CORE_EXPORT LocalFrame final : public Frame,
void DidUpdateFramePolicy(const FramePolicy& frame_policy) final;
// blink::mojom::LocalMainFrame overrides:
void AnimateDoubleTapZoom(const gfx::Point& point,
const gfx::Rect& rect) override;
void SetScaleFactor(float scale) override;
void ClosePage(
mojom::blink::LocalMainFrame::ClosePageCallback callback) override;
......
......@@ -355,6 +355,9 @@ class CORE_EXPORT ChromeClient : public GarbageCollected<ChromeClient> {
virtual void FullscreenElementChanged(Element* old_element,
Element* new_element) {}
virtual void AnimateDoubleTapZoom(const gfx::Point& point,
const gfx::Rect& rect) {}
virtual void ClearLayerSelection(LocalFrame*) {}
virtual void UpdateLayerSelection(LocalFrame*, const cc::LayerSelection&) {}
......
......@@ -821,6 +821,11 @@ void ChromeClientImpl::FullscreenElementChanged(Element* old_element,
web_view_->FullscreenElementChanged(old_element, new_element);
}
void ChromeClientImpl::AnimateDoubleTapZoom(const gfx::Point& point,
const gfx::Rect& rect) {
web_view_->AnimateDoubleTapZoom(point, WebRect(rect));
}
void ChromeClientImpl::ClearLayerSelection(LocalFrame* frame) {
WebFrameWidgetBase* widget =
WebLocalFrameImpl::FromFrame(frame)->LocalRootFrameWidget();
......
......@@ -183,6 +183,9 @@ class CORE_EXPORT ChromeClientImpl final : public ChromeClient {
void FullscreenElementChanged(Element* old_element,
Element* new_element) override;
void AnimateDoubleTapZoom(const gfx::Point& point,
const gfx::Rect& rect) override;
void ClearLayerSelection(LocalFrame*) override;
void UpdateLayerSelection(LocalFrame*, const cc::LayerSelection&) 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