Bug 1224307 - Fix page scrolling for non-full-width fixed headers/footers [r=tn]
☠☠ backed out by aa323766c0f9 ☠ ☠
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 12 Nov 2015 16:55:00 -0800
changeset 272362 cd0be67d2344a24b6dae7cb91c03138703ca46c6
parent 272361 85e218929a7a10851b83487c3b622b26f490c544
child 272363 13335ded96b921704816cb491a38c2b45dc8f94f
push id67931
push usermbrubeck@mozilla.com
push dateFri, 13 Nov 2015 00:55:21 +0000
treeherdermozilla-inbound@13335ded96b9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1224307
milestone45.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 1224307 - Fix page scrolling for non-full-width fixed headers/footers [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
@@ -3702,17 +3702,18 @@ GetScrollPortSizeExcludingHeadersAndFoot
                                             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);
-    if (r.x == 0 && r.width == aScrollPort.width &&
+    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());
   nscoord headerBottom = 0;
   for (uint32_t i = 0; i < list.Length(); ++i) {
--- a/layout/generic/test/page_scroll_with_fixed_pos_window.html
+++ b/layout/generic/test/page_scroll_with_fixed_pos_window.html
@@ -78,21 +78,29 @@ function runTest() {
           is(document.documentElement.scrollTop, fullPageScrollDown - 13,
              "Ignore elements that don't span the entire viewport side");
           document.getElementById("top").style.width = "100%";
 
           showFixedPosElements2(true);
           scrollDownOnePageWithContinuation(function() {
             is(document.documentElement.scrollTop, fullPageScrollDown - (10 + 11 + 9 + 12),
                "Combine multiple overlapping elements");
+            showFixedPosElements2(false);
 
-            // Scroll back up so test results are visible
-            document.documentElement.scrollTop = 0;
-            SimpleTest.finish();
-            window.close();
+            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();
+            });
           });
         });
       });
     });
   });
 }
 </script>
 </pre>