Backed out 3 changesets (bug 1502010) for Gtest failure. CLOSED TREE
authorDorel Luca <dluca@mozilla.com>
Mon, 26 Nov 2018 22:25:02 +0200
changeset 504547 f3849030a93c44b14343bae1cc70709b8a56fa71
parent 504546 bd490139b395d47c6f1b4af6cf34f572a1902fe2
child 504548 46bb2a2ba36f639a81098d8264b8a9d48dbbd315
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1502010
milestone65.0a1
backs oute9e34c0b62ac841810517ebb5c5a3dd4c7dd439a
67c5cdc1e812495104949f8c5e8ebe83a450719f
f324774fb8637b4c725b8edbc96aea80b2f1a040
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
Backed out 3 changesets (bug 1502010) for Gtest failure. CLOSED TREE Backed out changeset e9e34c0b62ac (bug 1502010) Backed out changeset 67c5cdc1e812 (bug 1502010) Backed out changeset f324774fb863 (bug 1502010)
gfx/layers/apz/src/APZUtils.cpp
gfx/layers/apz/src/APZUtils.h
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/AsyncPanZoomController.h
gfx/layers/apz/src/InputBlockState.cpp
gfx/layers/apz/src/InputBlockState.h
gfx/layers/apz/src/InputQueue.cpp
--- a/gfx/layers/apz/src/APZUtils.cpp
+++ b/gfx/layers/apz/src/APZUtils.cpp
@@ -35,23 +35,11 @@ InitializeGlobalState()
 /*static*/ const ScreenMargin
 CalculatePendingDisplayPort(const FrameMetrics& aFrameMetrics,
                             const ParentLayerPoint& aVelocity)
 {
   return AsyncPanZoomController::CalculatePendingDisplayPort(
       aFrameMetrics, aVelocity);
 }
 
-/*static*/ bool
-IsCloseToHorizontal(float aAngle, float aThreshold)
-{
-  return (aAngle < aThreshold || aAngle > (M_PI - aThreshold));
-}
-
-/*static*/ bool
-IsCloseToVertical(float aAngle, float aThreshold)
-{
-  return (fabs(aAngle - (M_PI / 2)) < aThreshold);
-}
-
 } // namespace apz
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/apz/src/APZUtils.h
+++ b/gfx/layers/apz/src/APZUtils.h
@@ -126,24 +126,14 @@ void InitializeGlobalState();
 /**
  * See AsyncPanZoomController::CalculatePendingDisplayPort. This
  * function simply delegates to that one, so that non-layers code
  * never needs to include AsyncPanZoomController.h
  */
 const ScreenMargin CalculatePendingDisplayPort(const FrameMetrics& aFrameMetrics,
                                                const ParentLayerPoint& aVelocity);
 
-/**
- * Is aAngle within the given threshold of the horizontal axis?
- * @param aAngle an angle in radians in the range [0, pi]
- * @param aThreshold an angle in radians in the range [0, pi/2]
- */
-bool IsCloseToHorizontal(float aAngle, float aThreshold);
-
-// As above, but for the vertical axis.
-bool IsCloseToVertical(float aAngle, float aThreshold);
-
 } // namespace apz
 
 } // namespace layers
 } // namespace mozilla
 
 #endif // mozilla_layers_APZUtils_h
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -519,16 +519,32 @@ static const double kDefaultEstimatedPai
  * extra memory for a larger displayport to reduce checkerboarding.
  */
 static bool gIsHighMemSystem = false;
 static bool IsHighMemSystem()
 {
   return gIsHighMemSystem;
 }
 
+/**
+ * Is aAngle within the given threshold of the horizontal axis?
+ * @param aAngle an angle in radians in the range [0, pi]
+ * @param aThreshold an angle in radians in the range [0, pi/2]
+ */
+static bool IsCloseToHorizontal(float aAngle, float aThreshold)
+{
+  return (aAngle < aThreshold || aAngle > (M_PI - aThreshold));
+}
+
+// As above, but for the vertical axis.
+static bool IsCloseToVertical(float aAngle, float aThreshold)
+{
+  return (fabs(aAngle - (M_PI / 2)) < aThreshold);
+}
+
 // Counter used to give each APZC a unique id
 static uint32_t sAsyncPanZoomControllerCount = 0;
 
 AsyncPanZoomAnimation*
 PlatformSpecificStateBase::CreateFlingAnimation(AsyncPanZoomController& aApzc,
                                                 const FlingHandoffState& aHandoffState,
                                                 float aPLPPI)
 {
@@ -950,59 +966,43 @@ AsyncPanZoomController::GetSecondTapTole
 }
 
 /* static */AsyncPanZoomController::PinchLockMode AsyncPanZoomController::GetPinchLockMode()
 {
   return static_cast<PinchLockMode>(gfxPrefs::APZPinchLockMode());
 }
 
 bool
