зеркало из https://github.com/mozilla/gecko-dev.git
Bug 634844. Part 2: Don't create a new Image in BuildLayer if we already have one. r=cjones,a=blocking
This commit is contained in:
Родитель
4caa37d41c
Коммит
ad37d8bbc9
|
@ -1608,8 +1608,6 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists)
|
const nsDisplayListSet& aLists)
|
||||||
{
|
{
|
||||||
AddStateBits(NS_OBJECT_NEEDS_SET_IMAGE);
|
|
||||||
|
|
||||||
// XXX why are we painting collapsed object frames?
|
// XXX why are we painting collapsed object frames?
|
||||||
if (!IsVisibleOrCollapsedForPainting(aBuilder))
|
if (!IsVisibleOrCollapsedForPainting(aBuilder))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -1900,10 +1898,13 @@ nsObjectFrame::GetImageContainer(LayerManager* aManager)
|
||||||
|
|
||||||
// XXX - in the future image containers will be manager independent and
|
// XXX - in the future image containers will be manager independent and
|
||||||
// we can remove the manager equals check and only check the backend type.
|
// we can remove the manager equals check and only check the backend type.
|
||||||
if (mImageContainer &&
|
if (mImageContainer) {
|
||||||
(!mImageContainer->Manager() || mImageContainer->Manager() == manager) &&
|
if ((!mImageContainer->Manager() || mImageContainer->Manager() == manager) &&
|
||||||
mImageContainer->GetBackendType() == manager->GetBackendType()) {
|
mImageContainer->GetBackendType() == manager->GetBackendType())
|
||||||
return mImageContainer;
|
return mImageContainer;
|
||||||
|
// Clear current image before we reset mImageContainer. Only mImageContainer
|
||||||
|
// is allowed to contain the image for this plugin.
|
||||||
|
mImageContainer->SetCurrentImage(nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
mImageContainer = manager->CreateImageContainer();
|
mImageContainer = manager->CreateImageContainer();
|
||||||
|
@ -2084,12 +2085,17 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
|
||||||
nsRefPtr<ImageContainer> container = GetImageContainer(aManager);
|
nsRefPtr<ImageContainer> container = GetImageContainer(aManager);
|
||||||
if (!container)
|
if (!container)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
if (GetStateBits() & NS_OBJECT_NEEDS_SET_IMAGE) {
|
|
||||||
RemoveStateBits(NS_OBJECT_NEEDS_SET_IMAGE);
|
{
|
||||||
if (!mInstanceOwner->SetCurrentImage(container)) {
|
nsRefPtr<Image> current = container->GetCurrentImage();
|
||||||
return nsnull;
|
if (!current) {
|
||||||
|
// Only set the current image if there isn't already one. If there is
|
||||||
|
// already one, InvalidateRect() will be keeping it up to date.
|
||||||
|
if (!mInstanceOwner->SetCurrentImage(container))
|
||||||
|
return nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxIntSize size = container->GetCurrentSize();
|
gfxIntSize size = container->GetCurrentSize();
|
||||||
|
|
||||||
nsRect area = GetContentRect() + aBuilder->ToReferenceFrame(GetParent());
|
nsRect area = GetContentRect() + aBuilder->ToReferenceFrame(GetParent());
|
||||||
|
|
|
@ -67,8 +67,6 @@ class PluginBackgroundSink;
|
||||||
|
|
||||||
#define nsObjectFrameSuper nsFrame
|
#define nsObjectFrameSuper nsFrame
|
||||||
|
|
||||||
#define NS_OBJECT_NEEDS_SET_IMAGE NS_FRAME_STATE_BIT(31)
|
|
||||||
|
|
||||||
class nsObjectFrame : public nsObjectFrameSuper,
|
class nsObjectFrame : public nsObjectFrameSuper,
|
||||||
public nsIObjectFrame,
|
public nsIObjectFrame,
|
||||||
public nsIReflowCallback {
|
public nsIReflowCallback {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче