зеркало из https://github.com/mozilla/gecko-dev.git
Bug 852754 - Part 2: Share the implementation of GetContainer. r=mstange
This commit is contained in:
Родитель
46ff4c4fc7
Коммит
7dc61d9b46
|
@ -2642,30 +2642,6 @@ nsDisplayBackgroundImage::GetImage()
|
|||
return image.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
nsDisplayBackgroundImage::GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder *aBuilder)
|
||||
{
|
||||
if (!mImage) {
|
||||
MOZ_ASSERT_UNREACHABLE("Must call CanOptimizeToImage() and get true "
|
||||
"before calling GetContainer()");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mImageContainer) {
|
||||
// We don't have an ImageContainer yet; get it from mImage.
|
||||
|
||||
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
|
||||
? imgIContainer::FLAG_SYNC_DECODE
|
||||
: imgIContainer::FLAG_NONE;
|
||||
|
||||
mImageContainer = mImage->GetImageContainer(aManager, flags);
|
||||
}
|
||||
|
||||
RefPtr<ImageContainer> container = mImageContainer;
|
||||
return container.forget();
|
||||
}
|
||||
|
||||
nsDisplayBackgroundImage::ImageLayerization
|
||||
nsDisplayBackgroundImage::ShouldCreateOwnLayer(nsDisplayListBuilder* aBuilder,
|
||||
LayerManager* aManager)
|
||||
|
@ -3232,6 +3208,24 @@ nsDisplayThemedBackground::GetBoundsInternal() {
|
|||
return r + ToReferenceFrame();
|
||||
}
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
nsDisplayImageContainer::GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder *aBuilder)
|
||||
{
|
||||
nsCOMPtr<imgIContainer> image = GetImage();
|
||||
if (!image) {
|
||||
MOZ_ASSERT_UNREACHABLE("Must call CanOptimizeToImage() and get true "
|
||||
"before calling GetContainer()");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
|
||||
? imgIContainer::FLAG_SYNC_DECODE
|
||||
: imgIContainer::FLAG_NONE;
|
||||
|
||||
return image->GetImageContainer(aManager, flags);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayImageContainer::CanOptimizeToImageLayer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
|
|
|
@ -2325,8 +2325,8 @@ public:
|
|||
virtual bool CanOptimizeToImageLayer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder);
|
||||
|
||||
virtual already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder) = 0;
|
||||
already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder);
|
||||
virtual void ConfigureLayer(ImageLayer* aLayer,
|
||||
const ContainerLayerParameters& aParameters) = 0;
|
||||
|
||||
|
@ -2724,8 +2724,6 @@ public:
|
|||
nsDisplayListBuilder* aBuilder) override;
|
||||
virtual already_AddRefed<imgIContainer> GetImage() override;
|
||||
virtual nsRect GetDestRect() override;
|
||||
virtual already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder *aBuilder) override;
|
||||
virtual void ConfigureLayer(ImageLayer* aLayer,
|
||||
const ContainerLayerParameters& aParameters) override;
|
||||
|
||||
|
@ -2762,7 +2760,6 @@ protected:
|
|||
// mIsThemed is true or if FindBackground returned false.
|
||||
const nsStyleBackground* mBackgroundStyle;
|
||||
nsCOMPtr<imgIContainer> mImage;
|
||||
RefPtr<ImageContainer> mImageContainer;
|
||||
nsRect mFillRect;
|
||||
nsRect mDestRect;
|
||||
/* Bounds of this display item */
|
||||
|
|
|
@ -1524,17 +1524,6 @@ nsDisplayImage::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
|
|||
nsDisplayImageContainer::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
|
||||
}
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
nsDisplayImage::GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
|
||||
? imgIContainer::FLAG_SYNC_DECODE
|
||||
: imgIContainer::FLAG_NONE;
|
||||
|
||||
return mImage->GetImageContainer(aManager, flags);
|
||||
}
|
||||
|
||||
already_AddRefed<imgIContainer>
|
||||
nsDisplayImage::GetImage()
|
||||
{
|
||||
|
|
|
@ -430,13 +430,6 @@ public:
|
|||
|
||||
virtual already_AddRefed<imgIContainer> GetImage() override;
|
||||
|
||||
/**
|
||||
* Returns an ImageContainer for this image if the image type
|
||||
* supports it (TYPE_RASTER only).
|
||||
*/
|
||||
virtual already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder) override;
|
||||
|
||||
/**
|
||||
* @return The dest rect we'll use when drawing this image, in app units.
|
||||
* Not necessarily contained in this item's bounds.
|
||||
|
|
|
@ -539,22 +539,6 @@ nsImageBoxFrame::CanOptimizeToImageLayer()
|
|||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<ImageContainer>
|
||||
nsDisplayXULImage::GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
uint32_t flags = aBuilder->ShouldSyncDecodeImages()
|
||||
? imgIContainer::FLAG_SYNC_DECODE
|
||||
: imgIContainer::FLAG_NONE;
|
||||
|
||||
nsCOMPtr<imgIContainer> image = GetImage();
|
||||
if (image) {
|
||||
return image->GetImageContainer(aManager, flags);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// DidSetStyleContext
|
||||
//
|
||||
|
|
|
@ -142,8 +142,6 @@ public:
|
|||
|
||||
virtual bool CanOptimizeToImageLayer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder) override;
|
||||
virtual already_AddRefed<ImageContainer> GetContainer(LayerManager* aManager,
|
||||
nsDisplayListBuilder* aBuilder) override;
|
||||
virtual already_AddRefed<imgIContainer> GetImage() override;
|
||||
virtual nsRect GetDestRect() override;
|
||||
virtual void ConfigureLayer(ImageLayer* aLayer,
|
||||
|
|
Загрузка…
Ссылка в новой задаче