-AsyncPanZoomController::ArePointerEventsConsumable(TouchBlockState* aBlock, const MultiTouchInput& aInput) {
-  uint32_t touchPoints = aInput.mTouches.Length();
-  if (touchPoints == 0) {
+AsyncPanZoomController::ArePointerEventsConsumable(TouchBlockState* aBlock, uint32_t aTouchPoints) {
+  if (aTouchPoints == 0) {
     // Cant' do anything with zero touch points
     return false;
   }
 
-  // This logic is simplified, erring on the side of returning true if we're
-  // not sure. It's safer to pretend that we can consume the event and then
-  // not be able to than vice-versa. But at the same time, we should try hard
-  // to return an accurate result, because returning true can trigger a
-  // pointercancel event to web content, which can break certain features
-  // that are using touch-action and handling the pointermove events.
-  //
+  // This logic is simplified, erring on the side of returning true
+  // if we're not sure. It's safer to pretend that we can consume the
+  // event and then not be able to than vice-versa.
   // We could probably enhance this logic to determine things like "we're
   // not pannable, so we can only zoom in, and the zoom is already maxed
   // out, so we're not zoomable either" but no need for that at this point.
 
-  bool pannableX = aBlock->TouchActionAllowsPanningX() &&
-      aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(this, ScrollDirection::eHorizontal);
-  bool pannableY = aBlock->TouchActionAllowsPanningY() &&
-      aBlock->GetOverscrollHandoffChain()->CanScrollInDirection(this, ScrollDirection::eVertical);
-
-  bool pannable;
-
-  Maybe<ScrollDirection> panDirection = aBlock->GetBestGuessPanDirection(aInput);
-  if (panDirection == Some(ScrollDirection::eVertical)) {
-    pannable = pannableY;
-  } else if (panDirection == Some(ScrollDirection::eHorizontal)) {
-    pannable = pannableX;
-  } else {
-    // If we don't have a guessed pan direction, err on the side of returning true.
-    pannable = pannableX || pannableY;
-  }
-
-  if (touchPoints == 1) {
-    return pannable;
-  }
-
+  bool pannable = aBlock->GetOverscrollHandoffChain()->CanBePanned(this);
   bool zoomable = mZoomConstraints.mAllowZoom;
+
+  pannable &= (aBlock->TouchActionAllowsPanningX() || aBlock->TouchActionAllowsPanningY());
   zoomable &= (aBlock->TouchActionAllowsPinchZoom());
 
-  return pannable || zoomable;
+  // XXX once we fix bug 1031443, consumable should be assigned
+  // pannable || zoomable if aTouchPoints > 1.
+  bool consumable = (aTouchPoints == 1 ? pannable : zoomable);
+  if (!consumable) {
+    return false;
+  }
+
+  return true;
 }
 
 nsEventStatus AsyncPanZoomController::HandleDragEvent(const MouseInput& aEvent,
                                                       const AsyncDragMetrics& aDragMetrics,
                                                       CSSCoord aInitialThumbPos)
 {
   if (!gfxPrefs::APZDragEnabled()) {
     return nsEventStatus_eIgnore;
@@ -2760,44 +2760,44 @@ void AsyncPanZoomController::HandlePanni
   RefPtr<const OverscrollHandoffChain> overscrollHandoffChain =
     GetCurrentInputBlock()->GetOverscrollHandoffChain();
   bool canScrollHorizontal = !mX.IsAxisLocked() &&
     overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::eHorizontal);
   bool canScrollVertical = !mY.IsAxisLocked() &&
     overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::eVertical);
   if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
     if (canScrollHorizontal && canScrollVertical) {
-      if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
+      if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
         mY.SetAxisLocked(true);
         SetState(PANNING_LOCKED_X);
-      } else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
+      } else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
         mX.SetAxisLocked(true);
         SetState(PANNING_LOCKED_Y);
       } else {
         SetState(PANNING);
       }
     } else if (canScrollHorizontal || canScrollVertical) {
       SetState(PANNING);
     } else {
       SetState(NOTHING);
     }
   } else if (GetCurrentTouchBlock()->TouchActionAllowsPanningX()) {
     // Using bigger angle for panning to keep behavior consistent
     // with IE.
-    if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
+    if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
       mY.SetAxisLocked(true);
       SetState(PANNING_LOCKED_X);
       mPanDirRestricted = true;
     } else {
       // Don't treat these touches as pan/zoom movements since 'touch-action' value
       // requires it.
       SetState(NOTHING);
     }
   } else if (GetCurrentTouchBlock()->TouchActionAllowsPanningY()) {
-    if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
+    if (IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
       mX.SetAxisLocked(true);
       SetState(PANNING_LOCKED_Y);
       mPanDirRestricted = true;
     } else {
       SetState(NOTHING);
     }
   } else {
     SetState(NOTHING);
@@ -2818,22 +2818,22 @@ void AsyncPanZoomController::HandlePanni
     GetCurrentInputBlock()->GetOverscrollHandoffChain();
   bool canScrollHorizontal = !mX.IsAxisLocked() &&
     overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::eHorizontal);
   bool canScrollVertical = !mY.IsAxisLocked() &&
     overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::eVertical);
 
   if (!canScrollHorizontal || !canScrollVertical) {
     SetState(PANNING);
-  } else if (apz::IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
+  } else if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
     mY.SetAxisLocked(true);
     if (canScrollHorizontal) {
       SetState(PANNING_LOCKED_X);
     }
