mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1241917 - Restrict subframe's displayport base to root composition bounds. r=tn
Previously displayport bases were computed as the intersection of the scrollport with the dirtyrect. However the dirtyrect covers what is rendered, and with displayports what we render can be much larger than what is visible. With displayport bases intended to represent what was visible, this was a problem. By restricting them to the root composition size this makes them more closely match what is visible. To do this more properly we'd want to intersect the dirtyrect with the scroll clip of every ancestor scroll frame, not just the root composition bounds.
This commit is contained in:
parent
3585a95d3a
commit
d412b3daee
@ -3346,9 +3346,32 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||
displayportBase =
|
||||
nsRect(nsPoint(0, 0), nsLayoutUtils::CalculateCompositionSizeForFrame(mOuter));
|
||||
} else {
|
||||
// Restrict the dirty rect to the scrollport, and make it relative to the
|
||||
// scrollport for the displayport base.
|
||||
// Make the displayport base equal to the dirty rect restricted to
|
||||
// the scrollport and the root composition bounds, relative to the
|
||||
// scrollport.
|
||||
displayportBase = aDirtyRect->Intersect(mScrollPort);
|
||||
|
||||
const nsPresContext* rootPresContext =
|
||||
pc->GetToplevelContentDocumentPresContext();
|
||||
if (!rootPresContext) {
|
||||
rootPresContext = pc->GetRootPresContext();
|
||||
}
|
||||
if (rootPresContext) {
|
||||
const nsIPresShell* const rootPresShell = rootPresContext->PresShell();
|
||||
nsIFrame* rootFrame = rootPresShell->GetRootScrollFrame();
|
||||
if (!rootFrame) {
|
||||
rootFrame = rootPresShell->GetRootFrame();
|
||||
}
|
||||
if (rootFrame) {
|
||||
nsRect rootCompBounds =
|
||||
nsRect(nsPoint(0, 0), nsLayoutUtils::CalculateCompositionSizeForFrame(rootFrame));
|
||||
|
||||
nsLayoutUtils::TransformRect(rootFrame, mOuter, rootCompBounds);
|
||||
|
||||
displayportBase = displayportBase.Intersect(rootCompBounds);
|
||||
}
|
||||
}
|
||||
|
||||
displayportBase -= mScrollPort.TopLeft();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user