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 291185 abe2031a710e675ca6407af0ea168960f2ac8d04
parent 291184 fceee99ec164f23f18b5f88649912ada60dd0e41
child 291186 05cd77a4d02b89dbaacb5d3583b9849123b448c2
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1259593
milestone48.0a1
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);