diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index a5367aab048..bd165838393 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -420,7 +420,7 @@ parent: * Instructs the TabParent to forward a request to zoom to a rect given in * CSS pixels. This rect is relative to the document. */ - ZoomToRect(uint32_t aPresShellId, ViewID aViewId, CSSRect aRect); + ZoomToRect(uint32_t aPresShellId, ViewID aViewId, CSSRect aRect, uint32_t aFlags); /** * We know for sure that content has either preventDefaulted or not diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 137b64fd8a9..0ef630e82c6 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -1688,7 +1688,7 @@ TabChild::RecvHandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifier ViewID viewId; if (APZCCallbackHelper::GetOrCreateScrollIdentifiers( document->GetDocumentElement(), &presShellId, &viewId)) { - SendZoomToRect(presShellId, viewId, zoomToRect); + SendZoomToRect(presShellId, viewId, zoomToRect, DEFAULT_BEHAVIOR); } return true; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 54cee67fa2d..60c0e5baa6c 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -2798,10 +2798,11 @@ TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener, bool TabParent::RecvZoomToRect(const uint32_t& aPresShellId, const ViewID& aViewId, - const CSSRect& aRect) + const CSSRect& aRect, + const uint32_t& aFlags) { if (RenderFrameParent* rfp = GetRenderFrame()) { - rfp->ZoomToRect(aPresShellId, aViewId, aRect); + rfp->ZoomToRect(aPresShellId, aViewId, aRect, aFlags); } return true; } diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index f396b19e1ce..7683a2191e5 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -299,7 +299,8 @@ public: virtual bool RecvZoomToRect(const uint32_t& aPresShellId, const ViewID& aViewId, - const CSSRect& aRect) override; + const CSSRect& aRect, + const uint32_t& aFlags) override; virtual bool RecvUpdateZoomConstraints(const uint32_t& aPresShellId, diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index a5d59926d6c..b6225bba61d 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -506,11 +506,12 @@ RenderFrameParent::BuildDisplayList(nsDisplayListBuilder* aBuilder, void RenderFrameParent::ZoomToRect(uint32_t aPresShellId, ViewID aViewId, - const CSSRect& aRect) + const CSSRect& aRect, + const uint32_t aFlags) { if (GetApzcTreeManager()) { GetApzcTreeManager()->ZoomToRect(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId), - aRect); + aRect, aFlags); } } diff --git a/layout/ipc/RenderFrameParent.h b/layout/ipc/RenderFrameParent.h index 7320e516418..3d4bed00b93 100644 --- a/layout/ipc/RenderFrameParent.h +++ b/layout/ipc/RenderFrameParent.h @@ -79,7 +79,7 @@ public: void OwnerContentChanged(nsIContent* aContent); - void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect); + void ZoomToRect(uint32_t aPresShellId, ViewID aViewId, const CSSRect& aRect, const uint32_t aFlags); void ContentReceivedInputBlock(const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId, diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 9359cf26e07..cd3eba35b63 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -1424,5 +1424,18 @@ PuppetWidget::SetCandidateWindowForPlugin(int32_t aX, int32_t aY) mTabChild->SendSetCandidateWindowForPlugin(aX, aY); } +void +PuppetWidget::ZoomToRect(const uint32_t& aPresShellId, + const FrameMetrics::ViewID& aViewId, + const CSSRect& aRect, + const uint32_t& aFlags) +{ + if (!mTabChild) { + return; + } + + mTabChild->SendZoomToRect(aPresShellId, aViewId, aRect, aFlags); +} + } // namespace widget } // namespace mozilla diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h index a4243f47fe1..a9ea5c03626 100644 --- a/widget/PuppetWidget.h +++ b/widget/PuppetWidget.h @@ -40,6 +40,7 @@ class PuppetWidget : public nsBaseWidget typedef mozilla::dom::TabChild TabChild; typedef mozilla::gfx::DrawTarget DrawTarget; typedef nsBaseWidget Base; + typedef mozilla::CSSRect CSSRect; // The width and height of the "widget" are clamped to this. static const size_t kMaxDimension; @@ -254,6 +255,10 @@ public: virtual void SetCandidateWindowForPlugin(int32_t aX, int32_t aY) override; + virtual void ZoomToRect(const uint32_t& aPresShellId, + const FrameMetrics::ViewID& aViewId, + const CSSRect& aRect, + const uint32_t& aFlags) override; protected: virtual nsresult NotifyIMEInternal( const IMENotification& aIMENotification) override; diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp index af9dd7cd7b7..c3497c4ee5d 100644 --- a/widget/nsBaseWidget.cpp +++ b/widget/nsBaseWidget.cpp @@ -1803,6 +1803,19 @@ nsBaseWidget::GetTextEventDispatcher() return mTextEventDispatcher; } +void +nsBaseWidget::ZoomToRect(const uint32_t& aPresShellId, + const FrameMetrics::ViewID& aViewId, + const CSSRect& aRect, + const uint32_t& aFlags) +{ + if (!mCompositorParent || !mAPZC) { + return; + } + uint64_t layerId = mCompositorParent->RootLayerTreeId(); + mAPZC->ZoomToRect(ScrollableLayerGuid(layerId, aPresShellId, aViewId), aRect, aFlags); +} + #ifdef ACCESSIBILITY a11y::Accessible* diff --git a/widget/nsBaseWidget.h b/widget/nsBaseWidget.h index 72d014dafb5..6ff115ef856 100644 --- a/widget/nsBaseWidget.h +++ b/widget/nsBaseWidget.h @@ -100,6 +100,7 @@ protected: typedef mozilla::layers::APZEventState APZEventState; typedef mozilla::layers::SetAllowedTouchBehaviorCallback SetAllowedTouchBehaviorCallback; typedef mozilla::CSSIntRect CSSIntRect; + typedef mozilla::CSSRect CSSRect; typedef mozilla::ScreenRotation ScreenRotation; virtual ~nsBaseWidget(); @@ -251,7 +252,10 @@ public: virtual nsIWidgetListener* GetPreviouslyAttachedWidgetListener() override; virtual void SetPreviouslyAttachedWidgetListener(nsIWidgetListener* aListener) override; NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() override final; - + virtual void ZoomToRect(const uint32_t& aPresShellId, + const FrameMetrics::ViewID& aViewId, + const CSSRect& aRect, + const uint32_t& aFlags) override; // Helper function for dispatching events which are not processed by APZ, // but need to be transformed by APZ. nsEventStatus DispatchInputEvent(mozilla::WidgetInputEvent* aEvent) override; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index ca9375fbe05..7f098091566 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -133,8 +133,8 @@ typedef void* nsNativeWidget; #endif #define NS_IWIDGET_IID \ -{ 0x73c0a475, 0x450f, 0x4202, \ - { 0xab, 0xb4, 0x62, 0xf8, 0x9d, 0xbe, 0xf7, 0x9a } } +{ 0x6dc8ce1f, 0xbb55, 0x47c1, \ + { 0xa1, 0x6f, 0x4e, 0x12, 0x37, 0xa1, 0xc2, 0xf4 } } /* * Window shadow styles @@ -350,6 +350,7 @@ class nsIWidget : public nsISupports { typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize; typedef mozilla::ScreenIntPoint ScreenIntPoint; typedef mozilla::DesktopIntRect DesktopIntRect; + typedef mozilla::CSSRect CSSRect; // Used in UpdateThemeGeometries. struct ThemeGeometry { @@ -2069,6 +2070,11 @@ public: */ NS_IMETHOD_(TextEventDispatcher*) GetTextEventDispatcher() = 0; + virtual void ZoomToRect(const uint32_t& aPresShellId, + const FrameMetrics::ViewID& aViewId, + const CSSRect& aRect, + const uint32_t& aFlags) = 0; + protected: /** * Like GetDefaultScale, but taking into account only the system settings