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