-  } else if (apz::IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
+  } else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
     mX.SetAxisLocked(true);
     if (canScrollVertical) {
       SetState(PANNING_LOCKED_Y);
     }
   } else {
     SetState(PANNING);
   }
 }
@@ -2844,22 +2844,22 @@ void AsyncPanZoomController::HandlePanni
 
     double angle = atan2(aPanDistance.y, aPanDistance.x); // range [-pi, pi]
     angle = fabs(angle); // range [0, pi]
 
     float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * GetDPI();
 
     if (fabs(aPanDistance.x) > breakThreshold || fabs(aPanDistance.y) > breakThreshold) {
       if (mState == PANNING_LOCKED_X) {
-        if (!apz::IsCloseToHorizontal(angle, gfxPrefs::APZAxisBreakoutAngle())) {
+        if (!IsCloseToHorizontal(angle, gfxPrefs::APZAxisBreakoutAngle())) {
           mY.SetAxisLocked(false);
           SetState(PANNING);
         }
       } else if (mState == PANNING_LOCKED_Y) {
-        if (!apz::IsCloseToVertical(angle, gfxPrefs::APZAxisBreakoutAngle())) {
+        if (!IsCloseToVertical(angle, gfxPrefs::APZAxisBreakoutAngle())) {
           mX.SetAxisLocked(false);
           SetState(PANNING);
         }
       }
     }
   }
 }
 
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -1210,22 +1210,22 @@ private:
 public:
   /**
    * Flush a repaint request if one is needed, without throttling it with the
    * paint throttler.
    */
   void FlushRepaintForNewInputBlock();
 
   /**
-   * Given an input event and the touch block it belongs to, check if the
-   * event can lead to a panning/zooming behavior.
+   * Given the number of touch points in an input event and touch block they
+   * belong to, check if the event can result in a panning/zooming behavior.
    * This is primarily used to figure out when to dispatch the pointercancel
    * event for the pointer events spec.
    */
