Bug 1485834 - Expose the zooming API from WebRender. r=Gankro
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 19 Oct 2018 14:24:14 +0000
changeset 442156 021f6173bd2cc0dff6172c8a63311dbd0b092c63
parent 442155 6ff410edad90dbc51d72aeb722d0ff8d182606c1
child 442157 15786d06ad120f168f69966f616f3d823f1f0869
push id34890
push userdvarga@mozilla.com
push dateSat, 20 Oct 2018 09:40:11 +0000
treeherdermozilla-central@d0f1450799b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGankro
bugs1485834
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1485834 - Expose the zooming API from WebRender. r=Gankro Differential Revision: https://phabricator.services.mozilla.com/D9119
gfx/webrender_bindings/WebRenderAPI.cpp
gfx/webrender_bindings/WebRenderAPI.h
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi_generated.h
--- a/gfx/webrender_bindings/WebRenderAPI.cpp
+++ b/gfx/webrender_bindings/WebRenderAPI.cpp
@@ -272,16 +272,22 @@ TransactionWrapper::AppendTransformPrope
 void
 TransactionWrapper::UpdateScrollPosition(const wr::WrPipelineId& aPipelineId,
                                          const layers::FrameMetrics::ViewID& aScrollId,
                                          const wr::LayoutPoint& aScrollPosition)
 {
   wr_transaction_scroll_layer(mTxn, aPipelineId, aScrollId, aScrollPosition);
 }
 
+void
+TransactionWrapper::UpdatePinchZoom(float aZoom)
+{
+  wr_transaction_pinch_zoom(mTxn, aZoom);
+}
+
 /*static*/ already_AddRefed<WebRenderAPI>
 WebRenderAPI::Create(layers::CompositorBridgeParent* aBridge,
                      RefPtr<widget::CompositorWidget>&& aWidget,
                      const wr::WrWindowId& aWindowId,
                      LayoutDeviceIntSize aSize)
 {
   MOZ_ASSERT(aBridge);
   MOZ_ASSERT(aWidget);
--- a/gfx/webrender_bindings/WebRenderAPI.h
+++ b/gfx/webrender_bindings/WebRenderAPI.h
@@ -177,16 +177,17 @@ class TransactionWrapper
 {
 public:
   explicit TransactionWrapper(Transaction* aTxn);
 
   void AppendTransformProperties(const nsTArray<wr::WrTransformProperty>& aTransformArray);
   void UpdateScrollPosition(const wr::WrPipelineId& aPipelineId,
                             const layers::FrameMetrics::ViewID& aScrollId,
                             const wr::LayoutPoint& aScrollPosition);
+  void UpdatePinchZoom(float aZoom);
 private:
   Transaction* mTxn;
 };
 
 class WebRenderAPI
 {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebRenderAPI);
 
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1356,16 +1356,24 @@ pub extern "C" fn wr_transaction_scroll_
     scroll_id: u64,
     new_scroll_origin: LayoutPoint
 ) {
     let scroll_id = ExternalScrollId(scroll_id, pipeline_id);
     txn.scroll_node_with_id(new_scroll_origin, scroll_id, ScrollClamping::NoClamping);
 }
 
 #[no_mangle]
+pub extern "C" fn wr_transaction_pinch_zoom(
+    txn: &mut Transaction,
+    pinch_zoom: f32
+) {
+    txn.set_pinch_zoom(ZoomFactor::new(pinch_zoom));
+}
+
+#[no_mangle]
 pub extern "C" fn wr_resource_updates_add_image(
     txn: &mut Transaction,
     image_key: WrImageKey,
     descriptor: &WrImageDescriptor,
     bytes: &mut WrVecU8,
 ) {
     txn.add_image(
         image_key,
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -1839,16 +1839,21 @@ extern void wr_transaction_notification_
 
 WR_INLINE
 void wr_transaction_notify(Transaction *aTxn,
                            Checkpoint aWhen,
                            uintptr_t aEvent)
 WR_FUNC;
 
 WR_INLINE
+void wr_transaction_pinch_zoom(Transaction *aTxn,
+                               float aPinchZoom)
+WR_FUNC;
+
+WR_INLINE
 void wr_transaction_remove_pipeline(Transaction *aTxn,
                                     WrPipelineId aPipelineId)
 WR_FUNC;
 
 WR_INLINE
 void wr_transaction_scroll_layer(Transaction *aTxn,
                                  WrPipelineId aPipelineId,
                                  uint64_t aScrollId,