diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index f03c7595e82d..3812a49dc0f5 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -3706,7 +3706,9 @@ GetScrollPortSizeExcludingHeadersAndFooters(nsIFrame* aViewportFrame, 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) { diff --git a/layout/generic/test/page_scroll_with_fixed_pos_window.html b/layout/generic/test/page_scroll_with_fixed_pos_window.html index 91347f9c8509..8647e7252dea 100644 --- a/layout/generic/test/page_scroll_with_fixed_pos_window.html +++ b/layout/generic/test/page_scroll_with_fixed_pos_window.html @@ -91,10 +91,19 @@ function runTest() { "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(); + }); }); }); });