Bug 866232 - Update the Windows Metro code to handle APZCTreeManager. r=BenWa, bbondy
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 30 Jul 2013 14:03:43 -0400
changeset 152829 ca9bf5ddb290e47e5cfdf7f2b0c157f4b88b59a0
parent 152828 bdf483d094bf047baac630561720e5c91820e4bf
child 152830 339a9e2e24dafceaf8a3595808df2492c400e21e
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa, bbondy
bugs866232
milestone25.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 866232 - Update the Windows Metro code to handle APZCTreeManager. r=BenWa, bbondy
widget/windows/winrt/MetroWidget.cpp
widget/windows/winrt/MetroWidget.h
--- a/widget/windows/winrt/MetroWidget.cpp
+++ b/widget/windows/winrt/MetroWidget.cpp
@@ -135,17 +135,17 @@ namespace {
     }
     Log("  No more input messages");
   }
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(MetroWidget, nsBaseWidget)
 
 
-nsRefPtr<mozilla::layers::AsyncPanZoomController> MetroWidget::sAPZC;
+nsRefPtr<mozilla::layers::APZCTreeManager> MetroWidget::sAPZC;
 
 MetroWidget::MetroWidget() :
   mTransparencyMode(eTransparencyOpaque),
   mWnd(NULL),
   mMetroWndProc(NULL),
   mTempBasicLayerInUse(false),
   nsWindowBase()
 {
@@ -161,17 +161,16 @@ MetroWidget::MetroWidget() :
 MetroWidget::~MetroWidget()
 {
   LogThis();
 
   gInstanceCount--;
 
   // Global shutdown
   if (!gInstanceCount) {
-    MetroWidget::sAPZC->Destroy();
     MetroWidget::sAPZC = nullptr;
     nsTextStore::Terminate();
   } // !gInstanceCount
 }
 
 static bool gTopLevelAssigned = false;
 NS_IMETHODIMP
 MetroWidget::Create(nsIWidget *aParent,
@@ -808,32 +807,18 @@ public:
     mMetroWidget(aMetroWidget)
   {
     nsresult rv;
     nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
     if (NS_SUCCEEDED(rv)) {
       observerService->AddObserver(this, "viewport-needs-updating", false);
     }
 
-    if (MetroWidget::sAPZC) {
-        MetroWidget::sAPZC->SetCompositorParent(this);
-    }
-  }
-
-  virtual void ShadowLayersUpdated(LayerTransactionParent* aLayerTree, const TargetConfig& aTargetConfig,
-                                   bool isFirstPaint) MOZ_OVERRIDE
-  {
-    CompositorParent::ShadowLayersUpdated(aLayerTree, aTargetConfig, isFirstPaint);
-    Layer* targetLayer = GetLayerManager()->GetPrimaryScrollableLayer();
-    if (targetLayer && targetLayer->AsContainerLayer() && MetroWidget::sAPZC &&
-        targetLayer->AsContainerLayer()->GetFrameMetrics().IsScrollable()) {
-      targetLayer->AsContainerLayer()->SetAsyncPanZoomController(MetroWidget::sAPZC);
-      MetroWidget::sAPZC->NotifyLayersUpdated(targetLayer->AsContainerLayer()->GetFrameMetrics(),
-                                              isFirstPaint);
-    }
+    CompositorParent::SetControllerForLayerTree(RootLayerTreeId(), aMetroWidget);
+    MetroWidget::sAPZC = CompositorParent::GetAPZCTreeManager(RootLayerTreeId());
   }
 
   NS_IMETHODIMP Observe(nsISupports *subject, const char *topic, const PRUnichar *data)
   {
     LogFunction();
 
     NS_ENSURE_ARG_POINTER(topic);
     if (!strcmp(topic, "viewport-needs-updating")) {
@@ -841,17 +826,16 @@ public:
       if (targetLayer && targetLayer->AsContainerLayer() && MetroWidget::sAPZC) {
         FrameMetrics frameMetrics =
           targetLayer->AsContainerLayer()->GetFrameMetrics();
         frameMetrics.mDisplayPort =
           AsyncPanZoomController::CalculatePendingDisplayPort(frameMetrics,
                                                               mozilla::gfx::Point(0.0f, 0.0f),
                                                               mozilla::gfx::Point(0.0f, 0.0f),
                                                               0.0);
-        MetroWidget::sAPZC->NotifyLayersUpdated(frameMetrics, true);
         mMetroWidget->RequestContentRepaint(frameMetrics);
       }
     }
     return NS_OK;
   }
 
 protected:
   nsCOMPtr<MetroWidget> mMetroWidget;
@@ -905,20 +889,16 @@ MetroWidget::GetLayerManager(PLayerTrans
   HRESULT hr = S_OK;
 
   // Create a layer manager: try to use an async compositor first, if enabled.
   // Otherwise fall back on the main thread d3d manager.
   if (!mLayerManager) {
     if (ShouldUseOffMainThreadCompositing()) {
       NS_ASSERTION(aShadowManager == nullptr, "Async Compositor not supported with e10s");
       CreateCompositor();
-      if (ShouldUseAPZC()) {
-        sAPZC = new AsyncPanZoomController(this, AsyncPanZoomController::USE_GESTURE_DETECTOR);
-        sAPZC->SetCompositorParent(mCompositorParent);
-      }
     } else if (ShouldUseMainThreadD3D10Manager()) {
       nsRefPtr<mozilla::layers::LayerManagerD3D10> layerManager =
         new mozilla::layers::LayerManagerD3D10(this);
       if (layerManager->Initialize(true, &hr)) {
         mLayerManager = layerManager;
       }
     } else if (ShouldUseBasicManager()) {
       mLayerManager = CreateBasicLayerManager();
@@ -1452,17 +1432,17 @@ MetroWidget::HandleLongTap(const CSSIntP
   if (!mMetroInput) {
     return;
   }
 
   mMetroInput->HandleLongTap(aPoint);
 }
 
 void
-MetroWidget::SendAsyncScrollDOMEvent(const CSSRect &aContentRect, const CSSSize &aScrollableSize)
+MetroWidget::SendAsyncScrollDOMEvent(FrameMetrics::ViewID aScrollId, const CSSRect &aContentRect, const CSSSize &aScrollableSize)
 {
   LogFunction();
 }
 
 void
 MetroWidget::PostDelayedTask(Task* aTask, int aDelayMs)
 {
   LogFunction();
--- a/widget/windows/winrt/MetroWidget.h
+++ b/widget/windows/winrt/MetroWidget.h
@@ -18,17 +18,17 @@
 #include "WindowHook.h"
 #include "TaskbarWindowPreview.h"
 #include "nsIdleService.h"
 #ifdef ACCESSIBILITY
 #include "mozilla/a11y/Accessible.h"
 #endif
 #include "mozilla/layers/CompositorParent.h"
 #include "mozilla/layers/GeckoContentController.h"
-#include "mozilla/layers/AsyncPanZoomController.h"
+#include "mozilla/layers/APZCTreeManager.h"
 #include "mozilla/layers/LayerManagerComposite.h"
 #include "Units.h"
 #include "MetroInput.h"
 
 #include "mozwrlbase.h"
 
 #include <windows.system.h>
 #include <windows.ui.core.h>
@@ -186,17 +186,17 @@ public:
   nsresult RequestContentScroll();
   void RequestContentRepaintImplMainThread();
 
   // GeckoContentController interface impl
   virtual void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics);
   virtual void HandleDoubleTap(const mozilla::CSSIntPoint& aPoint);
   virtual void HandleSingleTap(const mozilla::CSSIntPoint& aPoint);
   virtual void HandleLongTap(const mozilla::CSSIntPoint& aPoint);
-  virtual void SendAsyncScrollDOMEvent(const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize);
+  virtual void SendAsyncScrollDOMEvent(mozilla::layers::FrameMetrics::ViewID aScrollId, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize);
   virtual void PostDelayedTask(Task* aTask, int aDelayMs);
   virtual void HandlePanBegin();
   virtual void HandlePanEnd();
 
   void SetMetroInput(mozilla::widget::winrt::MetroInput* aMetroInput)
   {
     mMetroInput = aMetroInput;
   }
@@ -232,10 +232,10 @@ protected:
   nsCOMPtr<nsIdleService> mIdleService;
   HWND mWnd;
   WNDPROC mMetroWndProc;
   bool mTempBasicLayerInUse;
   Microsoft::WRL::ComPtr<mozilla::widget::winrt::MetroInput> mMetroInput;
   mozilla::layers::FrameMetrics mFrameMetrics;
 
 public:
-  static nsRefPtr<mozilla::layers::AsyncPanZoomController> sAPZC;
+  static nsRefPtr<mozilla::layers::APZCTreeManager> sAPZC;
 };