Bug 1247098 - Take document resolution into account when computing root composition bounds for displayport base; r?tnikkel draft
authorJamie Nicol <jnicol@mozilla.com>
Wed, 24 Feb 2016 15:30:10 +0000
changeset 334140 5db72e964989713952134640ee636906026ed978
parent 334139 7ba57b131dc9b5f967738ce7eed0c58a7e77de15
child 514831 8585c5d87919f1c17d0daf6849713e0bfe70efdf
push id11457
push userbmo:jnicol@mozilla.com
push dateWed, 24 Feb 2016 15:41:38 +0000
reviewerstnikkel
bugs1247098
milestone47.0a1
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
layout/generic/nsGfxScrollFrame.cpp
--- 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();