Bug 1247098 - Take document resolution into account when computing root composition bounds for displayport base; r?tnikkel
nsLayoutUtils::CalculateCompositionSizeForFrame() is not affected by the
document resolution when called for the root content document's root
scroll frame. When determining the root composition bounds in order to
calculate a displayport base, if the frame used is the RCD-RSF we must
be sure to scale the bounds ourselves by the document resolution.
MozReview-Commit-ID: ATctmEYvWIJ
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3383,16 +3383,23 @@ ScrollFrameHelper::DecideScrollableLayer
nsIFrame* rootFrame = rootPresShell->GetRootScrollFrame();
if (!rootFrame) {
rootFrame = rootPresShell->GetRootFrame();
}
if (rootFrame) {
nsRect rootCompBounds =
nsRect(nsPoint(0, 0), nsLayoutUtils::CalculateCompositionSizeForFrame(rootFrame));
+ // If rootFrame is the RCD-RSF then CalculateCompositionSizeForFrame
+ // did not take the document's resolution into account, so we must.
+ if (rootPresContext->IsRootContentDocument() &&
+ rootFrame == rootPresShell->GetRootScrollFrame()) {
+ rootCompBounds = rootCompBounds.RemoveResolution(rootPresShell->GetResolution());
+ }
+
nsLayoutUtils::TransformRect(rootFrame, mOuter, rootCompBounds);
displayportBase = displayportBase.Intersect(rootCompBounds);
}
}
}
displayportBase -= mScrollPort.TopLeft();