Bug 987680. Overlay scrollbars should be placed on top of content. r=roc
☠☠ backed out by fe57c073f019 ☠ ☠
authorTimothy Nikkel <tnikkel@gmail.com>
Sun, 06 Apr 2014 22:00:01 -0500
changeset 177226 b9085d8ca22e4d14923c978f1e355cc3709ce459
parent 177225 147581a518c343e509531cb608567758868cc3bd
child 177227 f5b3731b521267d25ff332ad10166496e233b959
push id41950
push usertnikkel@gmail.com
push dateMon, 07 Apr 2014 03:00:25 +0000
treeherdermozilla-inbound@b9085d8ca22e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs987680, 926292
milestone31.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 987680. Overlay scrollbars should be placed on top of content. r=roc Bug 926292 accidentally put them in the background list if there were no positioned descendents that they needed to be on top of it (because this was where non-overlay scrollbars went, which never made sense). If there are no positioned descendents overlay scrollbars should go on the top-most non-positioned list, which is outlines for the current implementation.
layout/generic/nsGfxScrollFrame.cpp
layout/reftests/bugs/987680-1-ref.html
layout/reftests/bugs/987680-1.html
layout/reftests/bugs/reftest.list
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2123,23 +2123,27 @@ AppendToTop(nsDisplayListBuilder* aBuild
   if (aSource->IsEmpty())
     return;
 
   nsDisplayWrapList* newItem = aOwnLayer?
     new (aBuilder) nsDisplayOwnLayer(aBuilder, aSourceFrame, aSource,
                                      aFlags, aScrollTargetId) :
     new (aBuilder) nsDisplayWrapList(aBuilder, aSourceFrame, aSource);
 
-  nsDisplayList* positionedDescendants = aLists.PositionedDescendants();
-  if (aPositioned && !positionedDescendants->IsEmpty()) {
+  if (aPositioned) {
     // We want overlay scrollbars to always be on top of the scrolled content,
     // but we don't want them to unnecessarily cover overlapping elements from
     // outside our scroll frame.
-    newItem->SetOverrideZIndex(MaxZIndexInList(positionedDescendants, aBuilder));
-    positionedDescendants->AppendNewToTop(newItem);
+    nsDisplayList* positionedDescendants = aLists.PositionedDescendants();
+    if (!positionedDescendants->IsEmpty()) {
+      newItem->SetOverrideZIndex(MaxZIndexInList(positionedDescendants, aBuilder));
+      positionedDescendants->AppendNewToTop(newItem);
+    } else {
+      aLists.Outlines()->AppendNewToTop(newItem);
+    }
   } else {
     aLists.BorderBackground()->AppendNewToTop(newItem);
   }
 }
 
 struct HoveredStateComparator
 {
   bool Equals(nsIFrame* A, nsIFrame* B) const {
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/987680-1-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+  width: 200px;
+  height: 200px;
+  overflow: scroll;
+  position: relative;
+}
+</style>
+</head>
+<body>
+<div class="container">
+  <div style="width: 10px; height: 10px; left: 0px; top: 60px; background: white; position: absolute; z-index: 1;"></div>
+  <div style="background: green; height: 40px;"></div>
+  <div style="height: 300px;"></div>
+</div>
+</body>
+</html>
\ No newline at end of file
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bugs/987680-1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+.container {
+  width: 200px;
+  height: 200px;
+  overflow: scroll;
+  position: relative;
+}
+</style>
+</head>
+<body>
+<div class="container">
+  <div style="background: green; height: 40px;"></div>
+  <div style="height: 300px;"></div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- a/layout/reftests/bugs/reftest.list
+++ b/layout/reftests/bugs/reftest.list
@@ -1799,8 +1799,9 @@ fails == 942017.html 942017-ref.html # b
 pref(layout.css.overflow-clip-box.enabled,true) fuzzy(50,10) == 966992-1.html 966992-1-ref.html
 skip-if(Android) == 966510-1.html 966510-1-ref.html # scrollable elements other than the root probably won't work well on android until bug 776030 is fixed
 skip-if(Android) == 966510-2.html 966510-2-ref.html # same as above
 == 978911-1.svg 978911-1-ref.svg
 == 983084-1.html 983084-1-ref.html
 == 983084-2.html 983084-2-ref.html
 == 983084-3.html 983084-1-ref.html
 == 983691-1.html 983691-ref.html
+== 987680-1.html 987680-1-ref.html