Bug 1081272 - Include position and transform when computing header/footer size [r=tn]
☠☠ backed out by 5c371591bc24 ☠ ☠
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 12 Nov 2015 16:55:02 -0800
changeset 308666 13335ded96b921704816cb491a38c2b45dc8f94f
parent 308665 cd0be67d2344a24b6dae7cb91c03138703ca46c6
child 308667 b583adc5046cd540d744a710020ac7ed0ab7de5d
push id7513
push useratolfsen@mozilla.com
push dateFri, 13 Nov 2015 14:03:43 +0000
reviewerstn
bugs1081272
milestone45.0a1
Bug 1081272 - Include position and transform when computing header/footer size [r=tn]
layout/generic/nsGfxScrollFrame.cpp
layout/generic/test/page_scroll_with_fixed_pos_window.html
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3701,17 +3701,19 @@ static nsSize
 GetScrollPortSizeExcludingHeadersAndFooters(nsIFrame* aViewportFrame,
                                             const nsRect& aScrollPort)
 {
   nsTArray<TopAndBottom> list;
   nsFrameList fixedFrames = aViewportFrame->GetChildList(nsIFrame::kFixedList);
   for (nsFrameList::Enumerator iterator(fixedFrames); !iterator.AtEnd();
        iterator.Next()) {
     nsIFrame* f = iterator.get();
-    nsRect r = f->GetRect().Intersect(aScrollPort);
+    nsRect r = f->GetRectRelativeToSelf();
+    r = nsLayoutUtils::TransformFrameRectToAncestor(f, r, aViewportFrame);
+    r = r.Intersect(aScrollPort);
     if ((r.width >= aScrollPort.width / 2 ||
          r.width >= NSIntPixelsToAppUnits(800, AppUnitsPerCSSPixel())) &&
         r.height <= aScrollPort.height/3) {
       list.AppendElement(TopAndBottom(r.y, r.YMost()));
     }
   }
 
   list.Sort(TopComparator());
--- a/layout/generic/test/page_scroll_with_fixed_pos_window.html
+++ b/layout/generic/test/page_scroll_with_fixed_pos_window.html
@@ -86,20 +86,29 @@ function runTest() {
             showFixedPosElements2(false);
 
             document.getElementById("top").style.width = "400px";
             scrollDownOnePageWithContinuation(function() {
               is(document.documentElement.scrollTop, fullPageScrollDown - (10 + 13),
                  "Don't ignore elements that span more than half the viewport side");
               document.getElementById("top").style.width = "100%";
 
-              // Scroll back up so test results are visible
-              document.documentElement.scrollTop = 0;
-              SimpleTest.finish();
-              window.close();
+              document.getElementById("top").style.top = "-40px";
+              document.getElementById("top").style.transform = "translateY(38px)";
+              scrollDownOnePageWithContinuation(function() {
+                is(document.documentElement.scrollTop,
+                   fullPageScrollDown - (10 + 13 - 40 + 38),
+                   "Account for offset and transform");
+                document.getElementById("top").style.width = "100%";
+
+                // Scroll back up so test results are visible
+                document.documentElement.scrollTop = 0;
+                SimpleTest.finish();
+                window.close();
+              });
             });
           });
         });
       });
     });
   });
 }
 </script>