зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265256 - Use the canvas positioning area when computing the background-attachment:fixed rect for canvas frames. r=mstange
This commit is contained in:
Родитель
37ad6cbc0c
Коммит
083b9cd7fc
|
@ -2586,30 +2586,6 @@ nsDisplayBackgroundImage::ComputeShouldTreatAsFixed(bool isTransformedFixed) con
|
|||
return !isTransformedFixed;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aClipRect,
|
||||
gfxRect* aDestRect)
|
||||
{
|
||||
if (!mBackgroundStyle)
|
||||
return false;
|
||||
|
||||
if (mBackgroundStyle->mImage.mLayers.Length() != 1)
|
||||
return false;
|
||||
|
||||
if (!ShouldTreatAsFixed())
|
||||
return false;
|
||||
|
||||
// We only care about images here, not gradients.
|
||||
if (!mIsRasterImage)
|
||||
return false;
|
||||
|
||||
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
*aDestRect = nsLayoutUtils::RectToGfxRect(mFillRect, appUnitsPerDevPixel);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayBackgroundImage::IsNonEmptyFixedImage() const
|
||||
{
|
||||
|
|
|
@ -2736,9 +2736,6 @@ protected:
|
|||
typedef class mozilla::layers::ImageLayer ImageLayer;
|
||||
|
||||
bool TryOptimizeToImageLayer(LayerManager* aManager, nsDisplayListBuilder* aBuilder);
|
||||
bool IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aClipRect,
|
||||
gfxRect* aDestRect);
|
||||
bool IsNonEmptyFixedImage() const;
|
||||
nsRect GetBoundsInternal(nsDisplayListBuilder* aBuilder);
|
||||
bool ShouldTreatAsFixed() const;
|
||||
|
|
|
@ -326,6 +326,42 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder,
|
|||
PaintInternal(aBuilder, aCtx, mVisibleRect, &bgClipRect);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDisplayCanvasBackgroundImage::IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aClipRect,
|
||||
gfxRect* aDestRect)
|
||||
{
|
||||
if (!mBackgroundStyle)
|
||||
return false;
|
||||
|
||||
if (mBackgroundStyle->mImage.mLayers.Length() != 1)
|
||||
return false;
|
||||
|
||||
|
||||
nsPresContext* presContext = mFrame->PresContext();
|
||||
uint32_t flags = aBuilder->GetBackgroundPaintFlags();
|
||||
nsRect borderArea = nsRect(ToReferenceFrame(), mFrame->GetSize());
|
||||
const nsStyleImageLayers::Layer &layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
|
||||
if (layer.mAttachment != NS_STYLE_IMAGELAYER_ATTACHMENT_FIXED)
|
||||
return false;
|
||||
|
||||
nsBackgroundLayerState state =
|
||||
nsCSSRendering::PrepareImageLayer(presContext, mFrame, flags,
|
||||
borderArea, aClipRect, layer);
|
||||
|
||||
|
||||
// We only care about images here, not gradients.
|
||||
if (!mIsRasterImage)
|
||||
return false;
|
||||
|
||||
int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
||||
*aDestRect = nsLayoutUtils::RectToGfxRect(state.mFillArea, appUnitsPerDevPixel);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsDisplayCanvasThemedBackground::Paint(nsDisplayListBuilder* aBuilder,
|
||||
nsRenderingContext* aCtx)
|
||||
|
|
|
@ -227,6 +227,10 @@ public:
|
|||
// We still need to paint a background color as well as an image for this item,
|
||||
// so we can't support this yet.
|
||||
virtual bool SupportsOptimizingToImage() override { return false; }
|
||||
|
||||
bool IsSingleFixedPositionImage(nsDisplayListBuilder* aBuilder,
|
||||
const nsRect& aClipRect,
|
||||
gfxRect* aDestRect);
|
||||
|
||||
|
||||
NS_DISPLAY_DECL_NAME("CanvasBackgroundImage", TYPE_CANVAS_BACKGROUND_IMAGE)
|
||||
|
|
Загрузка…
Ссылка в новой задаче