Bug 949404 - Applications are half repainted once the keyboard is closed. r=Cwiiis

This commit is contained in:
Vivien Nicolas 2013-12-13 18:23:47 +01:00
parent 0cb9eba572
commit de215e0940
3 changed files with 27 additions and 20 deletions

View File

@ -113,6 +113,30 @@ public:
return mCumulativeResolution / mResolution;
}
// Ensure the scrollableRect is at least as big as the compositionBounds
// because the scrollableRect can be smaller if the content is not large
// and the scrollableRect hasn't been updated yet.
// We move the scrollableRect up because we don't know if we can move it
// down. i.e. we know that scrollableRect can go back as far as zero.
// but we don't know how much further ahead it can go.
CSSRect GetExpandedScrollableRect() const
{
CSSRect scrollableRect = mScrollableRect;
if (scrollableRect.width < mCompositionBounds.width) {
scrollableRect.x = std::max(0.f,
scrollableRect.x - (mCompositionBounds.width - scrollableRect.width));
scrollableRect.width = mCompositionBounds.width;
}
if (scrollableRect.height < mCompositionBounds.height) {
scrollableRect.y = std::max(0.f,
scrollableRect.y - (mCompositionBounds.height - scrollableRect.height));
scrollableRect.height = mCompositionBounds.height;
}
return scrollableRect;
}
/**
* Return the scale factor needed to fit the viewport
* into its composition bounds.

View File

@ -1165,25 +1165,8 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
aEstimatedPaintDuration > EPSILON ? aEstimatedPaintDuration : 1.0;
CSSIntRect compositionBounds = gfx::RoundedIn(aFrameMetrics.mCompositionBounds / aFrameMetrics.mZoom);
CSSRect scrollableRect = aFrameMetrics.mScrollableRect;
// Ensure the scrollableRect is at least as big as the compositionBounds
// because the scrollableRect can be smaller if the content is not large
// and the scrollableRect hasn't been updated yet.
// We move the scrollableRect up because we don't know if we can move it
// down. i.e. we know that scrollableRect can go back as far as zero.
// but we don't know how much further ahead it can go.
if (scrollableRect.width < compositionBounds.width) {
scrollableRect.x = std::max(0.f,
scrollableRect.x - (compositionBounds.width - scrollableRect.width));
scrollableRect.width = compositionBounds.width;
}
if (scrollableRect.height < compositionBounds.height) {
scrollableRect.y = std::max(0.f,
scrollableRect.y - (compositionBounds.height - scrollableRect.height));
scrollableRect.height = compositionBounds.height;
}
CSSRect scrollableRect = aFrameMetrics.GetExpandedScrollableRect();
CSSPoint scrollOffset = aFrameMetrics.mScrollOffset;
CSSRect displayPort = CSSRect(compositionBounds);

View File

@ -78,8 +78,8 @@ MaybeAlignAndClampDisplayPort(mozilla::layers::FrameMetrics& aFrameMetrics,
- aActualScrollOffset;
}
// Finally, clamp the display port to the scrollable rect.
CSSRect scrollableRect = aFrameMetrics.mScrollableRect;
// Finally, clamp the display port to the expanded scrollable rect.
CSSRect scrollableRect = aFrameMetrics.GetExpandedScrollableRect();
displayPort = scrollableRect.Intersect(displayPort + aActualScrollOffset)
- aActualScrollOffset;
}