mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 610727 - Mark canvas layers inactive when relevant. r=roc a=blocking-fennec
This commit is contained in:
parent
157649ca39
commit
eb6d3ef5f2
@ -622,6 +622,7 @@ WebGLContext::GetCanvasLayer(CanvasLayer *aOldLayer,
|
||||
if (mInvalidated) {
|
||||
aOldLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
|
||||
mInvalidated = PR_FALSE;
|
||||
HTMLCanvasElement()->GetPrimaryCanvasFrame()->MarkLayersActive();
|
||||
}
|
||||
return aOldLayer;
|
||||
}
|
||||
|
@ -4066,6 +4066,7 @@ nsCanvasRenderingContext2D::GetCanvasLayer(CanvasLayer *aOldLayer,
|
||||
// of the rectangle based on Redraw args.
|
||||
aOldLayer->Updated(nsIntRect(0, 0, mWidth, mHeight));
|
||||
MarkContextClean();
|
||||
HTMLCanvasElement()->GetPrimaryCanvasFrame()->MarkLayersActive();
|
||||
}
|
||||
|
||||
return aOldLayer;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -474,6 +474,11 @@ public:
|
||||
static bool IsLogEnabled();
|
||||
static PRLogModuleInfo* GetLog() { return sLog; }
|
||||
|
||||
PRBool IsCompositingCheap(LayerManager::LayersBackend aBackend)
|
||||
{ return LAYERS_BASIC != aBackend; }
|
||||
|
||||
virtual PRBool IsCompositingCheap() { return PR_TRUE; }
|
||||
|
||||
protected:
|
||||
nsRefPtr<Layer> mRoot;
|
||||
LayerUserDataSet mUserData;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -2778,6 +2778,14 @@ BasicShadowLayerManager::Hold(Layer* aLayer)
|
||||
mKeepAlive.AppendElement(aLayer);
|
||||
return shadowable;
|
||||
}
|
||||
|
||||
PRBool
|
||||
BasicShadowLayerManager::IsCompositingCheap()
|
||||
{
|
||||
// Whether compositing is cheap depends on the parent backend.
|
||||
return mShadowManager &&
|
||||
LayerManager::IsCompositingCheap(GetParentBackendType());
|
||||
}
|
||||
#endif // MOZ_IPC
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
@ -184,6 +184,8 @@ public:
|
||||
|
||||
void SetTransactionIncomplete() { mTransactionIncomplete = true; }
|
||||
|
||||
virtual PRBool IsCompositingCheap() { return PR_FALSE; }
|
||||
|
||||
protected:
|
||||
#ifdef DEBUG
|
||||
enum TransactionPhase {
|
||||
@ -269,6 +271,8 @@ public:
|
||||
mShadowManager = aShadowManager;
|
||||
}
|
||||
|
||||
virtual PRBool IsCompositingCheap();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Forward transaction results to the parent context.
|
||||
|
@ -105,9 +105,11 @@ public:
|
||||
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager)
|
||||
{
|
||||
// XXX we should have some kind of activity timeout here so that
|
||||
// inactive canvases can be composited into the background
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
// If compositing is cheap, just do that
|
||||
if (aManager->IsCompositingCheap())
|
||||
return mozilla::LAYER_ACTIVE;
|
||||
|
||||
return mFrame->AreLayersMarkedActive() ? LAYER_ACTIVE : LAYER_INACTIVE;
|
||||
}
|
||||
};
|
||||
|
||||
@ -120,6 +122,21 @@ NS_NewHTMLCanvasFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
|
||||
NS_IMPL_FRAMEARENA_HELPERS(nsHTMLCanvasFrame)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLCanvasFrame::Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsSplittableFrame::Init(aContent, aParent, aPrevInFlow);
|
||||
|
||||
// We can fill in the canvas before the canvas frame is created, in
|
||||
// which case we never get around to marking the layer active. Therefore,
|
||||
// we mark it active here when we create the frame.
|
||||
MarkLayersActive();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsHTMLCanvasFrame::~nsHTMLCanvasFrame()
|
||||
{
|
||||
}
|
||||
|
@ -62,6 +62,10 @@ public:
|
||||
|
||||
nsHTMLCanvasFrame(nsStyleContext* aContext) : nsSplittableFrame(aContext) {}
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
nsIFrame* aPrevInFlow);
|
||||
|
||||
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsDisplayListSet& aLists);
|
||||
|
Loading…
Reference in New Issue
Block a user