Bug 1224307 - Fix page scrolling for non-full-width fixed headers/footers [r=tn]
authorMatt Brubeck <mbrubeck@mozilla.com>
Thu, 12 Nov 2015 16:55:00 -0800
changeset 272488 731ca2fd1aeca2617450eadbe6b79413160b28b4
parent 272487 efa3552ee03151f649e3c55f19e4ae6d50f94b4c
child 272489 31f4f85705940ed59a4ca0672907c148e5e8e781
push id29674
push userphilringnalda@gmail.com
push dateSat, 14 Nov 2015 21:22:32 +0000
treeherdermozilla-central@51fa3e0d4f7b [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/mochitest.ini
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/mochitest.ini
+++ b/layout/generic/test/mochitest.ini
@@ -108,17 +108,17 @@ skip-if = buildapp == 'mulet' || buildap
 [test_movement_by_characters.html]
 [test_movement_by_words.html]
 # Disable the caret movement by word test on Linux because the shortcut keys
 # are defined in system level.  So, it depends on the environment.
 # Disable on Windows for too many intermittent failures (bug 916143).
 skip-if = (toolkit == "gtk2") || (toolkit == "gtk3") || (os == "win")
 [test_overflow_event.html]
 [test_page_scroll_with_fixed_pos.html]
-skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(opened window too small?) b2g-desktop(opened window too small?)
+skip-if = buildapp == 'mulet' || (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(opened window too small?) b2g-desktop(opened window too small?)
 support-files = page_scroll_with_fixed_pos_window.html
 [test_plugin_clipping.xhtml]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
 [test_plugin_clipping2.xhtml]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
 [test_plugin_clipping_transformed.xhtml]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || e10s #Bug 931116, b2g desktop specific, initial triage
 [test_plugin_clipping_table.xhtml]
--- 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>