Bug 1277814 - For a zero-margin displayport, do not expand the displayport beyond the scroll port even during low-res painting. r=tnikkel
MozReview-Commit-ID: 4ZN8aWkBEwA
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1117,18 +1117,22 @@ GetDisplayPortFromMarginsData(nsIContent
float w = alignment.width * ceil(screenRect.width / alignment.width + 1);
float h = alignment.height * ceil(screenRect.height / alignment.height + 1);
screenRect = ScreenRect(x, y, w, h);
screenRect -= scrollPosScreen;
// Convert the aligned rect back into app units.
nsRect result = LayoutDeviceRect::ToAppUnits(screenRect / res, auPerDevPixel);
- // Expand it for the low-res buffer if needed
- result = ApplyRectMultiplier(result, aMultiplier);
+ // If we have non-zero margins, expand the displayport for the low-res buffer
+ // if that's what we're drawing. If we have zero margins, we want the
+ // displayport to reflect the scrollport.
+ if (aMarginsData->mMargins != ScreenMargin()) {
+ result = ApplyRectMultiplier(result, aMultiplier);
+ }
// Make sure the displayport remains within the scrollable rect.
result = result.MoveInsideAndClamp(expandedScrollableRect - scrollPos);
return result;
}
static bool