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

--HG--
extra : commitid : ptd0dqCx1S
extra : rebase_source : fd3e1c04e7c21362c7496d32139ff9f30c2b2d5c
This commit is contained in:
Benoit Girard 2015-08-27 14:21:58 -04:00
Родитель 6cf9ba3a66
Коммит 411ab85eaa
1 изменённых файлов: 12 добавлений и 1 удалений

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

@ -920,6 +920,12 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
ScreenRect screenRect = LayoutDeviceRect::FromAppUnits(base, auPerDevPixel)
* parentRes;
nsRect expandedScrollableRect =
nsLayoutUtils::CalculateExpandedScrollableRect(frame);
ScreenRect screenExpScrollableRect =
LayoutDeviceRect::FromAppUnits(expandedScrollableRect - scrollPos,
auPerDevPixel) * parentRes;
if (gfxPrefs::LayersTilesEnabled()) {
// Note on the correctness of applying the alignment in Screen space:
// The correct space to apply the alignment in would be Layer space, but
@ -943,6 +949,9 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
// up to tile boundaries.
screenRect.Inflate(1);
// Make sure the displayport remains within the scrollable rect.
screenRect = screenRect.ForceInside(screenExpScrollableRect);
// Avoid division by zero.
if (alignmentX == 0) {
alignmentX = 1;
@ -992,6 +1001,9 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
screenRect.x -= left;
screenRect.width += left + right;
}
// Make sure the displayport remains within the scrollable rect.
screenRect = screenRect.ForceInside(screenExpScrollableRect);
}
// Convert the aligned rect back into app units.
@ -1001,7 +1013,6 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
result = ApplyRectMultiplier(result, aMultiplier);
// Finally, clamp it to the expanded scrollable rect.
nsRect expandedScrollableRect = nsLayoutUtils::CalculateExpandedScrollableRect(frame);
result = expandedScrollableRect.Intersect(result + scrollPos) - scrollPos;
return result;