mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Move APZC initialization into nsBaseWidget. (bug 1110540 part 1, r=kats)
This commit is contained in:
parent
4e481f25ad
commit
104a98a38b
@ -473,7 +473,6 @@ public:
|
||||
already_AddRefed<mozilla::a11y::Accessible> GetDocumentAccessible();
|
||||
#endif
|
||||
|
||||
virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
|
||||
virtual void CreateCompositor();
|
||||
virtual void PrepareWindowEffects() MOZ_OVERRIDE;
|
||||
virtual void CleanupWindowEffects() MOZ_OVERRIDE;
|
||||
@ -528,7 +527,7 @@ public:
|
||||
void EndRemoteDrawing() MOZ_OVERRIDE;
|
||||
void CleanupRemoteDrawing() MOZ_OVERRIDE;
|
||||
|
||||
APZCTreeManager* APZCTM() { return mAPZCTreeManager; }
|
||||
APZCTreeManager* APZCTM() { return mAPZC ; }
|
||||
|
||||
protected:
|
||||
virtual ~nsChildView();
|
||||
@ -549,6 +548,9 @@ protected:
|
||||
return widget.forget();
|
||||
}
|
||||
|
||||
void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
|
||||
already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
|
||||
|
||||
void DoRemoteComposition(const nsIntRect& aRenderRect);
|
||||
|
||||
// Overlay drawing functions for OpenGL drawing
|
||||
@ -629,8 +631,6 @@ protected:
|
||||
// surface to the screen using an OpenGL context.
|
||||
nsAutoPtr<GLPresenter> mGLPresenter;
|
||||
|
||||
nsRefPtr<APZCTreeManager> mAPZCTreeManager;
|
||||
|
||||
mozilla::UniquePtr<mozilla::VibrancyManager> mVibrancyManager;
|
||||
|
||||
static uint32_t sLastInputEventCount;
|
||||
|
@ -475,7 +475,7 @@ nsChildView::~nsChildView()
|
||||
|
||||
DestroyCompositor();
|
||||
|
||||
if (mAPZCTreeManager) {
|
||||
if (mAPZC) {
|
||||
gNumberOfWidgetsNeedingEventThread--;
|
||||
if (gNumberOfWidgetsNeedingEventThread == 0) {
|
||||
[EventThreadRunner stop];
|
||||
@ -1884,25 +1884,22 @@ nsChildView::CreateCompositor()
|
||||
}
|
||||
}
|
||||
|
||||
CompositorParent*
|
||||
nsChildView::NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight)
|
||||
already_AddRefed<GeckoContentController>
|
||||
nsChildView::CreateRootContentController()
|
||||
{
|
||||
CompositorParent *compositor = nsBaseWidget::NewCompositorParent(aSurfaceWidth, aSurfaceHeight);
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
uint64_t rootLayerTreeId = compositor->RootLayerTreeId();
|
||||
nsRefPtr<APZCTMController> controller = new APZCTMController();
|
||||
CompositorParent::SetControllerForLayerTree(rootLayerTreeId, controller);
|
||||
mAPZCTreeManager = CompositorParent::GetAPZCTreeManager(rootLayerTreeId);
|
||||
mAPZCTreeManager->SetDPI(GetDPI());
|
||||
return controller.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsChildView::ConfigureAPZCTreeManager()
|
||||
{
|
||||
nsBaseWidget::ConfigureAPZCTreeManager();
|
||||
|
||||
if (gNumberOfWidgetsNeedingEventThread == 0) {
|
||||
[EventThreadRunner start];
|
||||
}
|
||||
gNumberOfWidgetsNeedingEventThread++;
|
||||
}
|
||||
|
||||
return compositor;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
|
@ -610,15 +610,19 @@ nsWindow::GetLayerManager(PLayerTransactionChild* aShadowManager,
|
||||
|
||||
CreateCompositor();
|
||||
if (mCompositorParent) {
|
||||
uint64_t rootLayerTreeId = mCompositorParent->RootLayerTreeId();
|
||||
CompositorParent::SetControllerForLayerTree(rootLayerTreeId, new ParentProcessController());
|
||||
CompositorParent::GetAPZCTreeManager(rootLayerTreeId)->SetDPI(GetDPI());
|
||||
HwcComposer2D::GetInstance()->SetCompositorParent(mCompositorParent);
|
||||
}
|
||||
MOZ_ASSERT(mLayerManager);
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
already_AddRefed<GeckoContentController>
|
||||
nsWindow::CreateRootContentController()
|
||||
{
|
||||
nsRefPtr<ParentProcessController> controller = new ParentProcessController();
|
||||
return controller.forget();
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::BringToTop()
|
||||
{
|
||||
|
@ -120,6 +120,10 @@ public:
|
||||
|
||||
virtual Composer2D* GetComposer2D() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
// nsBaseWidget
|
||||
already_AddRefed<GeckoContentController> CreateRootContentController() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
nsWindow* mParent;
|
||||
bool mVisible;
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "GLConsts.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsAccessibilityService.h"
|
||||
@ -911,6 +912,26 @@ void nsBaseWidget::CreateCompositor()
|
||||
CreateCompositor(rect.width, rect.height);
|
||||
}
|
||||
|
||||
already_AddRefed<GeckoContentController>
|
||||
nsBaseWidget::CreateRootContentController()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void nsBaseWidget::ConfigureAPZCTreeManager()
|
||||
{
|
||||
uint64_t rootLayerTreeId = mCompositorParent->RootLayerTreeId();
|
||||
mAPZC = CompositorParent::GetAPZCTreeManager(rootLayerTreeId);
|
||||
MOZ_ASSERT(mAPZC);
|
||||
|
||||
mAPZC->SetDPI(GetDPI());
|
||||
|
||||
nsRefPtr<GeckoContentController> controller = CreateRootContentController();
|
||||
if (controller) {
|
||||
CompositorParent::SetControllerForLayerTree(rootLayerTreeId, controller);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsBaseWidget::GetPreferredCompositorBackends(nsTArray<LayersBackend>& aHints)
|
||||
{
|
||||
@ -945,6 +966,10 @@ void nsBaseWidget::CreateCompositor(int aWidth, int aHeight)
|
||||
mCompositorChild = new CompositorChild(lm);
|
||||
mCompositorChild->Open(parentChannel, childMessageLoop, ipc::ChildSide);
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
ConfigureAPZCTreeManager();
|
||||
}
|
||||
|
||||
TextureFactoryIdentifier textureFactoryIdentifier;
|
||||
PLayerTransactionChild* shadowManager = nullptr;
|
||||
nsTArray<LayersBackend> backendHints;
|
||||
|
@ -34,6 +34,8 @@ namespace layers {
|
||||
class BasicLayerManager;
|
||||
class CompositorChild;
|
||||
class CompositorParent;
|
||||
class APZCTreeManager;
|
||||
class GeckoContentController;
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,6 +84,8 @@ protected:
|
||||
typedef mozilla::layers::BufferMode BufferMode;
|
||||
typedef mozilla::layers::CompositorChild CompositorChild;
|
||||
typedef mozilla::layers::CompositorParent CompositorParent;
|
||||
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
||||
typedef mozilla::layers::GeckoContentController GeckoContentController;
|
||||
typedef mozilla::ScreenRotation ScreenRotation;
|
||||
|
||||
virtual ~nsBaseWidget();
|
||||
@ -300,6 +304,9 @@ protected:
|
||||
nsDeviceContext *aContext,
|
||||
nsWidgetInitData *aInitData);
|
||||
|
||||
virtual void ConfigureAPZCTreeManager();
|
||||
virtual already_AddRefed<GeckoContentController> CreateRootContentController();
|
||||
|
||||
const nsIntRegion RegionFromArray(const nsTArray<nsIntRect>& aRects);
|
||||
void ArrayFromRegion(const nsIntRegion& aRegion, nsTArray<nsIntRect>& aRects);
|
||||
|
||||
@ -407,6 +414,7 @@ protected:
|
||||
nsRefPtr<LayerManager> mBasicLayerManager;
|
||||
nsRefPtr<CompositorChild> mCompositorChild;
|
||||
nsRefPtr<CompositorParent> mCompositorParent;
|
||||
nsRefPtr<APZCTreeManager> mAPZC;
|
||||
nsRefPtr<WidgetShutdownObserver> mShutdownObserver;
|
||||
nsCursor mCursor;
|
||||
bool mUpdateCursor;
|
||||
|
@ -186,7 +186,7 @@
|
||||
#define SM_CONVERTIBLESLATEMODE 0x2003
|
||||
#endif
|
||||
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -7666,19 +7666,6 @@ void nsWindow::PickerClosed()
|
||||
}
|
||||
}
|
||||
|
||||
CompositorParent* nsWindow::NewCompositorParent(int aSurfaceWidth,
|
||||
int aSurfaceHeight)
|
||||
{
|
||||
CompositorParent *compositor = new CompositorParent(this, false, aSurfaceWidth, aSurfaceHeight);
|
||||
|
||||
if (gfxPrefs::AsyncPanZoomEnabled()) {
|
||||
mAPZC = CompositorParent::GetAPZCTreeManager(compositor->RootLayerTreeId());
|
||||
APZCTreeManager::SetDPI(GetDPI());
|
||||
}
|
||||
|
||||
return compositor;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
**************************************************************
|
||||
**
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "nsUXThemeData.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIIdleServiceInternal.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
|
||||
/**
|
||||
* Forward class definitions
|
||||
@ -74,7 +73,6 @@ class nsWindow : public nsWindowBase
|
||||
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
||||
typedef mozilla::widget::NativeKey NativeKey;
|
||||
typedef mozilla::widget::MSGResult MSGResult;
|
||||
typedef mozilla::layers::APZCTreeManager APZCTreeManager;
|
||||
|
||||
public:
|
||||
nsWindow();
|
||||
@ -91,7 +89,6 @@ public:
|
||||
virtual bool DispatchScrollEvent(mozilla::WidgetGUIEvent* aEvent) MOZ_OVERRIDE;
|
||||
virtual nsWindowBase* GetParentWindowBase(bool aIncludeOwner) MOZ_OVERRIDE;
|
||||
virtual bool IsTopLevelWidget() MOZ_OVERRIDE { return mIsTopWidgetWindow; }
|
||||
virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight) MOZ_OVERRIDE;
|
||||
|
||||
// nsIWidget interface
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
@ -593,8 +590,6 @@ protected:
|
||||
|
||||
static bool sNeedsToInitMouseWheelSettings;
|
||||
static void InitMouseWheelScrollData();
|
||||
|
||||
nsRefPtr<APZCTreeManager> mAPZC;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1032,19 +1032,10 @@ MetroWidget::SetWidgetListener(nsIWidgetListener* aWidgetListener)
|
||||
mWidgetListener = aWidgetListener;
|
||||
}
|
||||
|
||||
CompositorParent* MetroWidget::NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight)
|
||||
void
|
||||
MetroWidget::ConfigureAPZCTreeManager()
|
||||
{
|
||||
CompositorParent *compositor = nsBaseWidget::NewCompositorParent(aSurfaceWidth, aSurfaceHeight);
|
||||
|
||||
if (ShouldUseAPZC()) {
|
||||
mRootLayerTreeId = compositor->RootLayerTreeId();
|
||||
|
||||
mController = new APZController();
|
||||
|
||||
CompositorParent::SetControllerForLayerTree(mRootLayerTreeId, mController);
|
||||
|
||||
APZController::sAPZC = CompositorParent::GetAPZCTreeManager(compositor->RootLayerTreeId());
|
||||
APZController::sAPZC->SetDPI(GetDPI());
|
||||
nsBaseWidget::ConfigureAPZCTreeManager();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIObserverService> observerService = do_GetService("@mozilla.org/observer-service;1", &rv);
|
||||
@ -1053,9 +1044,15 @@ CompositorParent* MetroWidget::NewCompositorParent(int aSurfaceWidth, int aSurfa
|
||||
observerService->AddObserver(this, "apzc-zoom-to-rect", false);
|
||||
observerService->AddObserver(this, "apzc-disable-zoom", false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return compositor;
|
||||
already_AddRefed<GeckoContentController>
|
||||
MetroWidget::CreateRootContentController()
|
||||
{
|
||||
MOZ_ASSERT(!mController);
|
||||
|
||||
mController = new APZController();
|
||||
return mController;
|
||||
}
|
||||
|
||||
MetroWidget::TouchBehaviorFlags
|
||||
|
@ -89,7 +89,6 @@ public:
|
||||
nsIntPoint* aPoint = nullptr) MOZ_OVERRIDE;
|
||||
|
||||
// nsBaseWidget
|
||||
virtual CompositorParent* NewCompositorParent(int aSurfaceWidth, int aSurfaceHeight);
|
||||
virtual void SetWidgetListener(nsIWidgetListener* aWidgetListener);
|
||||
|
||||
// nsIWidget interface
|
||||
@ -246,6 +245,10 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
// nsBaseWidget
|
||||
void ConfigureAPZCTreeManager() MOZ_OVERRIDE;
|
||||
already_AddRefed<GeckoContentController> NewRootContentController() MOZ_OVERRIDE;
|
||||
|
||||
void SetSubclass();
|
||||
void RemoveSubclass();
|
||||
nsIWidgetListener* GetPaintListener();
|
||||
|
Loading…
Reference in New Issue
Block a user