Backed out 3 changesets (bug 1525570) for mochitest failures in gfx/layers/apz/test/mochitest/test_group_zoom.html | helper_zoom_prevented.html
authorDorel Luca <dluca@mozilla.com>
Fri, 01 Mar 2019 23:28:36 +0200
changeset 519910 48b049ff10f16c25a2ac43812d8087a044bd04ca
parent 519909 1712a35cd239049c186f7da80cdc759885ae81ae
child 519911 85fce02180b629cd6db4261c5730b61f5dc5a53e
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1525570
milestone67.0a1
backs outee394d0b085d8c44884284246841b98f45c884dc
77625f533af6a3628ad4203530dbe1b4526aceb6
cd326f5e4eb883c0daa8dd5022c99fc886dda9bf
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 1525570) for mochitest failures in gfx/layers/apz/test/mochitest/test_group_zoom.html | helper_zoom_prevented.html Backed out changeset ee394d0b085d (bug 1525570) Backed out changeset 77625f533af6 (bug 1525570) Backed out changeset cd326f5e4eb8 (bug 1525570)
gfx/layers/apz/src/APZCTreeManager.h
gfx/layers/apz/src/InputBlockState.h
gfx/layers/apz/src/InputQueue.h
gfx/layers/apz/src/TouchCounter.cpp
gfx/layers/apz/src/TouchCounter.h
gfx/layers/apz/test/mochitest/helper_zoom_prevented.html
gfx/layers/apz/test/mochitest/test_group_zoom.html
gfx/layers/apz/util/APZEventState.cpp
gfx/layers/apz/util/APZEventState.h
gfx/layers/apz/util/TouchCounter.cpp
gfx/layers/apz/util/TouchCounter.h
gfx/layers/moz.build
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -15,22 +15,22 @@
 #include "mozilla/gfx/CompositorHitTestInfo.h"
 #include "mozilla/gfx/Logging.h"              // for gfx::TreeLog
 #include "mozilla/gfx/Matrix.h"               // for Matrix4x4
 #include "mozilla/layers/APZInputBridge.h"    // for APZInputBridge
 #include "mozilla/layers/APZTestData.h"       // for APZTestData
 #include "mozilla/layers/IAPZCTreeManager.h"  // for IAPZCTreeManager
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/KeyboardMap.h"  // for KeyboardMap
-#include "mozilla/layers/TouchCounter.h" // for TouchCounter
 #include "mozilla/RecursiveMutex.h"      // for RecursiveMutex
 #include "mozilla/RefPtr.h"              // for RefPtr
 #include "mozilla/TimeStamp.h"           // for mozilla::TimeStamp
 #include "mozilla/UniquePtr.h"           // for UniquePtr
 #include "nsCOMPtr.h"                    // for already_AddRefed
