Bug 943846 - Make APZC's generated display port contain the composition bounds. r=kats

A bug in layout means that setting a displayport on an element that doesn't
contain its scroll frame may cause the display item to be optimised away
(bug 936500).
This commit is contained in:
Chris Lord 2013-12-06 13:15:58 +00:00
parent 905395bdd0
commit 36be5576b3

View File

@ -1218,6 +1218,21 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
scrollOffset.y = scrollableRect.y;
}
// FIXME/bug 936500: Make sure the displayport contains the composition
// bounds. This is to work around a layout bug that means if a display item's
// corresponding displayport doesn't contain its frame's bounds, it may get
// optimised out and the layer won't get created.
if (displayPort.x + displayPort.width < compositionBounds.width) {
displayPort.x = -(displayPort.width - compositionBounds.width);
} else if (displayPort.x > 0) {
displayPort.x = 0;
}
if (displayPort.y + displayPort.height < compositionBounds.height) {
displayPort.y = -(displayPort.height - compositionBounds.height);
} else if (displayPort.y > 0) {
displayPort.y = 0;
}
CSSRect shiftedDisplayPort = displayPort + scrollOffset;
return scrollableRect.ClampRect(shiftedDisplayPort) - scrollOffset;
}