Bug 1511358 - Don't include elements with z-index<0 when looking for the max z-index in a display list. r=miko a=lizzard
authorMatt Woodrow <mwoodrow@mozilla.com>
Tue, 19 Feb 2019 13:38:08 +0000
changeset 516192 ccc6779c8e4866a8f6fb7b65b96b59ef4e40104a
parent 516191 cdfa53fd8d9c1555c4775e435350d0fa32f2040b
child 516193 fb8a1b398f229ff4f7ce8b5d1234a08002ac8353
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko, lizzard
bugs1511358
milestone66.0
Bug 1511358 - Don't include elements with z-index<0 when looking for the max z-index in a display list. r=miko a=lizzard This restores the previous behaviour (where a result < 0 was ignored), since using a negative value means we place our overlay scrollbar/resizer behind non-positioned content. Differential Revision: https://phabricator.services.mozilla.com/D20212
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2908,20 +2908,24 @@ void ScrollFrameHelper::ScrollToImpl(nsP
   }
 }
 
 static Maybe<int32_t> MaxZIndexInList(nsDisplayList* aList,
                                       nsDisplayListBuilder* aBuilder) {
   Maybe<int32_t> maxZIndex = Nothing();
   for (nsDisplayItem* item = aList->GetBottom(); item;
        item = item->GetAbove()) {
+    int32_t zIndex = item->ZIndex();
+    if (zIndex < 0) {
+      continue;
+    }
     if (!maxZIndex) {
-      maxZIndex = Some(item->ZIndex());
+      maxZIndex = Some(zIndex);
     } else {
-      maxZIndex = Some(std::max(maxZIndex.value(), item->ZIndex()));
+      maxZIndex = Some(std::max(maxZIndex.value(), zIndex));
     }
   }
   return maxZIndex;
 }
 
 template <class T>
 static void AppendInternalItemToTop(const nsDisplayListSet& aLists, T* aItem,
                                     const Maybe<int32_t>& aZIndex) {