-  bool ArePointerEventsConsumable(TouchBlockState* aBlock, const MultiTouchInput& aInput);
+  bool ArePointerEventsConsumable(TouchBlockState* aBlock, uint32_t aTouchPoints);
 
   /**
    * Clear internal state relating to touch input handling.
    */
   void ResetTouchInputState();
 
   /**
    * Gets a ref to the input queue that is shared across the entire tree manager.
--- a/gfx/layers/apz/src/InputBlockState.cpp
+++ b/gfx/layers/apz/src/InputBlockState.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "InputBlockState.h"
 
-#include "APZUtils.h"
 #include "AsyncPanZoomController.h"         // for AsyncPanZoomController
 #include "ScrollAnimationPhysics.h"         // for kScrollSeriesTimeoutMs
 #include "gfxPrefs.h"                       // for gfxPrefs
 #include "mozilla/MouseEvents.h"
 #include "mozilla/Telemetry.h"              // for Telemetry
 #include "mozilla/layers/IAPZCTreeManager.h" // for AllowedTouchBehavior
 #include "OverscrollHandoffState.h"
 #include "QueuedInput.h"
@@ -905,39 +904,16 @@ TouchBlockState::UpdateSlopState(const M
       // this block
       TBS_LOG("%p exiting slop\n", this);
       mInSlop = false;
     }
   }
   return mInSlop;
 }
 
-Maybe<ScrollDirection>
-TouchBlockState::GetBestGuessPanDirection(const MultiTouchInput& aInput)
-{
-  if (aInput.mType != MultiTouchInput::MULTITOUCH_MOVE ||
-      aInput.mTouches.Length() != 1) {
-    return Nothing();
-  }
-  ScreenPoint vector = aInput.mTouches[0].mScreenPoint - mSlopOrigin;
-  double angle = atan2(vector.y, vector.x); // range [-pi, pi]
-  angle = fabs(angle); // range [0, pi]
-
-  double angleThreshold = TouchActionAllowsPanningXY()
-      ? gfxPrefs::APZAxisLockAngle()
-      : gfxPrefs::APZAllowedDirectPanAngle();
-  if (apz::IsCloseToHorizontal(angle, angleThreshold)) {
-    return Some(ScrollDirection::eHorizontal);
-  }
-  if (apz::IsCloseToVertical(angle, angleThreshold)) {
-    return Some(ScrollDirection::eVertical);
-  }
-  return Nothing();
-}
-
 uint32_t
 TouchBlockState::GetActiveTouchCount() const
 {
   return mTouchCounter.GetActiveTouchCount();
 }
 
 KeyboardBlockState::KeyboardBlockState(const RefPtr<AsyncPanZoomController>& aTargetApzc)
   : InputBlockState(aTargetApzc, TargetConfirmationFlags{true})
--- a/gfx/layers/apz/src/InputBlockState.h
+++ b/gfx/layers/apz/src/InputBlockState.h
@@ -480,23 +480,16 @@ public:
    * the slop area is - if this is true the slop area is larger.
    * @return true iff the provided event is a touchmove in the slop area and
    *         so should not be sent to content.
    */
   bool UpdateSlopState(const MultiTouchInput& aInput,
                        bool aApzcCanConsumeEvents);
 
   /**
-   * Based on the slop origin and the given input event, return a best guess
-   * as to the pan direction of this touch block. Returns Nothing() if no guess
-   * can be made.
-   */
-  Maybe<ScrollDirection> GetBestGuessPanDirection(const MultiTouchInput& aInput);
-
-  /**
    * Returns the number of touch points currently active.
    */
   uint32_t GetActiveTouchCount() const;
 
   void DispatchEvent(const InputData& aEvent) const override;
   bool MustStayActive() override;
   const char* Type() override;
 
--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -146,17 +146,17 @@ InputQueue::ReceiveTouchInput(const RefP
   nsEventStatus result = nsEventStatus_eIgnore;
 
   // XXX calling ArePointerEventsConsumable on |target| may be wrong here if
   // the target isn't confirmed and the real target turns out to be something
   // else. For now assume this is rare enough that it's not an issue.
   if (block->IsDuringFastFling()) {
     INPQ_LOG("dropping event due to block %p being in fast motion\n", block);
     result = nsEventStatus_eConsumeNoDefault;
-  } else if (target && target->ArePointerEventsConsumable(block, aEvent)) {
+  } else if (target && target->ArePointerEventsConsumable(block, aEvent.mTouches.Length())) {
     if (block->UpdateSlopState(aEvent, true)) {
       INPQ_LOG("dropping event due to block %p being in slop\n", block);
       result = nsEventStatus_eConsumeNoDefault;
     } else {
       result = nsEventStatus_eConsumeDoDefault;
     }
   } else if (block->UpdateSlopState(aEvent, false)) {
     INPQ_LOG("dropping event due to block %p being in mini-slop\n", block);