Bug 1259593 - Trim the displayport base rect to the size of the transformed root composition bounds, but without doing an intersection. r=tnikkel
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 31 Mar 2016 23:51:38 -0400
changeset 291126 abe2031a710e675ca6407af0ea168960f2ac8d04
parent 291125 fceee99ec164f23f18b5f88649912ada60dd0e41
child 291127 05cd77a4d02b89dbaacb5d3583b9849123b448c2
push id74475
push userkgupta@mozilla.com
push dateFri, 01 Apr 2016 03:51:57 +0000
treeherdermozilla-inbound@abe2031a710e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1259593
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1259593 - Trim the displayport base rect to the size of the transformed root composition bounds, but without doing an intersection. r=tnikkel MozReview-Commit-ID: G1CeplN7Mks
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3482,17 +3482,29 @@ ScrollFrameHelper::DecideScrollableLayer
               // 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);
+              // Clamp the displayport base to the size of the transformed root
+              // composition bounds, by trimming an equal amount off opposite
+              // sides of the base rect.
+              if (rootCompBounds.width < displayportBase.width) {
+                nscoord diff = displayportBase.width - rootCompBounds.width;
+                displayportBase.x += diff / 2;
+                displayportBase.width -= diff;
+              }
+              if (rootCompBounds.height < displayportBase.height) {
+                nscoord diff = displayportBase.height - rootCompBounds.height;
+                displayportBase.y += diff / 2;
+                displayportBase.height -= diff;
+              }
             }
           }
         }
 
         displayportBase -= mScrollPort.TopLeft();
       }
 
       nsLayoutUtils::SetDisplayPortBase(mOuter->GetContent(), displayportBase);