Bug 1321412 - Allow ShouldPrerenderTransformedContent() to override the dirty rect. r=mattwoodrow

MozReview-Commit-ID: 5EpiANOynwP

--HG--
extra : rebase_source : d2bd3668bbe12b3853327f2c41e6a77acf1bbadd
This commit is contained in:
Botond Ballo 2016-11-23 16:50:47 -05:00
Родитель 52f894c5d8
Коммит cf9ed711ca
3 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -2209,10 +2209,9 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
if (isTransformed) {
const nsRect overflow = GetVisualOverflowRectRelativeToSelf();
nsDisplayTransform::PrerenderDecision decision =
nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder, this);
nsDisplayTransform::ShouldPrerenderTransformedContent(aBuilder, this, &dirtyRect);
switch (decision) {
case nsDisplayTransform::FullPrerender:
dirtyRect = overflow;
allowAsyncAnimation = true;
break;
case nsDisplayTransform::NoPrerender:

Просмотреть файл

@ -6228,7 +6228,8 @@ nsDisplayTransform::CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder)
/* static */ auto
nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame) -> PrerenderDecision
nsIFrame* aFrame,
nsRect* aDirtyRect) -> PrerenderDecision
{
// Elements whose transform has been modified recently, or which
// have a compositor-animated transform, can be prerendered. An element
@ -6251,13 +6252,14 @@ nsDisplayTransform::ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBui
// for shadows, borders, etc.
refSize += nsSize(refSize.width / 8, refSize.height / 8);
gfxSize scale = nsLayoutUtils::GetTransformToAncestorScale(aFrame);
nsSize frameSize = nsSize(
aFrame->GetVisualOverflowRectRelativeToSelf().Size().width * scale.width,
aFrame->GetVisualOverflowRectRelativeToSelf().Size().height * scale.height);
nsRect overflow = aFrame->GetVisualOverflowRectRelativeToSelf();
nsSize frameSize = nsSize(overflow.Size().width * scale.width,
overflow.Size().height * scale.height);
nscoord maxInAppUnits = nscoord_MAX;
if (frameSize <= refSize) {
maxInAppUnits = aFrame->PresContext()->DevPixelsToAppUnits(4096);
if (frameSize <= nsSize(maxInAppUnits, maxInAppUnits)) {
*aDirtyRect = overflow;
return FullPrerender;
}
}

Просмотреть файл

@ -4283,9 +4283,11 @@ public:
/**
* Return FullPrerender when we should try to prerender the entire contents of the
* transformed frame even when it's not completely visible (yet).
* |aDirtyRect| is updated to the area that should be prerendered.
*/
static PrerenderDecision ShouldPrerenderTransformedContent(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame);
nsIFrame* aFrame,
nsRect* aDirtyRect);
bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) override;
bool MayBeAnimated(nsDisplayListBuilder* aBuilder);