mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1246443 - Only restrict displayport base to root composition bounds if content has displayport; r=tnikkel
Bug 1241917 made it so that a subframe's displayport base is restricted to the root composition bounds (in addition to its previous restrictions). This involved an expensive coordinate transformation causing a scrolling performance regression. This avoids restricting the displayport base to the root composition bounds unless the frame has a display port, avoiding the expensive computation unless necessary. MozReview-Commit-ID: FVacUscAfu2 --HG-- extra : transplant_source : %F9%E9%19%06/%9C%EA%8C%D1%D5%BD%ED%26C%97y%15%92%7E%CB
This commit is contained in:
parent
4179c35c7c
commit
7a3d99d8ca
@ -3370,24 +3370,28 @@ ScrollFrameHelper::DecideScrollableLayer(nsDisplayListBuilder* aBuilder,
|
||||
// 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();
|
||||
// Only restrict to the root composition bounds if necessary,
|
||||
// as the required coordinate transformation is expensive.
|
||||
if (wasUsingDisplayPort) {
|
||||
const nsPresContext* rootPresContext =
|
||||
pc->GetToplevelContentDocumentPresContext();
|
||||
if (!rootPresContext) {
|
||||
rootPresContext = pc->GetRootPresContext();
|
||||
}
|
||||
if (rootFrame) {
|
||||
nsRect rootCompBounds =
|
||||
nsRect(nsPoint(0, 0), nsLayoutUtils::CalculateCompositionSizeForFrame(rootFrame));
|
||||
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);
|
||||
nsLayoutUtils::TransformRect(rootFrame, mOuter, rootCompBounds);
|
||||
|
||||
displayportBase = displayportBase.Intersect(rootCompBounds);
|
||||
displayportBase = displayportBase.Intersect(rootCompBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user