+#include "TouchCounter.h"                // for TouchCounter
 
 #if defined(MOZ_WIDGET_ANDROID)
 #  include "mozilla/layers/AndroidDynamicToolbarAnimator.h"
 #endif  // defined(MOZ_WIDGET_ANDROID)
 
 namespace mozilla {
 class MultiTouchInput;
 
--- a/gfx/layers/apz/src/InputBlockState.h
+++ b/gfx/layers/apz/src/InputBlockState.h
@@ -9,19 +9,19 @@
 
 #include "InputData.h"           // for MultiTouchInput
 #include "mozilla/RefCounted.h"  // for RefCounted
 #include "mozilla/RefPtr.h"      // for RefPtr
 #include "mozilla/gfx/Matrix.h"  // for Matrix4x4
 #include "mozilla/layers/APZUtils.h"
 #include "mozilla/layers/LayersTypes.h"  // for TouchBehaviorFlags
 #include "mozilla/layers/AsyncDragMetrics.h"
-#include "mozilla/layers/TouchCounter.h"
 #include "mozilla/TimeStamp.h"  // for TimeStamp
 #include "nsTArray.h"           // for nsTArray
+#include "TouchCounter.h"
 
 namespace mozilla {
 namespace layers {
 
 class AsyncPanZoomController;
 class OverscrollHandoffChain;
 class CancelableBlockState;
 class TouchBlockState;
--- a/gfx/layers/apz/src/InputQueue.h
+++ b/gfx/layers/apz/src/InputQueue.h
@@ -6,20 +6,20 @@
 
 #ifndef mozilla_layers_InputQueue_h
 #define mozilla_layers_InputQueue_h
 
 #include "APZUtils.h"
 #include "DragTracker.h"
 #include "InputData.h"
 #include "mozilla/EventForwards.h"
-#include "mozilla/layers/TouchCounter.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/UniquePtr.h"
 #include "nsTArray.h"
+#include "TouchCounter.h"
 
 namespace mozilla {
 
 class InputData;
 class MultiTouchInput;
 class ScrollWheelInput;
 
 namespace layers {
rename from gfx/layers/apz/util/TouchCounter.cpp
rename to gfx/layers/apz/src/TouchCounter.cpp
--- a/gfx/layers/apz/util/TouchCounter.cpp
+++ b/gfx/layers/apz/src/TouchCounter.cpp
@@ -2,17 +2,16 @@
 /* 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 "TouchCounter.h"
 
 #include "InputData.h"
-#include "mozilla/TouchEvents.h"
 
 namespace mozilla {
 namespace layers {
 
 TouchCounter::TouchCounter() : mActiveTouchCount(0) {}
 
 void TouchCounter::Update(const MultiTouchInput& aInput) {
   switch (aInput.mType) {
@@ -20,47 +19,24 @@ void TouchCounter::Update(const MultiTou
       // touch-start event contains all active touches of the current session
       mActiveTouchCount = aInput.mTouches.Length();
       break;
     case MultiTouchInput::MULTITOUCH_END:
       if (mActiveTouchCount >= aInput.mTouches.Length()) {
         // touch-end event contains only released touches
         mActiveTouchCount -= aInput.mTouches.Length();
       } else {
-        NS_WARNING("Got an unexpected touchend");
+        NS_WARNING("Got an unexpected touchend/touchcancel");
         mActiveTouchCount = 0;
       }
       break;
     case MultiTouchInput::MULTITOUCH_CANCEL:
       mActiveTouchCount = 0;
       break;
     case MultiTouchInput::MULTITOUCH_MOVE:
       break;
   }
 }
 
-void TouchCounter::Update(const WidgetTouchEvent& aEvent) {
-  switch (aEvent.mMessage) {
-    case eTouchStart:
-      // touch-start event contains all active touches of the current session
-      mActiveTouchCount = aEvent.mTouches.Length();
-      break;
-    case eTouchEnd:
-      if (mActiveTouchCount >= aEvent.mTouches.Length()) {
-        // touch-end event contains only released touches
-        mActiveTouchCount -= aEvent.mTouches.Length();
-      } else {
-        NS_WARNING("Got an unexpected touchend");
-        mActiveTouchCount = 0;
-      }
-      break;
-    case eTouchCancel:
-      mActiveTouchCount = 0;
-      break;
-    default:
-      break;
-  }
-}
-
 uint32_t TouchCounter::GetActiveTouchCount() const { return mActiveTouchCount; }
 
 }  // namespace layers
 }  // namespace mozilla
rename from gfx/layers/apz/util/TouchCounter.h
rename to gfx/layers/apz/src/TouchCounter.h
--- a/gfx/layers/apz/util/TouchCounter.h
+++ b/gfx/layers/apz/src/TouchCounter.h
@@ -11,24 +11,21 @@
 
 namespace mozilla {
 
 class MultiTouchInput;
 
 namespace layers {
 
 // TouchCounter simply tracks the number of active touch points. Feed it
-// your input events to update the internal state. Generally you should
-// only be calling one of the Update functions, depending on which type
-// of touch inputs you have access to.
+// your input events to update the internal state.
 class TouchCounter {
  public:
   TouchCounter();
   void Update(const MultiTouchInput& aInput);
-  void Update(const WidgetTouchEvent& aEvent);
   uint32_t GetActiveTouchCount() const;
 
  private:
   uint32_t mActiveTouchCount;
 };
 
 }  // namespace layers
 }  // namespace mozilla
deleted file mode 100644
--- a/gfx/layers/apz/test/mochitest/helper_zoom_prevented.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <meta charset="utf-8">
-  <meta name="viewport" content="width=device-width">
-  <title>Checking prevent-default for zooming</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* testPreventDefault(testDriver, aTouchStartToCancel) {
-  var initial_resolution = getResolution();
-  ok(initial_resolution > 0,
-      "The initial_resolution is " + initial_resolution + ", which is some sane value");
-
-  // preventDefault exactly one touchstart based on the value of aTouchStartToCancel
-  var touchStartCount = 0;
-  var canceller = function(e) {
-    dump("touchstart listener hit, count: " + touchStartCount + "\n");
-    touchStartCount++;
-    if (touchStartCount == aTouchStartToCancel) {
-      dump("calling preventDefault on touchstart\n");
-      e.preventDefault();
-      document.documentElement.removeEventListener("touchstart", canceller, {passive: false});
-    }
-  };
-  document.documentElement.addEventListener("touchstart", canceller, {passive: false});
-
-  // Ensure that APZ gets updated hit-test info
-  yield waitForAllPaints(testDriver);
-
-  var zoom_in = [
-      [ { x: 125, y: 250 }, { x: 175, y: 350 } ],
-      [ { x: 120, y: 220 }, { x: 180, y: 380 } ],
-      [ { x: 115, y: 190 }, { x: 185, y: 410 } ],
-      [ { x: 110, y: 160 }, { x: 190, y: 440 } ],
-      [ { x: 105, y: 130 }, { x: 195, y: 470 } ],
-      [ { x: 100, y: 100 }, { x: 200, y: 500 } ],
-  ];
-
-  var touchIds = [0, 1];
-  yield* synthesizeNativeTouchSequences(document.body, zoom_in, null, touchIds);
-
-  // Flush state and get the resolution we're at now
-  yield waitForApzFlushedRepaints(testDriver);
-  let final_resolution = getResolution();
-  is(final_resolution, initial_resolution, "The final resolution (" + final_resolution + ") matches the initial resolution");
-}
-
-function* test(testDriver) {
-  // Register a listener that fails the test if the APZ:TransformEnd event fires,
-  // because this test shouldn't actually be triggering any transforms
-  SpecialPowers.Services.obs.addObserver(function() {
-    ok(false, "The test fired an unexpected APZ:TransformEnd");
-  }, "APZ:TransformEnd");
-
-  yield* testPreventDefault(testDriver, 1);
-  yield* testPreventDefault(testDriver, 2);
-}
-
-waitUntilApzStable()
-.then(runContinuation(test))
-.then(subtestDone);
-
-  </script>
-</head>
-<body>
-  Here is some text to stare at as the test runs. It serves no functional
-  purpose, but gives you an idea of the zoom level. It's harder to tell what
-  the zoom level is when the page is just solid white.
-</body>
-</html>
--- a/gfx/layers/apz/test/mochitest/test_group_zoom.html
+++ b/gfx/layers/apz/test/mochitest/test_group_zoom.html
@@ -27,33 +27,29 @@ var prefs = [
   // offset values.
   ["browser.chrome.dynamictoolbar", false],
   // Explicitly enable pinch-zooming, so this test can run on desktop
   // even though zooming isn't enabled by default on desktop yet.
   ["apz.allow_zooming", true],
   // Pinch-zooming currently requires meta viewport support (this requirement
   // will eventually be removed).
   ["dom.meta-viewport.enabled", true],
-  // Increase the content response timeout because some tests do preventDefault
-  // and we want to make sure APZ actually waits for them.
-  ["apz.content_response_timeout", 60000],
 ];
 
 // Increase the tap timeouts so the double-tap is still detected in case of
 // random delays during testing.
 var doubletap_prefs = [
   ...prefs,
   ["ui.click_hold_context_menus.delay", 10000],
   ["apz.max_tap_time", 10000],
 ];
 
 var subtests = [
   {"file": "helper_bug1280013.html", "prefs": prefs},
   {"file": "helper_basic_zoom.html", "prefs": prefs},
-  {"file": "helper_zoom_prevented.html", "prefs": prefs},
   {"file": "helper_zoomed_pan.html", "prefs": prefs},
   {"file": "helper_fixed_position_scroll_hittest.html", "prefs": prefs},
   {"file": "helper_basic_doubletap_zoom.html", "prefs": doubletap_prefs},
 ];
 
 if (isApzEnabled()) {
   // This has a lot of subtests, and Android emulators are slow.
   SimpleTest.requestLongerTimeout(2);
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -99,17 +99,16 @@ APZEventState::APZEventState(nsIWidget* 
                              ContentReceivedInputBlockCallback&& aCallback)
     : mWidget(nullptr)  // initialized in constructor body
       ,
       mActiveElementManager(new ActiveElementManager()),
       mContentReceivedInputBlockCallback(std::move(aCallback)),
       mPendingTouchPreventedResponse(false),
       mPendingTouchPreventedBlockId(0),
       mEndTouchIsClick(false),
-      mFirstTouchCancelled(false),
       mTouchEndCancelled(false),
       mLastTouchIdentifier(0) {
   nsresult rv;
   mWidget = do_GetWeakReference(aWidget, &rv);
   MOZ_ASSERT(NS_SUCCEEDED(rv),
              "APZEventState constructed with a widget that"
              " does not support weak references. APZ will NOT work!");
 
@@ -333,32 +332,16 @@ void APZEventState::ProcessTouchEvent(co
       sentContentResponse = SendPendingTouchPreventedResponse(false);
       // sentContentResponse can be true here if we get two TOUCH_STARTs in a
       // row and just responded to the first one.
 
       // We're about to send a response back to APZ, but we should only do it
       // for events that went through APZ (which should be all of them).
       MOZ_ASSERT(aEvent.mFlags.mHandledByAPZ);
 
-      // If the first touchstart event was preventDefaulted, ensure that any
-      // subsequent additional touchstart events also get preventDefaulted. This
-      // ensures that e.g. pinch zooming is prevented even if just the first
-      // touchstart was prevented by content.
-      if (mTouchCounter.GetActiveTouchCount() == 0) {
-        mFirstTouchCancelled = isTouchPrevented;
-      } else {
-        if (mFirstTouchCancelled && !isTouchPrevented) {
-          APZES_LOG(
-              "Propagating prevent-default from first-touch for block %" PRIu64
-              "\n",
-              aInputBlockId);
-        }
-        isTouchPrevented |= mFirstTouchCancelled;
-      }
-
       if (isTouchPrevented) {
         mContentReceivedInputBlockCallback(aGuid, aInputBlockId,
                                            isTouchPrevented);
         sentContentResponse = true;
       } else {
         APZES_LOG("Event not prevented; pending response for %" PRIu64 " %s\n",
                   aInputBlockId, Stringify(aGuid).c_str());
         mPendingTouchPreventedResponse = true;
@@ -385,21 +368,16 @@ void APZEventState::ProcessTouchEvent(co
       break;
     }
 
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown touch event type");
       break;
   }
 
-  mTouchCounter.Update(aEvent);
-  if (mTouchCounter.GetActiveTouchCount() == 0) {
-    mFirstTouchCancelled = false;
-  }
-
   if (sentContentResponse && !isTouchPrevented &&
       aApzResponse == nsEventStatus_eConsumeDoDefault &&
       gfxPrefs::PointerEventsEnabled()) {
     WidgetTouchEvent cancelEvent(aEvent);
     cancelEvent.mMessage = eTouchPointerCancel;
     cancelEvent.mFlags.mCancelable = false;  // mMessage != eTouchCancel;
     for (uint32_t i = 0; i < cancelEvent.mTouches.Length(); ++i) {
       if (mozilla::dom::Touch* touch = cancelEvent.mTouches[i]) {
--- a/gfx/layers/apz/util/APZEventState.h
+++ b/gfx/layers/apz/util/APZEventState.h
@@ -8,17 +8,16 @@
 #define mozilla_layers_APZEventState_h
 
 #include <stdint.h>
 
 #include "Units.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/layers/GeckoContentController.h"  // for APZStateChange
 #include "mozilla/layers/ScrollableLayerGuid.h"     // for ScrollableLayerGuid
-#include "mozilla/layers/TouchCounter.h"            // for TouchCounter
 #include "mozilla/RefPtr.h"
 #include "nsCOMPtr.h"
 #include "nsISupportsImpl.h"        // for NS_INLINE_DECL_REFCOUNTING
 #include "nsIWeakReferenceUtils.h"  // for nsWeakPtr
 
 #include <functional>
 
 template <class>
@@ -90,22 +89,20 @@ class APZEventState {
                              const nsCOMPtr<nsIWidget>& aWidget);
   already_AddRefed<nsIWidget> GetWidget() const;
   already_AddRefed<nsIContent> GetTouchRollup() const;
 
  private:
   nsWeakPtr mWidget;
   RefPtr<ActiveElementManager> mActiveElementManager;
   ContentReceivedInputBlockCallback mContentReceivedInputBlockCallback;
-  TouchCounter mTouchCounter;
   bool mPendingTouchPreventedResponse;
   ScrollableLayerGuid mPendingTouchPreventedGuid;
   uint64_t mPendingTouchPreventedBlockId;
   bool mEndTouchIsClick;
-  bool mFirstTouchCancelled;
   bool mTouchEndCancelled;
   int32_t mLastTouchIdentifier;
 
   // Because touch-triggered mouse events (e.g. mouse events from a tap
   // gesture) happen asynchronously from the touch events themselves, we
   // need to stash and replicate some of the state from the touch events
   // to the mouse events. One piece of state is the rollup content, which
   // is the content for which a popup window was recently closed. If we
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -113,17 +113,16 @@ EXPORTS.mozilla.layers += [
     'apz/util/APZEventState.h',
     'apz/util/APZThreadUtils.h',
     'apz/util/ChromeProcessController.h',
     'apz/util/ContentProcessController.h',
     'apz/util/DoubleTapToZoom.h',
     'apz/util/InputAPZContext.h',
     'apz/util/ScrollLinkedEffectDetector.h',
     'apz/util/TouchActionHelper.h',
-    'apz/util/TouchCounter.h',
     'AsyncCanvasRenderer.h',
     'AtomicRefCountedWithFinalize.h',
     'AxisPhysicsModel.h',
     'AxisPhysicsMSDModel.h',
     'basic/BasicCompositor.h',
     'basic/MacIOSurfaceTextureHostBasic.h',
     'basic/TextureHostBasic.h',
     'BSPTree.h',
@@ -332,30 +331,30 @@ UNIFIED_SOURCES += [
     'apz/src/InputQueue.cpp',
     'apz/src/KeyboardMap.cpp',
     'apz/src/KeyboardScrollAction.cpp',
     'apz/src/KeyboardScrollAnimation.cpp',
     'apz/src/OverscrollHandoffState.cpp',
     'apz/src/PotentialCheckerboardDurationTracker.cpp',
     'apz/src/QueuedInput.cpp',
     'apz/src/SimpleVelocityTracker.cpp',
+    'apz/src/TouchCounter.cpp',
     'apz/src/WheelScrollAnimation.cpp',
     'apz/testutil/APZTestData.cpp',
     'apz/util/ActiveElementManager.cpp',
     'apz/util/APZCCallbackHelper.cpp',
     'apz/util/APZEventState.cpp',
     'apz/util/APZThreadUtils.cpp',
     'apz/util/CheckerboardReportService.cpp',
     'apz/util/ChromeProcessController.cpp',
     'apz/util/ContentProcessController.cpp',
     'apz/util/DoubleTapToZoom.cpp',
     'apz/util/InputAPZContext.cpp',
     'apz/util/ScrollLinkedEffectDetector.cpp',
     'apz/util/TouchActionHelper.cpp',
-    'apz/util/TouchCounter.cpp',
     'AsyncCanvasRenderer.cpp',
     'AxisPhysicsModel.cpp',
     'AxisPhysicsMSDModel.cpp',
     'basic/BasicCanvasLayer.cpp',
     'basic/BasicColorLayer.cpp',
     'basic/BasicCompositor.cpp',
     'basic/BasicContainerLayer.cpp',
     'basic/BasicImages.cpp',