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

--HG--
extra : commitid : Ee4ufF6D1Pm
extra : rebase_source : a0eb0d18b98cff49c82dd3e9f59e8461c4f0b3c0
This commit is contained in:
Benoit Girard 2015-09-09 14:41:38 -04:00
Родитель 1f3d931c95
Коммит 282b6c7b96
1 изменённых файлов: 13 добавлений и 3 удалений

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

@ -920,6 +920,9 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
ScreenRect screenRect = LayoutDeviceRect::FromAppUnits(base, auPerDevPixel)
* parentRes;
nsRect expandedScrollableRect =
nsLayoutUtils::CalculateExpandedScrollableRect(frame);
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
@ -955,12 +958,20 @@ GetDisplayPortFromMarginsData(nsIContent* aContent,
* res;
screenRect += scrollPosScreen;
// Round-out the display port to the nearest alignment (tiles)
float x = alignmentX * floor(screenRect.x / alignmentX);
float y = alignmentY * floor(screenRect.y / alignmentY);
float w = alignmentX * ceil(screenRect.XMost() / alignmentX) - x;
float h = alignmentY * ceil(screenRect.YMost() / alignmentY) - y;
float w = alignmentX * ceil(screenRect.width / alignmentX + 1);
float h = alignmentY * ceil(screenRect.height / alignmentY + 1);
screenRect = ScreenRect(x, y, w, h);
screenRect -= scrollPosScreen;
ScreenRect screenExpScrollableRect =
LayoutDeviceRect::FromAppUnits(expandedScrollableRect,
auPerDevPixel) * res;
// Make sure the displayport remains within the scrollable rect.
screenRect = screenRect.ForceInside(screenExpScrollableRect - scrollPosScreen);
} else {
nscoord maxSizeInAppUnits = GetMaxDisplayPortSize(aContent);
if (maxSizeInAppUnits == nscoord_MAX) {
@ -1001,7 +1012,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;