Bug 1191539 - DisplayPort should ForceInside frameRect to match compositor DisplayPort. r=kats

This commit is contained in:
Benoit Girard
2015-09-09 14:41:38 -04:00
parent 3a5297b959
commit 6bcbbfa24e

View File

@@ -920,6 +920,9 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
ScreenRect screenRect = LayoutDeviceRect::FromAppUnits(base, auPerDevPixel) ScreenRect screenRect = LayoutDeviceRect::FromAppUnits(base, auPerDevPixel)
* parentRes; * parentRes;
nsRect expandedScrollableRect =
nsLayoutUtils::CalculateExpandedScrollableRect(frame);
if (gfxPrefs::LayersTilesEnabled()) { if (gfxPrefs::LayersTilesEnabled()) {
// Note on the correctness of applying the alignment in Screen space: // Note on the correctness of applying the alignment in Screen space:
// The correct space to apply the alignment in would be Layer space, but // The correct space to apply the alignment in would be Layer space, but
@@ -955,12 +958,20 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
* res; * res;
screenRect += scrollPosScreen; screenRect += scrollPosScreen;
// Round-out the display port to the nearest alignment (tiles)
float x = alignmentX * floor(screenRect.x / alignmentX); float x = alignmentX * floor(screenRect.x / alignmentX);
float y = alignmentY * floor(screenRect.y / alignmentY); float y = alignmentY * floor(screenRect.y / alignmentY);
float w = alignmentX * ceil(screenRect.XMost() / alignmentX) - x; float w = alignmentX * ceil(screenRect.width / alignmentX + 1);
float h = alignmentY * ceil(screenRect.YMost() / alignmentY) - y; float h = alignmentY * ceil(screenRect.height / alignmentY + 1);
screenRect = ScreenRect(x, y, w, h); screenRect = ScreenRect(x, y, w, h);
screenRect -= scrollPosScreen; screenRect -= scrollPosScreen;
ScreenRect screenExpScrollableRect =
LayoutDeviceRect::FromAppUnits(expandedScrollableRect,
auPerDevPixel) * res;
// Make sure the displayport remains within the scrollable rect.
screenRect = screenRect.ForceInside(screenExpScrollableRect - scrollPosScreen);
} else { } else {
nscoord maxSizeInAppUnits = GetMaxDisplayPortSize(aContent); nscoord maxSizeInAppUnits = GetMaxDisplayPortSize(aContent);
if (maxSizeInAppUnits == nscoord_MAX) { if (maxSizeInAppUnits == nscoord_MAX) {
@@ -1001,7 +1012,6 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
result = ApplyRectMultiplier(result, aMultiplier); result = ApplyRectMultiplier(result, aMultiplier);
// Finally, clamp it to the expanded scrollable rect. // Finally, clamp it to the expanded scrollable rect.
nsRect expandedScrollableRect = nsLayoutUtils::CalculateExpandedScrollableRect(frame);
result = expandedScrollableRect.Intersect(result + scrollPos) - scrollPos; result = expandedScrollableRect.Intersect(result + scrollPos) - scrollPos;
return result; return result;