Bug 1276107 - Ensure that the event-regions display item for a scrollable subframe ends up on top of perspective child items. r=mattwoodrow, a=lizzard
authorBotond Ballo <botond@mozilla.com>
Mon, 30 May 2016 18:56:32 -0400
changeset 339634 b030558642527863f84ef96415a38b90e7234669
parent 339633 e5301bb031fb4cc1f0ed334a1462a841b51d17c9
child 339635 19ce047a35799a211ed706d2085a174e21ebb6fe
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow, lizzard
bugs1276107
milestone49.0a2
Bug 1276107 - Ensure that the event-regions display item for a scrollable subframe ends up on top of perspective child items. r=mattwoodrow, a=lizzard MozReview-Commit-ID: 8nyeZb7g8Po
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2840,17 +2840,23 @@ MaxZIndexInList(nsDisplayList* aList, ns
 //   1) have z-index auto or z-index >= 0.
 //   2) aFrame is a proper ancestor of the item's frame.
 // Returns -1 if there is no such item.
 static int32_t
 MaxZIndexInListOfItemsContainedInFrame(nsDisplayList* aList, nsIFrame* aFrame)
 {
   int32_t maxZIndex = -1;
   for (nsDisplayItem* item = aList->GetBottom(); item; item = item->GetAbove()) {
-    if (nsLayoutUtils::IsProperAncestorFrame(aFrame, item->Frame())) {
+    nsIFrame* itemFrame = item->Frame();
+    // Perspective items return the scroll frame as their Frame(), so consider
+    // their TransformFrame() instead.
+    if (item->GetType() == nsDisplayItem::TYPE_PERSPECTIVE) {
+      itemFrame = static_cast<nsDisplayPerspective*>(item)->TransformFrame();
+    }
+    if (nsLayoutUtils::IsProperAncestorFrame(aFrame, itemFrame)) {
       maxZIndex = std::max(maxZIndex, item->ZIndex());
     }
   }
   return maxZIndex;
 }
 
 static const uint32_t APPEND_OWN_LAYER = 0x1;
 static const uint32_t APPEND_POSITIONED = 0x2;