зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359868 - Move the ComputePartialPrerenderArea() helper to nsLayoutUtils so it can be reused. r=mstange
MozReview-Commit-ID: GVRBUfYwOFP --HG-- extra : rebase_source : 8e16daf7709cc107f21e3b8b0050df44e83089fb
This commit is contained in:
Родитель
94d0f5f35f
Коммит
979e3ee035
|
@ -9190,6 +9190,22 @@ nsLayoutUtils::GetCumulativeApzCallbackTransform(nsIFrame* aFrame)
|
|||
return delta;
|
||||
}
|
||||
|
||||
/* static */ nsRect
|
||||
nsLayoutUtils::ComputePartialPrerenderArea(const nsRect& aDirtyRect,
|
||||
const nsRect& aOverflow,
|
||||
const nsSize& aPrerenderSize)
|
||||
{
|
||||
// Simple calculation for now: center the pre-render area on the dirty rect,
|
||||
// and clamp to the overflow area. Later we can do more advanced things like
|
||||
// redistributing from one axis to another, or from one side to another.
|
||||
nscoord xExcess = aPrerenderSize.width - aDirtyRect.width;
|
||||
nscoord yExcess = aPrerenderSize.height - aDirtyRect.height;
|
||||
nsRect result = aDirtyRect;
|
||||
result.Inflate(xExcess / 2, yExcess / 2);
|
||||
return result.MoveInsideAndClamp(aOverflow);
|
||||
}
|
||||
|
||||
|
||||
/* static */ bool
|
||||
nsLayoutUtils::SupportsServoStyleBackend(nsIDocument* aDocument)
|
||||
{
|
||||
|
|
|
@ -2875,6 +2875,19 @@ public:
|
|||
*/
|
||||
static CSSPoint GetCumulativeApzCallbackTransform(nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Compute a rect to pre-render in cases where we want to render more of
|
||||
* something than what is visible (usually to support async transformation).
|
||||
* @param aDirtyRect the area that's visible
|
||||
* @param aOverflow the total size of the thing we're rendering
|
||||
* @param aPrerenderSize how large of an area we're willing to render
|
||||
* @return A rectangle that includes |aDirtyRect|, is clamped to |aOverflow|,
|
||||
* and is no larger than |aPrerenderSize|.
|
||||
*/
|
||||
static nsRect ComputePartialPrerenderArea(const nsRect& aDirtyRect,
|
||||
const nsRect& aOverflow,
|
||||
const nsSize& aPrerenderSize);
|
||||
|
||||
/*
|
||||
* Returns whether the given document supports being rendered with a
|
||||
* Servo-backed style system. This checks whether Stylo is enabled
|
||||
|
|
|
@ -7184,20 +7184,7 @@ bool
|
|||
nsDisplayTransform::CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder)
|
||||
{
|
||||
return mAllowAsyncAnimation;
|
||||
}
|
||||
|
||||
static nsRect ComputePartialPrerenderArea(const nsRect& aDirtyRect,
|
||||
const nsRect& aOverflow,
|
||||
const nsSize& aPrerenderSize)
|
||||
{
|
||||
// Simple calculation for now: center the pre-render area on the dirty rect,
|
||||
// and clamp to the overflow area. Later we can do more advanced things like
|
||||
// redistributing from one axis to another, or from one side to another.
|
||||
nscoord xExcess = aPrerenderSize.width - aDirtyRect.width;
|
||||
nscoord yExcess = aPrerenderSize.height - aDirtyRect.height;
|
||||
nsRect result = aDirtyRect;
|
||||
result.Inflate(xExcess / 2, yExcess / 2);
|
||||
return result.MoveInsideAndClamp(aOverflow);
|
||||
}
|
||||
|
||||
/* static */ auto
|
||||
|
@ -7247,7 +7234,7 @@ nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBui
|
|||
*aDirtyRect = overflow;
|
||||
return FullPrerender;
|
||||
} else if (gfxPrefs::PartiallyPrerenderAnimatedContent()) {
|
||||
*aDirtyRect = ComputePartialPrerenderArea(*aDirtyRect, overflow, maxSize);
|
||||
*aDirtyRect = nsLayoutUtils::ComputePartialPrerenderArea(*aDirtyRect, overflow, maxSize);
|
||||
return PartialPrerender;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче