Merge inbound to mozilla-central. a=merge
authorarthur.iakab <aiakab@mozilla.com>
Sat, 24 Feb 2018 23:52:48 +0200
changeset 457666 bfe62272d2a21f9d10d45e5aaa680f5c735604ae
parent 457663 f08b503f9013395b98734f5aeae199256bf7663a (current diff)
parent 457665 94526b17561f3469b1cf398ff6c09fb44ded10d9 (diff)
child 457672 f81789c9866e03cdba52be10a6e779c80094ddf1
push id8799
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 16:46:23 +0000
treeherdermozilla-beta@15334014dc67 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone60.0a1
first release with
nightly linux32
bfe62272d2a2 / 60.0a1 / 20180224220348 / files
nightly linux64
bfe62272d2a2 / 60.0a1 / 20180224220348 / files
nightly mac
bfe62272d2a2 / 60.0a1 / 20180224220348 / files
nightly win32
bfe62272d2a2 / 60.0a1 / 20180224220348 / files
nightly win64
bfe62272d2a2 / 60.0a1 / 20180224220348 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
--- a/gfx/layers/LayersTypes.cpp
+++ b/gfx/layers/LayersTypes.cpp
@@ -9,26 +9,28 @@
 namespace mozilla {
 namespace layers {
 
 EventRegions::EventRegions(const nsIntRegion& aHitRegion,
                            const nsIntRegion& aMaybeHitRegion,
                            const nsIntRegion& aDispatchToContentRegion,
                            const nsIntRegion& aNoActionRegion,
                            const nsIntRegion& aHorizontalPanRegion,
-                           const nsIntRegion& aVerticalPanRegion)
+                           const nsIntRegion& aVerticalPanRegion,
+                           bool aDTCRequiresTargetConfirmation)
 {
   mHitRegion = aHitRegion;
   mNoActionRegion = aNoActionRegion;
   mHorizontalPanRegion = aHorizontalPanRegion;
   mVerticalPanRegion = aVerticalPanRegion;
   // Points whose hit-region status we're not sure about need to be dispatched
   // to the content thread. If a point is in both maybeHitRegion and hitRegion
   // then it's not a "maybe" any more, and doesn't go into the dispatch-to-
   // content region.
   mDispatchToContentHitRegion.Sub(aMaybeHitRegion, mHitRegion);
   mDispatchToContentHitRegion.OrWith(aDispatchToContentRegion);
   mHitRegion.OrWith(aMaybeHitRegion);
+  mDTCRequiresTargetConfirmation = aDTCRequiresTargetConfirmation;
 }
 
 } // namespace layers
 } // namespace mozilla
 
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -95,42 +95,55 @@ struct EventRegions {
   // The following regions represent the touch-action areas of this layer.
   // All of these regions are approximations to the true region, but any
   // variance between the approximation and the true region is guaranteed
   // to be included in the mDispatchToContentHitRegion.
   nsIntRegion mNoActionRegion;
   nsIntRegion mHorizontalPanRegion;
   nsIntRegion mVerticalPanRegion;
 
+  // Set to true if events targeting the dispatch-to-content region
+  // require target confirmation.
+  // See CompositorHitTestFlags::eRequiresTargetConfirmation.
+  // We don't bother tracking a separate region for this (which would
+  // be a sub-region of the dispatch-to-content region), because the added
+  // overhead of region computations is not worth it, and because
+  // EventRegions are going to be deprecated anyways.
+  bool mDTCRequiresTargetConfirmation;
+
   EventRegions()
+    : mDTCRequiresTargetConfirmation(false)
   {
   }
 
   explicit EventRegions(nsIntRegion aHitRegion)
     : mHitRegion(aHitRegion)
+    , mDTCRequiresTargetConfirmation(false)
   {
   }
 
   // This constructor takes the maybe-hit region and uses it to update the
   // hit region and dispatch-to-content region. It is useful from converting
   // from the display item representation to the layer representation.
   EventRegions(const nsIntRegion& aHitRegion,
                const nsIntRegion& aMaybeHitRegion,
                const nsIntRegion& aDispatchToContentRegion,
                const nsIntRegion& aNoActionRegion,
                const nsIntRegion& aHorizontalPanRegion,
-               const nsIntRegion& aVerticalPanRegion);
+               const nsIntRegion& aVerticalPanRegion,
+               bool aDTCRequiresTargetConfirmation);
 
   bool operator==(const EventRegions& aRegions) const
   {
     return mHitRegion == aRegions.mHitRegion &&
            mDispatchToContentHitRegion == aRegions.mDispatchToContentHitRegion &&
            mNoActionRegion == aRegions.mNoActionRegion &&
            mHorizontalPanRegion == aRegions.mHorizontalPanRegion &&
-           mVerticalPanRegion == aRegions.mVerticalPanRegion;
+           mVerticalPanRegion == aRegions.mVerticalPanRegion &&
+           mDTCRequiresTargetConfirmation == aRegions.mDTCRequiresTargetConfirmation;
   }
   bool operator!=(const EventRegions& aRegions) const
   {
     return !(*this == aRegions);
   }
 
   void ApplyTranslationAndScale(float aXTrans, float aYTrans, float aXScale, float aYScale)
   {
@@ -169,16 +182,17 @@ struct EventRegions {
     mHorizontalPanRegion.OrWith(aOther.mHorizontalPanRegion);
     mVerticalPanRegion.OrWith(aOther.mVerticalPanRegion);
     if (alreadyHadRegions) {
       nsIntRegion combinedActionRegions;
       combinedActionRegions.Or(mHorizontalPanRegion, mVerticalPanRegion);
       combinedActionRegions.OrWith(mNoActionRegion);
       mDispatchToContentHitRegion.OrWith(combinedActionRegions);
     }
+    mDTCRequiresTargetConfirmation |= aOther.mDTCRequiresTargetConfirmation;
   }
 
   bool IsEmpty() const
   {
     return mHitRegion.IsEmpty()
         && mDispatchToContentHitRegion.IsEmpty()
         && mNoActionRegion.IsEmpty()
         && mHorizontalPanRegion.IsEmpty()
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp
+++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp
@@ -307,16 +307,19 @@ HitTestingTreeNode::HitTest(const LayerP
   }
 
   result |= CompositorHitTestInfo::eVisibleToHitTest;
 
   if ((mOverride & EventRegionsOverride::ForceDispatchToContent) ||
       mEventRegions.mDispatchToContentHitRegion.Contains(point.x, point.y))
   {
     result |= CompositorHitTestInfo::eDispatchToContent;
+    if (mEventRegions.mDTCRequiresTargetConfirmation) {
+      result |= CompositorHitTestInfo::eRequiresTargetConfirmation;
+    }
   } else if (gfxPrefs::TouchActionEnabled()) {
     if (mEventRegions.mNoActionRegion.Contains(point.x, point.y)) {
       // set all the touch-action flags as disabled
       result |= CompositorHitTestInfo::eTouchActionMask;
     } else {
       bool panX = mEventRegions.mHorizontalPanRegion.Contains(point.x, point.y);
       bool panY = mEventRegions.mVerticalPanRegion.Contains(point.x, point.y);
       if (panX && panY) {
--- a/gfx/layers/apz/test/mochitest/helper_scroll_overscroll_behavior.html
+++ b/gfx/layers/apz/test/mochitest/helper_scroll_overscroll_behavior.html
@@ -2,30 +2,20 @@
   <meta name="viewport" content="width=device-width; initial-scale=1.0">
   <title>Wheel-scrolling over inactive subframe with overscroll-behavior</title>
   <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
   <script type="application/javascript" src="apz_test_utils.js"></script>
   <script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
   <script type="application/javascript">
 
 function* test(testDriver) {
-  var utils = SpecialPowers.getDOMWindowUtils(window);
-  var isWebRender = (utils.layerManagerType == 'WebRender');
-  if (!isWebRender) {
-    // After bug 1440112 is fixed, the test can be enabled
-    // for non-WebRender as well.
-    ok(true, "This test is only enabled for WebRender");
-    return;
-  }
-
   var subframe = document.getElementById('scroll');
 
   // scroll over the middle of the subframe, and make sure that the page
   // does not scroll.
-  var scrollPos = subframe.scrollTop;
   var waitForScroll = false;  // don't wait for a scroll event, it will never come
   yield moveMouseAndScrollWheelOver(subframe, 100, 100, testDriver, waitForScroll);
   ok(window.scrollY == 0, "overscroll-behavior was respected");
 }
 
 waitUntilApzStable()
 .then(runContinuation(test))
 .then(subtestDone);
--- a/gfx/layers/ipc/LayersMessageUtils.h
+++ b/gfx/layers/ipc/LayersMessageUtils.h
@@ -434,25 +434,27 @@ struct ParamTraits<mozilla::layers::Even
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     WriteParam(aMsg, aParam.mHitRegion);
     WriteParam(aMsg, aParam.mDispatchToContentHitRegion);
     WriteParam(aMsg, aParam.mNoActionRegion);
     WriteParam(aMsg, aParam.mHorizontalPanRegion);
     WriteParam(aMsg, aParam.mVerticalPanRegion);
+    WriteParam(aMsg, aParam.mDTCRequiresTargetConfirmation);
   }
 
   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
   {
     return (ReadParam(aMsg, aIter, &aResult->mHitRegion) &&
             ReadParam(aMsg, aIter, &aResult->mDispatchToContentHitRegion) &&
             ReadParam(aMsg, aIter, &aResult->mNoActionRegion) &&
             ReadParam(aMsg, aIter, &aResult->mHorizontalPanRegion) &&
-            ReadParam(aMsg, aIter, &aResult->mVerticalPanRegion));
+            ReadParam(aMsg, aIter, &aResult->mVerticalPanRegion) &&
+            ReadParam(aMsg, aIter, &aResult->mDTCRequiresTargetConfirmation));
   }
 };
 
 template <>
 struct ParamTraits<mozilla::layers::FocusTarget::ScrollTargets>
 {
   typedef mozilla::layers::FocusTarget::ScrollTargets paramType;
 
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -193,17 +193,18 @@ WebRenderCommandBuilder::CreateWebRender
             static_cast<nsDisplayLayerEventRegions*>(item);
         int32_t auPerDevPixel = item->Frame()->PresContext()->AppUnitsPerDevPixel();
         EventRegions regions(
             regionsItem->HitRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel),
             regionsItem->MaybeHitRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel),
             regionsItem->DispatchToContentHitRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel),
             regionsItem->NoActionRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel),
             regionsItem->HorizontalPanRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel),
-            regionsItem->VerticalPanRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel));
+            regionsItem->VerticalPanRegion().ScaleToOutsidePixels(1.0f, 1.0f, auPerDevPixel),
+            /* mDTCRequiresTargetConfirmation = */ false);
 
         eventRegions.OrWith(regions);
         if (mLayerScrollData.empty()) {
           // If we don't have a layer data yet then create one because we will
           // need it to store this event region information.
           forceNewLayerData = true;
         }
       }
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -444,16 +444,17 @@ public:
     mIsSolidColorInVisibleRegion(false),
     mNeedComponentAlpha(false),
     mForceTransparentSurface(false),
     mHideAllLayersBelow(false),
     mOpaqueForAnimatedGeometryRootParent(false),
     mDisableFlattening(false),
     mBackfaceHidden(false),
     mShouldPaintOnContentSide(false),
+    mDTCRequiresTargetConfirmation(false),
     mImage(nullptr),
     mCommonClipCount(-1),
     mNewChildLayersIndex(-1)
   {}
 
 #ifdef MOZ_DUMP_PAINTING
   /**
    * Keep track of important decisions for debugging.
@@ -637,16 +638,23 @@ public:
    */
   bool mBackfaceHidden;
   /**
    * Set if it is better to render this layer on the content process, for
    * example if it contains native theme widgets.
    */
   bool mShouldPaintOnContentSide;
   /**
+   * Set to true if events targeting the dispatch-to-content region
+   * require target confirmation.
+   * See CompositorHitTestFlags::eRequiresTargetConfirmation and
+   * EventRegions::mDTCRequiresTargetConfirmation.
+   */
+  bool mDTCRequiresTargetConfirmation;
+  /**
    * Stores the pointer to the nsDisplayImage if we want to
    * convert this to an ImageLayer.
    */
   nsDisplayImageContainer* mImage;
   /**
    * Stores the clip that we need to apply to the image or, if there is no
    * image, a clip for SOME item in the layer. There is no guarantee which
    * item's clip will be stored here and mItemClip should not be used to clip
@@ -3335,16 +3343,19 @@ void ContainerState::FinishPaintedLayerD
         mContainerReferenceFrame,
         data->mDispatchToContentHitRegion.GetBounds(),
         containingPaintedLayerData->mReferenceFrame);
       if (inactiveLayerClip) {
         rect = inactiveLayerClip->ApplyNonRoundedIntersection(rect);
       }
       containingPaintedLayerData->mDispatchToContentHitRegion.Or(
         containingPaintedLayerData->mDispatchToContentHitRegion, rect);
+      if (data->mDTCRequiresTargetConfirmation) {
+        containingPaintedLayerData->mDTCRequiresTargetConfirmation = true;
+      }
     }
     if (!data->mMaybeHitRegion.GetBounds().IsEmpty()) {
       nsRect rect = nsLayoutUtils::TransformFrameRectToAncestor(
         mContainerReferenceFrame,
         data->mMaybeHitRegion.GetBounds(),
         containingPaintedLayerData->mReferenceFrame);
       if (inactiveLayerClip) {
         rect = inactiveLayerClip->ApplyNonRoundedIntersection(rect);
@@ -3398,17 +3409,18 @@ void ContainerState::FinishPaintedLayerD
     }
   } else {
     EventRegions regions(
         ScaleRegionToOutsidePixels(data->mHitRegion),
         ScaleRegionToOutsidePixels(data->mMaybeHitRegion),
         ScaleRegionToOutsidePixels(data->mDispatchToContentHitRegion),
         ScaleRegionToOutsidePixels(data->mNoActionRegion),
         ScaleRegionToOutsidePixels(data->mHorizontalPanRegion),
-        ScaleRegionToOutsidePixels(data->mVerticalPanRegion));
+        ScaleRegionToOutsidePixels(data->mVerticalPanRegion),
+        data->mDTCRequiresTargetConfirmation);
 
     Matrix mat = layer->GetTransform().As2D();
     mat.Invert();
     regions.ApplyTranslationAndScale(mat._31, mat._32, mat._11, mat._22);
 
     layer->SetEventRegions(regions);
   }
 
@@ -3654,16 +3666,20 @@ PaintedLayerData::AccumulateHitTestInfo(
   if (hasRoundedCorners || (frame->GetStateBits() & NS_FRAME_SVG_LAYOUT)) {
     mMaybeHitRegion.OrWith(area);
   } else {
     mHitRegion.OrWith(area);
   }
 
   if (aItem->HitTestInfo() & CompositorHitTestInfo::eDispatchToContent) {
     mDispatchToContentHitRegion.OrWith(area);
+
+    if (aItem->HitTestInfo() & CompositorHitTestInfo::eRequiresTargetConfirmation) {
+      mDTCRequiresTargetConfirmation = true;
+    }
   }
 
   auto touchFlags = hitTestInfo & CompositorHitTestInfo::eTouchActionMask;
   if (touchFlags) {
     // something was disabled
     if (touchFlags == CompositorHitTestInfo::eTouchActionMask) {
       // everything was disabled, so touch-action:none
       mNoActionRegion.OrWith(area);