Bug 1300611 - Move overflow rect into correct coordinate space when computing perspective overflows so that it's not affected by scroll position. r=dbaron
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 14 Sep 2016 18:00:17 +1200
changeset 313883 442ca1f2745ec2689225c6c5254f58b3b0cb090f
parent 313882 b1cdea819863ad7e6721a5ef746f66d95eb0a3e7
child 313884 ce4e1e8aaa0e4a4ec25d33a46458f821499d8c25
push id32267
push usercbook@mozilla.com
push dateWed, 14 Sep 2016 13:46:59 +0000
treeherderautoland@4b1f411b1ea6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1300611
milestone51.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 1300611 - Move overflow rect into correct coordinate space when computing perspective overflows so that it's not affected by scroll position. r=dbaron
layout/generic/nsGfxScrollFrame.cpp
layout/generic/test/test_bug1198135.html
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -942,17 +942,17 @@ GetScrollableOverflowForPerspective(nsIF
         overhang.top /= bottomDelta;
         overhang.right /= rightDelta;
         overhang.bottom /= bottomDelta;
         overhang.left /= rightDelta;
 
         // Take the minimum overflow rect that would allow the current scroll
         // position, using the size of the scroll port and offset by the
         // inverse of the scroll position.
-        nsRect overflow(0, 0, aScrollPort.width, aScrollPort.height);
+        nsRect overflow = aScrollPort - scrollPos;
 
         // Expand it by our margins to get an overflow rect that would allow all
         // edges of our transformed content to be scrolled into view.
         overflow.Inflate(overhang);
 
         // Merge it with the combined overflow
         aScrolledFrameOverflowArea.UnionRect(aScrolledFrameOverflowArea,
                                              overflow);
--- a/layout/generic/test/test_bug1198135.html
+++ b/layout/generic/test/test_bug1198135.html
@@ -72,13 +72,18 @@ https://bugzilla.mozilla.org/show_bug.cg
   <div class="example__group">
     <div class="example__layer layer--c"></div>
     <div class="example__layer layer--e"></div>
   </div>
 </div>
 
 <script>
   is(document.getElementById("first").scrollHeight, 600, "Scroll height should be computed correctly");
+  document.getElementById("first").scrollTop = 150;
+  is(document.getElementById("first").scrollHeight, 600, "Scroll height should be a constant when scrolling");
+
   // The true height is 727.5 and we don't always snap the same direction.
   isfuzzy(document.getElementById("second").scrollHeight, 728, 1, "Scroll height should be computed correctly");
+  document.getElementById("second").scrollTop = 150;
+  isfuzzy(document.getElementById("second").scrollHeight, 728, 1, "Scroll height should be a constant when scrolling");
 </script>
 
 </body></html>