Bug 1287142 - Ensure that the touch-action property on the scrollable element is applied to both the inner and outer scrollframe. r=tnikkel
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 20 Jul 2016 23:29:17 -0400
changeset 331056 439867de69353a878b0bf43b6d5d00e92d678304
parent 331055 56faf83bf0c3fa65d671c3334227923d9870eacd
child 331057 4bc6b6fe87b67765de7b010ecf0c2e8802a13170
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1287142
milestone50.0a1
Bug 1287142 - Ensure that the touch-action property on the scrollable element is applied to both the inner and outer scrollframe. r=tnikkel MozReview-Commit-ID: JafhGnhpApE
layout/base/nsDisplayList.cpp
layout/generic/nsFrame.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -3670,17 +3670,22 @@ nsDisplayLayerEventRegions::AddFrame(nsD
     nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
     if (pluginFrame && pluginFrame->WantsToHandleWheelEventAsDefaultAction()) {
       mDispatchToContentHitRegion.Or(mDispatchToContentHitRegion, borderBox);
     }
   }
 
   // Touch action region
 
-  uint32_t touchAction = nsLayoutUtils::GetTouchActionFromFrame(aFrame);
+  nsIFrame* touchActionFrame = aFrame;
+  nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(aFrame);
+  if (scrollFrame) {
+    touchActionFrame = do_QueryFrame(scrollFrame);
+  }
+  uint32_t touchAction = nsLayoutUtils::GetTouchActionFromFrame(touchActionFrame);
   if (touchAction != NS_STYLE_TOUCH_ACTION_AUTO) {
     // If this frame has touch-action areas, and there were already
     // touch-action areas from some other element on this same event regions,
     // then all we know is that there are multiple elements with touch-action
     // properties. In particular, we don't know what the relationship is
     // between those elements in terms of DOM ancestry, and so we don't know
     // how to combine the regions properly. Instead, we just add all the areas
     // to the dispatch-to-content region, so that the APZ knows to check with
@@ -3755,16 +3760,25 @@ nsDisplayLayerEventRegions::WriteDebugIn
     AppendToString(aStream, mHitRegion, " (hitRegion ", ")");
   }
   if (!mMaybeHitRegion.IsEmpty()) {
     AppendToString(aStream, mMaybeHitRegion, " (maybeHitRegion ", ")");
   }
   if (!mDispatchToContentHitRegion.IsEmpty()) {
     AppendToString(aStream, mDispatchToContentHitRegion, " (dispatchToContentRegion ", ")");
   }
+  if (!mNoActionRegion.IsEmpty()) {
+    AppendToString(aStream, mNoActionRegion, " (noActionRegion ", ")");
+  }
+  if (!mHorizontalPanRegion.IsEmpty()) {
+    AppendToString(aStream, mHorizontalPanRegion, " (horizPanRegion ", ")");
+  }
+  if (!mVerticalPanRegion.IsEmpty()) {
+    AppendToString(aStream, mVerticalPanRegion, " (vertPanRegion ", ")");
+  }
 }
 
 nsDisplayCaret::nsDisplayCaret(nsDisplayListBuilder* aBuilder,
                                nsIFrame* aCaretFrame)
   : nsDisplayItem(aBuilder, aCaretFrame)
   , mCaret(aBuilder->GetCaret())
   , mBounds(aBuilder->GetCaretRect() + ToReferenceFrame())
 {
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -2861,21 +2861,21 @@ nsIFrame::BuildDisplayListForChild(nsDis
       // If this frame has a different animated geometry root than its parent,
       // make sure we accumulate event regions for its layer.
       if (buildingForChild.IsAnimatedGeometryRoot()) {
         nsDisplayLayerEventRegions* eventRegions =
           new (aBuilder) nsDisplayLayerEventRegions(aBuilder, child);
         eventRegions->AddFrame(aBuilder, child);
         aBuilder->SetLayerEventRegions(eventRegions);
         aLists.BorderBackground()->AppendNewToTop(eventRegions);
-      }
-
-      nsDisplayLayerEventRegions* eventRegions = aBuilder->GetLayerEventRegions();
-      if (eventRegions) {
-        eventRegions->AddFrame(aBuilder, child);
+      } else {
+        nsDisplayLayerEventRegions* eventRegions = aBuilder->GetLayerEventRegions();
+        if (eventRegions) {
+          eventRegions->AddFrame(aBuilder, child);
+        }
       }
     }
 
     if (!pseudoStackingContext) {
       // THIS IS THE COMMON CASE.
       // Not a pseudo or real stacking context. Do the simple thing and
       // return early.