summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/apz')
-rw-r--r--gfx/layers/apz/src/APZCTreeManager.cpp56
-rw-r--r--gfx/layers/apz/src/APZCTreeManager.h9
-rw-r--r--gfx/layers/apz/src/APZUpdater.cpp30
-rw-r--r--gfx/layers/apz/src/AsyncPanZoomController.cpp46
-rw-r--r--gfx/layers/apz/src/AsyncPanZoomController.h2
-rw-r--r--gfx/layers/apz/src/AutoscrollAnimation.cpp2
-rw-r--r--gfx/layers/apz/src/GenericScrollAnimation.cpp9
-rw-r--r--gfx/layers/apz/src/GestureEventListener.cpp87
-rw-r--r--gfx/layers/apz/src/GestureEventListener.h3
-rw-r--r--gfx/layers/apz/test/gtest/TestGestureDetector.cpp236
-rw-r--r--gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js14
-rw-r--r--gfx/layers/apz/test/mochitest/apz_test_utils.js4
-rw-r--r--gfx/layers/apz/test/mochitest/browser.toml8
-rw-r--r--gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_oop_frame.js2
-rw-r--r--gfx/layers/apz/test/mochitest/browser_test_content_response_timeout.js1
-rw-r--r--gfx/layers/apz/test/mochitest/browser_test_scrolling_in_extension_popup_window.js2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_basic_scrollend.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_browser_test_utils.js2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1346632.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1414336.html6
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1502010_unconsumed_pan.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1506497_touch_action_fixed_on_fixed.html4
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1695598.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_content_response_timeout.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_displayport_expiry.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_fission_event_region_override.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_fission_scroll_oopif.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_fullscreen.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_deep_scene_stack.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_fixed-3.html4
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_fixed.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_hidden_inactive_scrollframe.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-2.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_overscroll_contextmenu.html4
-rw-r--r--gfx/layers/apz/test/mochitest/helper_hittest_overscroll_subframe.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_key_scroll.html4
-rw-r--r--gfx/layers/apz/test/mochitest/helper_main_thread_smooth_scroll_scrollend.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_minimum_scale_1_0.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_programmatic_scroll_behavior.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_touch_action_regions.html2
-rw-r--r--gfx/layers/apz/test/mochitest/helper_zoomed_pan.html4
-rw-r--r--gfx/layers/apz/test/mochitest/test_smoothness.html2
-rw-r--r--gfx/layers/apz/test/mochitest/test_touch_listeners_impacting_wheel.html4
-rw-r--r--gfx/layers/apz/test/reftest/reftest.list18
-rw-r--r--gfx/layers/apz/testutil/APZTestData.h6
-rw-r--r--gfx/layers/apz/util/APZCCallbackHelper.cpp3
-rw-r--r--gfx/layers/apz/util/APZEventState.cpp2
50 files changed, 481 insertions, 135 deletions
diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp
index d28392b716..ef3cde3596 100644
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -62,6 +62,8 @@
mozilla::LazyLogModule mozilla::layers::APZCTreeManager::sLog("apz.manager");
#define APZCTM_LOG(...) \
MOZ_LOG(APZCTreeManager::sLog, LogLevel::Debug, (__VA_ARGS__))
+#define APZCTM_LOGV(...) \
+ MOZ_LOG(APZCTreeManager::sLog, LogLevel::Verbose, (__VA_ARGS__))
static mozilla::LazyLogModule sApzKeyLog("apz.key");
#define APZ_KEY_LOG(...) MOZ_LOG(sApzKeyLog, LogLevel::Debug, (__VA_ARGS__))
@@ -83,10 +85,10 @@ typedef CompositorBridgeParent::LayerTreeState LayerTreeState;
struct APZCTreeManager::TreeBuildingState {
TreeBuildingState(LayersId aRootLayersId, bool aIsFirstPaint,
LayersId aOriginatingLayersId, APZTestData* aTestData,
- uint32_t aPaintSequence)
+ uint32_t aPaintSequence, bool aIsTestLoggingEnabled)
: mIsFirstPaint(aIsFirstPaint),
mOriginatingLayersId(aOriginatingLayersId),
- mPaintLogger(aTestData, aPaintSequence) {
+ mPaintLogger(aTestData, aPaintSequence, aIsTestLoggingEnabled) {
CompositorBridgeParent::CallWithIndirectShadowTree(
aRootLayersId, [this](LayerTreeState& aState) -> void {
mCompositorController = aState.GetCompositorController();
@@ -158,6 +160,9 @@ struct APZCTreeManager::TreeBuildingState {
// cumulative EventRegionsOverride flags from the reflayers, and is used to
// apply them to descendant layers.
std::stack<EventRegionsOverride> mOverrideFlags;
+
+ // Wether the APZC correspoinding to the originating LayersId was updated.
+ bool mOriginatingLayersIdUpdated = false;
};
class APZCTreeManager::CheckerboardFlushObserver : public nsIObserver {
@@ -391,8 +396,7 @@ void APZCTreeManager::SetAllowedTouchBehavior(
uint64_t aInputBlockId, const nsTArray<TouchBehaviorFlags>& aValues) {
if (!APZThreadUtils::IsControllerThread()) {
APZThreadUtils::RunOnControllerThread(
- NewRunnableMethod<uint64_t,
- StoreCopyPassByLRef<nsTArray<TouchBehaviorFlags>>>(
+ NewRunnableMethod<uint64_t, nsTArray<TouchBehaviorFlags>>(
"layers::APZCTreeManager::SetAllowedTouchBehavior", this,
&APZCTreeManager::SetAllowedTouchBehavior, aInputBlockId,
aValues.Clone()));
@@ -420,9 +424,11 @@ void APZCTreeManager::SetBrowserGestureResponse(
mInputQueue->SetBrowserGestureResponse(aInputBlockId, aResponse);
}
-void APZCTreeManager::UpdateHitTestingTree(
- const WebRenderScrollDataWrapper& aRoot, bool aIsFirstPaint,
- LayersId aOriginatingLayersId, uint32_t aPaintSequenceNumber) {
+APZCTreeManager::OriginatingLayersIdUpdated
+APZCTreeManager::UpdateHitTestingTree(const WebRenderScrollDataWrapper& aRoot,
+ bool aIsFirstPaint,
+ LayersId aOriginatingLayersId,
+ uint32_t aPaintSequenceNumber) {
AssertOnUpdaterThread();
RecursiveMutexAutoLock lock(mTreeLock);
@@ -430,7 +436,8 @@ void APZCTreeManager::UpdateHitTestingTree(
// For testing purposes, we log some data to the APZTestData associated with
// the layers id that originated this update.
APZTestData* testData = nullptr;
- if (StaticPrefs::apz_test_logging_enabled()) {
+ const bool testLoggingEnabled = StaticPrefs::apz_test_logging_enabled();
+ if (testLoggingEnabled) {
MutexAutoLock lock(mTestDataLock);
UniquePtr<APZTestData> ptr = MakeUnique<APZTestData>();
auto result =
@@ -440,7 +447,7 @@ void APZCTreeManager::UpdateHitTestingTree(
}
TreeBuildingState state(mRootLayersId, aIsFirstPaint, aOriginatingLayersId,
- testData, aPaintSequenceNumber);
+ testData, aPaintSequenceNumber, testLoggingEnabled);
// We do this business with collecting the entire tree into an array because
// otherwise it's very hard to determine which APZC instances need to be
@@ -730,6 +737,8 @@ void APZCTreeManager::UpdateHitTestingTree(
mRootNode->Dump(" ");
}
SendSubtreeTransformsToChromeMainThread(nullptr);
+
+ return OriginatingLayersIdUpdated{state.mOriginatingLayersIdUpdated};
}
void APZCTreeManager::UpdateFocusState(LayersId aRootLayerTreeId,
@@ -763,7 +772,7 @@ void APZCTreeManager::SampleForWebRender(const Maybe<VsyncId>& aVsyncId,
controller->ScheduleRenderOnCompositorThread(
wr::RenderReasons::ANIMATED_PROPERTY);
}
- APZCTM_LOG(
+ APZCTM_LOGV(
"APZCTreeManager(%p)::SampleForWebRender, want more composites: %d\n",
this, (activeAnimations && controller));
@@ -1231,6 +1240,10 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer(
"Found APZC %p for layer %p with identifiers %" PRIx64 " %" PRId64 "\n",
apzc.get(), aLayer.GetLayer(), uint64_t(guid.mLayersId), guid.mScrollId);
+ if (aLayersId == aState.mOriginatingLayersId) {
+ aState.mOriginatingLayersIdUpdated = true;
+ }
+
// If we haven't encountered a layer already with the same metrics, then we
// need to do the full reuse-or-make-an-APZC algorithm, which is contained
// inside the block below.
@@ -1522,6 +1535,11 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(
}
case MOUSE_INPUT: {
MouseInput& mouseInput = aEvent.AsMouseInput();
+ MOZ_LOG(APZCTreeManager::sLog,
+ mouseInput.mType == MouseInput::MOUSE_MOVE ? LogLevel::Verbose
+ : LogLevel::Debug,
+ ("Received mouse input type %d at %s\n", (int)mouseInput.mType,
+ ToString(mouseInput.mOrigin).c_str()));
mouseInput.mHandledByAPZ = true;
SetCurrentMousePosition(mouseInput.mOrigin);
@@ -1613,6 +1631,9 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(
// Do this before early return for Fission hit testing.
ScrollWheelInput& wheelInput = aEvent.AsScrollWheelInput();
+ APZCTM_LOG("Received wheel input at %s with delta (%f, %f)\n",
+ ToString(wheelInput.mOrigin).c_str(), wheelInput.mDeltaX,
+ wheelInput.mDeltaY);
state.mHit = GetTargetAPZC(wheelInput.mOrigin);
wheelInput.mHandledByAPZ = WillHandleInput(wheelInput);
@@ -1674,6 +1695,9 @@ APZEventResult APZCTreeManager::ReceiveInputEvent(
// Do this before early return for Fission hit testing.
PanGestureInput& panInput = aEvent.AsPanGestureInput();
+ APZCTM_LOG("Received pan gesture input type %d at %s with delta %s\n",
+ (int)panInput.mType, ToString(panInput.mPanStartPoint).c_str(),
+ ToString(panInput.mPanDisplacement).c_str());
state.mHit = GetTargetAPZC(panInput.mPanStartPoint);
panInput.mHandledByAPZ = WillHandleInput(panInput);
@@ -2021,6 +2045,18 @@ APZEventResult APZCTreeManager::InputHandlingState::Finish(
void APZCTreeManager::ProcessTouchInput(InputHandlingState& aState,
MultiTouchInput& aInput) {
+ APZCTM_LOG("Received touch input type %d with touch points [%s]\n",
+ (int)aInput.mType,
+ [&] {
+ nsCString result;
+ for (const auto& touch : aInput.mTouches) {
+ result.AppendPrintf("%s",
+ ToString(touch.mScreenPoint).c_str());
+ }
+ return result;
+ }()
+ .get());
+
aInput.mHandledByAPZ = true;
nsTArray<TouchBehaviorFlags> touchBehaviors;
HitTestingTreeNodeAutoLock hitScrollbarNode;
diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h
index ff9bba51ca..71d35fd5a6 100644
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -190,10 +190,13 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
* this layer update. Note that every child
* process' layer subtree has its own sequence
* numbers.
+ * @return OriginatingLayersIdUpdated whether the given
+ * |aOriginatingLayersId|'s data was processed.
*/
- void UpdateHitTestingTree(const WebRenderScrollDataWrapper& aRoot,
- bool aIsFirstPaint, LayersId aOriginatingLayersId,
- uint32_t aPaintSequenceNumber);
+ enum class OriginatingLayersIdUpdated : bool { No, Yes };
+ OriginatingLayersIdUpdated UpdateHitTestingTree(
+ const WebRenderScrollDataWrapper& aRoot, bool aIsFirstPaint,
+ LayersId aOriginatingLayersId, uint32_t aPaintSequenceNumber);
/**
* Called when webrender is enabled, from the sampler thread. This function
diff --git a/gfx/layers/apz/src/APZUpdater.cpp b/gfx/layers/apz/src/APZUpdater.cpp
index 2bbad6e1a7..2f1b551f3a 100644
--- a/gfx/layers/apz/src/APZUpdater.cpp
+++ b/gfx/layers/apz/src/APZUpdater.cpp
@@ -191,14 +191,38 @@ void APZUpdater::UpdateScrollDataAndTreeState(
auto isFirstPaint = aScrollData.IsFirstPaint();
auto paintSequenceNumber = aScrollData.GetPaintSequenceNumber();
+ auto previous = self->mScrollData.find(aOriginatingLayersId);
+ // If there's the previous scroll data which hasn't yet been
+ // processed, we need to merge the previous scroll position updates
+ // into the latest one.
+ if (previous != self->mScrollData.end()) {
+ WebRenderScrollData& previousData = previous->second;
+ if (previousData.GetWasUpdateSkipped()) {
+ MOZ_ASSERT(previousData.IsFirstPaint());
+ aScrollData.PrependUpdates(previousData);
+ }
+ }
+
self->mScrollData[aOriginatingLayersId] = std::move(aScrollData);
auto root = self->mScrollData.find(aRootLayerTreeId);
if (root == self->mScrollData.end()) {
return;
}
- self->mApz->UpdateHitTestingTree(
- WebRenderScrollDataWrapper(*self, &(root->second)),
- isFirstPaint, aOriginatingLayersId, paintSequenceNumber);
+ if ((self->mApz->UpdateHitTestingTree(
+ WebRenderScrollDataWrapper(*self, &(root->second)),
+ isFirstPaint, aOriginatingLayersId, paintSequenceNumber) ==
+ APZCTreeManager::OriginatingLayersIdUpdated::No) &&
+ isFirstPaint) {
+ // If the given |aOriginatingLayersId| data wasn't used for
+ // updating, it's likly that the parent process hasn't yet
+ // received the LayersId as "ReferentId", thus we need to process
+ // it in a subsequent update where we got the "ReferentId".
+ //
+ // NOTE: We restrict the above previous scroll data prepending to
+ // the first paint case, otherwise the cumulative scroll data may
+ // be exploded if we have never received the "ReferenceId".
+ self->mScrollData[aOriginatingLayersId].SetWasUpdateSkipped();
+ }
}));
}
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp
index 342375c019..edbd2ecffa 100644
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -106,6 +106,10 @@ static mozilla::LazyLogModule sApzCtlLog("apz.controller");
APZC_LOG("%p(%s scrollId=%" PRIu64 "): " fmt, (apzc), \
(apzc)->IsRootContent() ? "root" : "subframe", \
(apzc)->GetScrollId(), ##__VA_ARGS__)
+#define APZC_LOGV_DETAIL(fmt, apzc, ...) \
+ APZC_LOGV("%p(%s scrollId=%" PRIu64 "): " fmt, (apzc), \
+ (apzc)->IsRootContent() ? "root" : "subframe", \
+ (apzc)->GetScrollId(), ##__VA_ARGS__)
#define APZC_LOG_FM_COMMON(fm, prefix, level, ...) \
if (MOZ_LOG_TEST(sApzCtlLog, level)) { \
@@ -2248,6 +2252,11 @@ CSSRect AsyncPanZoomController::GetCurrentScrollRangeInCssPixels() const {
return Metrics().CalculateScrollRange();
}
+bool AsyncPanZoomController::AllowOneTouchPinch() const {
+ return StaticPrefs::apz_one_touch_pinch_enabled() &&
+ ZoomConstraintsAllowZoom();
+}
+
// Return whether or not the underlying layer can be scrolled on either axis.
bool AsyncPanZoomController::CanScroll(const InputData& aEvent) const {
ParentLayerPoint delta = GetDeltaForEvent(aEvent);
@@ -4734,7 +4743,7 @@ bool AsyncPanZoomController::UpdateAnimation(
// Even if there's no animation, if we have a scroll offset change pending due
// to the frame delay, we need to keep compositing.
if (mLastSampleTime == aSampleTime) {
- APZC_LOG_DETAIL(
+ APZC_LOGV_DETAIL(
"UpdateAnimation short-circuit, animation=%p, pending frame-delayed "
"offset=%d\n",
this, mAnimation.get(), HavePendingFrameDelayedOffset());
@@ -4754,8 +4763,8 @@ bool AsyncPanZoomController::UpdateAnimation(
// so that e.g. a main-thread animation can stay in sync with user-driven
// scrolling or a compositor animation.
bool needComposite = SampleCompositedAsyncTransform(aProofOfLock);
- APZC_LOG_DETAIL("UpdateAnimation needComposite=%d mAnimation=%p\n", this,
- needComposite, mAnimation.get());
+ APZC_LOGV_DETAIL("UpdateAnimation needComposite=%d mAnimation=%p\n", this,
+ needComposite, mAnimation.get());
TimeDuration sampleTimeDelta = aSampleTime - mLastSampleTime;
mLastSampleTime = aSampleTime;
@@ -5581,17 +5590,6 @@ void AsyncPanZoomController::NotifyLayersUpdated(
aScrollMetadata.GetOverscrollBehavior());
}
- if (needToReclampScroll) {
- // Whenever scrollable rect or composition bounds has changed, we need to
- // re-clamp the scroll offset since it may be out of bounds. Also note that
- // we need to re-clamp before updating new scroll offsets from content since
- // we will use the last scroll offset to reflect the new offsets.
- ClampAndSetVisualScrollOffset(Metrics().GetVisualScrollOffset());
- for (auto& sampledState : mSampledState) {
- sampledState.ClampVisualScrollOffset(Metrics());
- }
- }
-
bool instantScrollMayTriggerTransform = false;
bool scrollOffsetUpdated = false;
bool smoothScrollRequested = false;
@@ -5738,20 +5736,11 @@ void AsyncPanZoomController::NotifyLayersUpdated(
relativeDelta =
Some(Metrics().ApplyPureRelativeScrollUpdateFrom(scrollUpdate));
Metrics().RecalculateLayoutViewportOffset();
- } else if (scrollUpdate.GetType() == ScrollUpdateType::MergeableAbsolute) {
- APZC_LOG("%p mergeable updating scroll offset from %s to %s\n", this,
- ToString(Metrics().GetVisualScrollOffset()).c_str(),
- ToString(scrollUpdate.GetDestination()).c_str());
- relativeDelta =
- Some(Metrics().ApplyAbsoluteScrollUpdateFrom(scrollUpdate).second);
- Metrics().RecalculateLayoutViewportOffset();
- scrollOffsetUpdated = true;
} else {
APZC_LOG("%p updating scroll offset from %s to %s\n", this,
ToString(Metrics().GetVisualScrollOffset()).c_str(),
ToString(scrollUpdate.GetDestination()).c_str());
- auto [offsetChanged, _] =
- Metrics().ApplyAbsoluteScrollUpdateFrom(scrollUpdate);
+ bool offsetChanged = Metrics().ApplyScrollUpdateFrom(scrollUpdate);
Metrics().RecalculateLayoutViewportOffset();
if (offsetChanged || scrollUpdate.GetMode() != ScrollMode::Instant ||
@@ -5788,6 +5777,15 @@ void AsyncPanZoomController::NotifyLayersUpdated(
}
}
+ if (aIsFirstPaint || needToReclampScroll) {
+ // The scrollable rect or composition bounds may have changed in a way that
+ // makes our local scroll offset out of bounds, so clamp it.
+ ClampAndSetVisualScrollOffset(Metrics().GetVisualScrollOffset());
+ for (auto& sampledState : mSampledState) {
+ sampledState.ClampVisualScrollOffset(Metrics());
+ }
+ }
+
if (scrollOffsetUpdated) {
for (auto& sampledState : mSampledState) {
if (!didCancelAnimation && cumulativeRelativeDelta.isSome()) {
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h
index fdc72b1971..d0c4537a66 100644
--- a/gfx/layers/apz/src/AsyncPanZoomController.h
+++ b/gfx/layers/apz/src/AsyncPanZoomController.h
@@ -1305,6 +1305,8 @@ class AsyncPanZoomController {
*/
CSSRect GetCurrentScrollRangeInCssPixels() const;
+ bool AllowOneTouchPinch() const;
+
private:
/**
* Advances to the next sample, if there is one, the list of sampled states
diff --git a/gfx/layers/apz/src/AutoscrollAnimation.cpp b/gfx/layers/apz/src/AutoscrollAnimation.cpp
index 8d4b8fca10..45063ef2b4 100644
--- a/gfx/layers/apz/src/AutoscrollAnimation.cpp
+++ b/gfx/layers/apz/src/AutoscrollAnimation.cpp
@@ -17,7 +17,7 @@ namespace mozilla {
namespace layers {
// Helper function for AutoscrollAnimation::DoSample().
-// Basically copied as-is from toolkit/actors/AutoScrollChild.jsm.
+// Basically copied as-is from toolkit/actors/AutoScrollChild.sys.mjs.
static float Accelerate(ScreenCoord curr, ScreenCoord start) {
static const int speed = 12;
float val = (curr - start) / speed;
diff --git a/gfx/layers/apz/src/GenericScrollAnimation.cpp b/gfx/layers/apz/src/GenericScrollAnimation.cpp
index 04ca8c4697..62f19fab35 100644
--- a/gfx/layers/apz/src/GenericScrollAnimation.cpp
+++ b/gfx/layers/apz/src/GenericScrollAnimation.cpp
@@ -15,6 +15,9 @@
#include "ScrollAnimationMSDPhysics.h"
#include "mozilla/StaticPrefs_general.h"
+static mozilla::LazyLogModule sApzScrollAnimLog("apz.scrollanimation");
+#define GSA_LOG(...) MOZ_LOG(sApzScrollAnimLog, LogLevel::Debug, (__VA_ARGS__))
+
namespace mozilla {
namespace layers {
@@ -101,6 +104,12 @@ bool GenericScrollAnimation::DoSample(FrameMetrics& aFrameMetrics,
// then end the animation early. Note that the initial displacement could be 0
// if the compositor ran very quickly (<1ms) after the animation was created.
// When that happens we want to make sure the animation continues.
+ GSA_LOG(
+ "Sampling GenericScrollAnimation: time %f finished %d sampledDest %s "
+ "adjustedOffset %s overscroll %s\n",
+ (now - TimeStamp::ProcessCreation()).ToMilliseconds(), finished,
+ ToString(CSSPoint::FromAppUnits(sampledDest)).c_str(),
+ ToString(adjustedOffset).c_str(), ToString(overscroll).c_str());
if (!IsZero(displacement / zoom) && IsZero(adjustedOffset / zoom)) {
// Nothing more to do - end the animation.
return false;
diff --git a/gfx/layers/apz/src/GestureEventListener.cpp b/gfx/layers/apz/src/GestureEventListener.cpp
index b54674b593..4300e9ba41 100644
--- a/gfx/layers/apz/src/GestureEventListener.cpp
+++ b/gfx/layers/apz/src/GestureEventListener.cpp
@@ -5,13 +5,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GestureEventListener.h"
-#include <algorithm> // for max
+#include <algorithm> // for max
+#include <ostream>
#include <math.h> // for fabsf
#include <stddef.h> // for size_t
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "InputBlockState.h" // for TouchBlockState
#include "base/task.h" // for CancelableTask, etc
#include "InputBlockState.h" // for TouchBlockState
+#include "mozilla/Assertions.h"
+#include "mozilla/EventForwards.h"
#include "mozilla/StaticPrefs_apz.h"
#include "mozilla/StaticPrefs_ui.h"
#include "nsDebug.h" // for NS_WARNING
@@ -83,8 +86,8 @@ GestureEventListener::~GestureEventListener() = default;
nsEventStatus GestureEventListener::HandleInputEvent(
const MultiTouchInput& aEvent) {
- GEL_LOG("Receiving event type %d with %zu touches in state %d\n",
- aEvent.mType, aEvent.mTouches.Length(), mState);
+ GEL_LOG("Receiving event type %d with %zu touches in state %s\n",
+ aEvent.mType, aEvent.mTouches.Length(), ToString(mState).c_str());
nsEventStatus rv = nsEventStatus_eIgnore;
@@ -175,16 +178,15 @@ nsEventStatus GestureEventListener::HandleInputTouchSingleStart() {
EnterFirstSingleTouchDown();
break;
case GESTURE_FIRST_SINGLE_TOUCH_UP:
+ // Bail out of any gesture that includes the first tap.
+ CancelLongTapTimeoutTask();
+ CancelMaxTapTimeoutTask();
if (SecondTapIsFar()) {
- // If the second tap goes down far away from the first, then bail out
- // of any gesture that includes the first tap.
- CancelLongTapTimeoutTask();
- CancelMaxTapTimeoutTask();
- mSingleTapSent = Nothing();
-
- // But still allow the second tap to participate in a gesture
+ // If the second tap goes down far away from the first,
+ // allow the second tap to participate in a gesture
// (e.g. lead to a single tap, or a double tap if an additional
// tap occurs near the same location).
+ mSingleTapSent = Nothing();
EnterFirstSingleTouchDown();
} else {
// Otherwise, reset the touch start position so that, if this turns into
@@ -225,9 +227,10 @@ nsEventStatus GestureEventListener::HandleInputTouchMultiStart() {
rv = nsEventStatus_eConsumeNoDefault;
break;
case GESTURE_FIRST_SINGLE_TOUCH_UP:
- case GESTURE_SECOND_SINGLE_TOUCH_DOWN:
// Cancel wait for double tap
CancelMaxTapTimeoutTask();
+ [[fallthrough]];
+ case GESTURE_SECOND_SINGLE_TOUCH_DOWN:
MOZ_ASSERT(mSingleTapSent.isSome());
if (!mSingleTapSent.value()) {
TriggerSingleTapConfirmedEvent();
@@ -307,12 +310,8 @@ nsEventStatus GestureEventListener::HandleInputTouchMove() {
// If touch has moved noticeably (within StaticPrefs::apz_max_tap_time()),
// change state.
if (MoveDistanceIsLarge()) {
- CancelLongTapTimeoutTask();
- CancelMaxTapTimeoutTask();
mSingleTapSent = Nothing();
- if (!StaticPrefs::apz_one_touch_pinch_enabled()) {
- // If the one-touch-pinch feature is disabled, bail out of the double-
- // tap gesture instead.
+ if (!mAsyncPanZoomController->AllowOneTouchPinch()) {
SetState(GESTURE_NONE);
break;
}
@@ -451,7 +450,6 @@ nsEventStatus GestureEventListener::HandleInputTouchEnd() {
}
case GESTURE_SECOND_SINGLE_TOUCH_DOWN: {
- CancelMaxTapTimeoutTask();
MOZ_ASSERT(mSingleTapSent.isSome());
mAsyncPanZoomController->HandleGestureEvent(CreateTapEvent(
mLastTouchInput, mSingleTapSent.value()
@@ -535,7 +533,9 @@ nsEventStatus GestureEventListener::HandleInputTouchCancel() {
}
void GestureEventListener::HandleInputTimeoutLongTap() {
- GEL_LOG("Running long-tap timeout task in state %d\n", mState);
+ MOZ_ASSERT(mState != GESTURE_SECOND_SINGLE_TOUCH_DOWN);
+ GEL_LOG("Running long-tap timeout task in state %s\n",
+ ToString(mState).c_str());
mLongTapTimeoutTask = nullptr;
@@ -559,14 +559,15 @@ void GestureEventListener::HandleInputTimeoutLongTap() {
}
void GestureEventListener::HandleInputTimeoutMaxTap(bool aDuringFastFling) {
- GEL_LOG("Running max-tap timeout task in state %d\n", mState);
+ MOZ_ASSERT(mState != GESTURE_SECOND_SINGLE_TOUCH_DOWN);
+ GEL_LOG("Running max-tap timeout task in state %s\n",
+ ToString(mState).c_str());
mMaxTapTimeoutTask = nullptr;
if (mState == GESTURE_FIRST_SINGLE_TOUCH_DOWN) {
SetState(GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN);
- } else if (mState == GESTURE_FIRST_SINGLE_TOUCH_UP ||
- mState == GESTURE_SECOND_SINGLE_TOUCH_DOWN) {
+ } else if (mState == GESTURE_FIRST_SINGLE_TOUCH_UP) {
MOZ_ASSERT(mSingleTapSent.isSome());
if (!aDuringFastFling && !mSingleTapSent.value()) {
TriggerSingleTapConfirmedEvent();
@@ -585,6 +586,8 @@ void GestureEventListener::TriggerSingleTapConfirmedEvent() {
}
void GestureEventListener::SetState(GestureState aState) {
+ GEL_LOG("State change from %s to %s", ToString(mState).c_str(),
+ ToString(aState).c_str());
mState = aState;
if (mState == GESTURE_NONE) {
@@ -598,10 +601,7 @@ void GestureEventListener::SetState(GestureState aState) {
}
void GestureEventListener::CancelLongTapTimeoutTask() {
- if (mState == GESTURE_SECOND_SINGLE_TOUCH_DOWN) {
- // being in this state means the task has been canceled already
- return;
- }
+ MOZ_ASSERT(mState != GESTURE_SECOND_SINGLE_TOUCH_DOWN);
if (mLongTapTimeoutTask) {
mLongTapTimeoutTask->Cancel();
@@ -628,6 +628,8 @@ void GestureEventListener::CreateLongTapTimeoutTask() {
}
void GestureEventListener::CancelMaxTapTimeoutTask() {
+ MOZ_ASSERT(mState != GESTURE_SECOND_SINGLE_TOUCH_DOWN);
+
if (mState == GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN) {
// being in this state means the timer has just been triggered
return;
@@ -659,5 +661,40 @@ void GestureEventListener::CreateMaxTapTimeoutTask() {
std::max(0L, remainingDelay));
}
+std::ostream& operator<<(std::ostream& os,
+ GestureEventListener::GestureState aState) {
+ switch (aState) {
+ case GestureEventListener::GESTURE_NONE:
+ os << "GESTURE_NONE";
+ break;
+ case GestureEventListener::GESTURE_FIRST_SINGLE_TOUCH_DOWN:
+ os << "GESTURE_FIRST_SINGLE_TOUCH_DOWN";
+ break;
+ case GestureEventListener::GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN:
+ os << "GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN";
+ break;
+ case GestureEventListener::GESTURE_FIRST_SINGLE_TOUCH_UP:
+ os << "GESTURE_FIRST_SINGLE_TOUCH_UP";
+ break;
+ case GestureEventListener::GESTURE_SECOND_SINGLE_TOUCH_DOWN:
+ os << "GESTURE_SECOND_SINGLE_TOUCH_DOWN";
+ break;
+ case GestureEventListener::GESTURE_LONG_TOUCH_DOWN:
+ os << "GESTURE_LONG_TOUCH_DOWN";
+ break;
+ case GestureEventListener::GESTURE_MULTI_TOUCH_DOWN:
+ os << "GESTURE_MULTI_TOUCH_DOWN";
+ break;
+ case GestureEventListener::GESTURE_PINCH:
+ os << "GESTURE_PINCH";
+ break;
+ case GestureEventListener::GESTURE_ONE_TOUCH_PINCH:
+ os << "GESTURE_ONE_TOUCH_PINCH";
+ break;
+ }
+
+ return os;
+}
+
} // namespace layers
} // namespace mozilla
diff --git a/gfx/layers/apz/src/GestureEventListener.h b/gfx/layers/apz/src/GestureEventListener.h
index aa51889fdd..bf50d4f40a 100644
--- a/gfx/layers/apz/src/GestureEventListener.h
+++ b/gfx/layers/apz/src/GestureEventListener.h
@@ -7,6 +7,7 @@
#ifndef mozilla_layers_GestureEventListener_h
#define mozilla_layers_GestureEventListener_h
+#include <iosfwd>
#include "InputData.h" // for MultiTouchInput, etc
#include "Units.h"
#include "mozilla/EventForwards.h" // for nsEventStatus
@@ -135,6 +136,8 @@ class GestureEventListener final {
GESTURE_ONE_TOUCH_PINCH
};
+ friend std::ostream& operator<<(std::ostream& os, GestureState aState);
+
/**
* These HandleInput* functions comprise input alphabet of the GEL
* finite-state machine triggering state transitions.
diff --git a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
index f244ca4dc7..8256667d6b 100644
--- a/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
+++ b/gfx/layers/apz/test/gtest/TestGestureDetector.cpp
@@ -21,12 +21,12 @@ class APZCGestureDetectorTester : public APZCBasicTester {
: APZCBasicTester(AsyncPanZoomController::USE_GESTURE_DETECTOR) {}
protected:
- FrameMetrics GetPinchableFrameMetrics() {
+ FrameMetrics GetPinchableFrameMetrics(float aZoom = 2.0f) {
FrameMetrics fm;
fm.SetCompositionBounds(ParentLayerRect(200, 200, 100, 200));
fm.SetScrollableRect(CSSRect(0, 0, 980, 1000));
fm.SetVisualScrollOffset(CSSPoint(300, 300));
- fm.SetZoom(CSSToParentLayerScale(2.0));
+ fm.SetZoom(CSSToParentLayerScale(aZoom));
// APZC only allows zooming on the root scrollable frame.
fm.SetIsRootContent(true);
// the visible area of the document in CSS pixels is x=300 y=300 w=50 h=100
@@ -843,3 +843,235 @@ TEST_F(APZCGestureDetectorTester, LongPressWithInputQueueDelay3) {
mcc->AdvanceByMillis(1);
check.Call("post long-tap dispatch");
}
+
+TEST_F(APZCGestureDetectorTester, OneTouchPinchGestureShort) {
+ // Take less than StaticPrefs::apz_max_tap_time() until second touch down,
+ // hold second touch down for a very short time, then move
+ // and expect a successful one touch pinch gesture
+ SCOPED_GFX_PREF_BOOL("apz.one_touch_pinch.enabled", true);
+
+ MakeApzcZoomable();
+ apzc->SetFrameMetrics(GetPinchableFrameMetrics());
+ const auto oldZoom = apzc->GetFrameMetrics().GetZoom().scale;
+
+ const auto tapResult =
+ Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(10));
+ apzc->SetAllowedTouchBehavior(tapResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(10);
+ const auto touchResult = TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time());
+ apzc->SetAllowedTouchBehavior(touchResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ // We should be able to hold down the second touch as long as we like
+ // before beginning to move
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 50), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchUp(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ const auto newZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ EXPECT_NE(newZoom, oldZoom);
+}
+
+TEST_F(APZCGestureDetectorTester, OneTouchPinchGestureLong) {
+ // Take less than StaticPrefs::apz_max_tap_time() until second touch down,
+ // hold second touch down for a long time, then move
+ // and expect a successful one touch pinch gesture
+ SCOPED_GFX_PREF_BOOL("apz.one_touch_pinch.enabled", true);
+
+ MakeApzcZoomable();
+ apzc->SetFrameMetrics(GetPinchableFrameMetrics());
+ const auto oldZoom = apzc->GetFrameMetrics().GetZoom().scale;
+
+ const auto tapResult =
+ Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(10));
+ apzc->SetAllowedTouchBehavior(tapResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() - 20);
+ const auto touchResult = TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time());
+ apzc->SetAllowedTouchBehavior(touchResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ // We should be able to hold down the second touch as long as we like
+ // before beginning to move
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() + 100);
+ TouchMove(apzc, ScreenIntPoint(10, 50), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchUp(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ const auto newZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ EXPECT_NE(newZoom, oldZoom);
+}
+
+TEST_F(APZCGestureDetectorTester, OneTouchPinchGestureNoMoveTriggersDoubleTap) {
+ // Take less than StaticPrefs::apz_max_tap_time() until second touch down,
+ // then wait longer than StaticPrefs::apz_max_tap_time(), lift finger up
+ // and expect a successful double tap. No zooming should be performed
+ // by the one-touch pinch codepath.
+ SCOPED_GFX_PREF_BOOL("apz.one_touch_pinch.enabled", true);
+
+ apzc->SetFrameMetrics(GetPinchableFrameMetrics());
+ const auto oldZoom = apzc->GetFrameMetrics().GetZoom().scale;
+
+ MakeApzcZoomable();
+
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, _, 0, apzc->GetGuid(), _, _))
+ .Times(0);
+ EXPECT_CALL(*mcc,
+ HandleTap(TapType::eDoubleTap, _, 0, apzc->GetGuid(), _, _));
+
+ const auto tapResult =
+ Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(10));
+ apzc->SetAllowedTouchBehavior(tapResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() - 20);
+ const auto touchResult = TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time());
+ apzc->SetAllowedTouchBehavior(touchResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ // We should be able to hold down the second touch as long as we like
+ // before lifting the finger
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() + 100);
+ TouchUp(apzc, ScreenIntPoint(10, 10), mcc->Time());
+
+ const auto newZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ EXPECT_EQ(newZoom, oldZoom);
+}
+
+TEST_F(APZCGestureDetectorTester, OneTouchPinchGestureNonZoomablePage) {
+ // Use a non-zoomable page. Perform a tap and a touch-drag
+ // which on a zoomable page trigger a one touch pinch gesture,
+ // and expect a single tap followed by a touch-scroll
+ SCOPED_GFX_PREF_BOOL("apz.one_touch_pinch.enabled", true);
+
+ apzc->SetFrameMetrics(GetPinchableFrameMetrics(1.0f));
+ const auto oldZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ const auto oldScrollOffset = apzc->GetFrameMetrics().GetVisualScrollOffset();
+ MakeApzcUnzoomable();
+
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, _, 0, apzc->GetGuid(), _, _))
+ .Times(1);
+ EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, _, 0, apzc->GetGuid(), _, _))
+ .Times(0);
+
+ const auto tapResult =
+ Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(10));
+ apzc->SetAllowedTouchBehavior(tapResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() - 20);
+ const auto touchResult = TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time());
+ apzc->SetAllowedTouchBehavior(touchResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ // We should be able to hold down the second touch as long as we like
+ // before beginning to move
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() + 100);
+ TouchMove(apzc, ScreenIntPoint(10, 50), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 100), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchUp(apzc, ScreenIntPoint(10, 100), mcc->Time());
+
+ const auto newZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ EXPECT_EQ(newZoom, oldZoom);
+
+ const auto newScrollOffset = apzc->GetFrameMetrics().GetVisualScrollOffset();
+ EXPECT_NE(newScrollOffset, oldScrollOffset);
+}
+
+TEST_F(APZCGestureDetectorTester, OneTouchPinchGestureTimeout) {
+ // Take longer than StaticPrefs::apz_max_tap_time() until second touch down
+ // and expect no one touch pinch gesture being performed
+ SCOPED_GFX_PREF_BOOL("apz.one_touch_pinch.enabled", true);
+
+ MakeApzcZoomable();
+ apzc->SetFrameMetrics(GetPinchableFrameMetrics());
+ const auto oldZoom = apzc->GetFrameMetrics().GetZoom().scale;
+
+ EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, _, 0, apzc->GetGuid(), _, _))
+ .Times(1);
+
+ const auto tapResult =
+ Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(10));
+ apzc->SetAllowedTouchBehavior(tapResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time());
+ const auto touchResult = TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time());
+ apzc->SetAllowedTouchBehavior(touchResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 50), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchUp(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ const auto newZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ EXPECT_EQ(newZoom, oldZoom);
+}
+
+TEST_F(APZCGestureDetectorTester, OneTouchPinchGestureDisabled) {
+ // With apz.one_touch_pinch disabled,
+ // perform one touch pinch gesture within the time threshold,
+ // and expect no zooming.
+ SCOPED_GFX_PREF_BOOL("apz.one_touch_pinch.enabled", false);
+
+ MakeApzcZoomable();
+ apzc->SetFrameMetrics(GetPinchableFrameMetrics());
+ const auto oldZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ const auto oldScrollOffset = apzc->GetFrameMetrics().GetVisualScrollOffset();
+
+ // todo: enable following EXPECT_CALLs when fixing bug 1881794
+ // EXPECT_CALL(*mcc, HandleTap(TapType::eSingleTap, _, 0, apzc->GetGuid(), _,
+ // _))
+ // .Times(1);
+ // EXPECT_CALL(*mcc, HandleTap(TapType::eDoubleTap, _, 0, apzc->GetGuid(), _,
+ // _))
+ // .Times(0);
+
+ const auto tapResult =
+ Tap(apzc, ScreenIntPoint(10, 10), TimeDuration::FromMilliseconds(10));
+ apzc->SetAllowedTouchBehavior(tapResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() - 20);
+ const auto touchResult = TouchDown(apzc, ScreenIntPoint(10, 10), mcc->Time());
+ apzc->SetAllowedTouchBehavior(touchResult.mInputBlockId,
+ {kDefaultTouchBehavior});
+
+ // We should be able to hold down the second touch as long as we like
+ // before beginning to move
+ mcc->AdvanceByMillis(StaticPrefs::apz_max_tap_time() + 100);
+ TouchMove(apzc, ScreenIntPoint(10, 50), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchMove(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ mcc->AdvanceByMillis(10);
+ TouchUp(apzc, ScreenIntPoint(10, 150), mcc->Time());
+
+ const auto newZoom = apzc->GetFrameMetrics().GetZoom().scale;
+ EXPECT_EQ(newZoom, oldZoom);
+
+ const auto newScrollOffset = apzc->GetFrameMetrics().GetVisualScrollOffset();
+ EXPECT_NE(newScrollOffset, oldScrollOffset);
+}
diff --git a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
index c290965845..1642bc147a 100644
--- a/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
@@ -498,7 +498,7 @@ async function promiseNativeTouchpadPanEventAndWaitForObserver(
return new Promise(resolve => {
var observer = {
- observe(aSubject, aTopic, aData) {
+ observe(aSubject, aTopic) {
if (aTopic == "touchpadpanevent") {
resolve();
}
@@ -557,7 +557,7 @@ function promiseNativePanGestureEventAndWaitForObserver(
) {
return new Promise(resolve => {
var observer = {
- observe(aSubject, aTopic, aData) {
+ observe(aSubject, aTopic) {
if (aTopic == "mousescrollevent") {
resolve();
}
@@ -588,7 +588,7 @@ function promiseNativeWheelAndWaitForObserver(
) {
return new Promise(resolve => {
var observer = {
- observe(aSubject, aTopic, aData) {
+ observe(aSubject, aTopic) {
if (aTopic == "mousescrollevent") {
resolve();
}
@@ -614,7 +614,7 @@ function promiseNativeWheelAndWaitForWheelEvent(
var targetWindow = windowForTarget(aTarget);
targetWindow.addEventListener(
"wheel",
- function (e) {
+ function () {
setTimeout(resolve, 0);
},
{ once: true }
@@ -1566,7 +1566,7 @@ function promiseScrollend(aTarget = window) {
function promiseTouchEnd(element, count = 1) {
return new Promise(resolve => {
var eventCount = 0;
- var counterFunction = function (e) {
+ var counterFunction = function () {
eventCount++;
if (eventCount == count) {
element.removeEventListener("touchend", counterFunction, {
@@ -1816,7 +1816,7 @@ async function panRightToLeftUpdate(aElement, aX, aY, aMultiplier) {
);
}
-async function panRightToLeftEnd(aElement, aX, aY, aMultiplier) {
+async function panRightToLeftEnd(aElement, aX, aY) {
await NativePanHandler.promiseNativePanEvent(
aElement,
aX,
@@ -1869,7 +1869,7 @@ async function panLeftToRightUpdate(aElement, aX, aY, aMultiplier) {
);
}
-async function panLeftToRightEnd(aElement, aX, aY, aMultiplier) {
+async function panLeftToRightEnd(aElement, aX, aY) {
await NativePanHandler.promiseNativePanEvent(
aElement,
aX,
diff --git a/gfx/layers/apz/test/mochitest/apz_test_utils.js b/gfx/layers/apz/test/mochitest/apz_test_utils.js
index 821c66103d..cdae7824b2 100644
--- a/gfx/layers/apz/test/mochitest/apz_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/apz_test_utils.js
@@ -309,7 +309,7 @@ function promiseAfterPaint() {
// occurred by the the returned promise resolves. If you want to wait
// for those repaints, consider using promiseApzFlushedRepaints instead.
function promiseOnlyApzControllerFlushedWithoutSetTimeout(aWindow = window) {
- return new Promise(function (resolve, reject) {
+ return new Promise(function (resolve) {
var repaintDone = function () {
dump("PromiseApzRepaintsFlushed: APZ flush done\n");
SpecialPowers.Services.obs.removeObserver(
@@ -518,7 +518,7 @@ function runSubtestsSeriallyInFreshWindows(aSubtests) {
if (test.onload) {
w.addEventListener(
"load",
- function (e) {
+ function () {
test.onload(w);
},
{ once: true }
diff --git a/gfx/layers/apz/test/mochitest/browser.toml b/gfx/layers/apz/test/mochitest/browser.toml
index 5432aa0ae1..67428eee23 100644
--- a/gfx/layers/apz/test/mochitest/browser.toml
+++ b/gfx/layers/apz/test/mochitest/browser.toml
@@ -19,7 +19,7 @@ support-files = ["helper_test_autoscrolling_in_oop_frame.html"]
support-files = ["helper_background_tab_load_scroll.html"]
["browser_test_background_tab_scroll.js"]
-skip-if = ["toolkit == 'android'"] # wheel events not supported on mobile
+skip-if = ["os == 'android'"] # wheel events not supported on mobile
support-files = ["helper_background_tab_scroll.html"]
["browser_test_content_response_timeout.js"]
@@ -28,7 +28,7 @@ support-files = ["helper_content_response_timeout.html"]
["browser_test_group_fission.js"]
skip-if = [
"win11_2009 && bits == 32", # intermittent failures on on win11/32
- "os == 'linux' && bits == 64", # Bug 1773830
+ "os == 'linux' && os_version == '18.04' && bits == 64", # Bug 1773830
]
support-files = [
"FissionTestHelperParent.sys.mjs",
@@ -49,7 +49,7 @@ support-files = ["helper_scroll_thumb_dragging.html"]
["browser_test_scrollbar_in_extension_popup_window.js"]
skip-if = [
"verify",
- "os == 'linux'" # Bug 1713052
+ "os == 'linux' && os_version == '18.04'" # Bug 1713052
]
["browser_test_scrolling_in_extension_popup_window.js"]
@@ -70,7 +70,7 @@ skip-if = ["os == 'win'"] # bug 1495580
support-files = ["helper_test_select_zoom.html"]
["browser_test_tab_drag_event_counts.js"]
-skip-if = ["os == 'linux'"] # No native key event support on Linux at this time (bug 1770143)
+skip-if = ["os == 'linux' && os_version == '18.04'"] # No native key event support on Linux at this time (bug 1770143)
support-files = [
"helper_test_tab_drag_event_counts.html"
]
diff --git a/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_oop_frame.js b/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_oop_frame.js
index 26d0ff6109..f7f83575f2 100644
--- a/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_oop_frame.js
+++ b/gfx/layers/apz/test/mochitest/browser_test_autoscrolling_in_oop_frame.js
@@ -74,7 +74,7 @@ async function doTest() {
return new Promise(resolve => {
content.addEventListener(
"scroll",
- event => {
+ () => {
dump("Got a scroll event in the iframe\n");
resolve();
},
diff --git a/gfx/layers/apz/test/mochitest/browser_test_content_response_timeout.js b/gfx/layers/apz/test/mochitest/browser_test_content_response_timeout.js
index a80fd77c17..98f6ea6c29 100644
--- a/gfx/layers/apz/test/mochitest/browser_test_content_response_timeout.js
+++ b/gfx/layers/apz/test/mochitest/browser_test_content_response_timeout.js
@@ -60,6 +60,7 @@ add_task(async () => {
);
await new Promise(resolve => {
+ // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
setTimeout(resolve, 200);
});
diff --git a/gfx/layers/apz/test/mochitest/browser_test_scrolling_in_extension_popup_window.js b/gfx/layers/apz/test/mochitest/browser_test_scrolling_in_extension_popup_window.js
index 6da3f3311b..9896e628e3 100644
--- a/gfx/layers/apz/test/mochitest/browser_test_scrolling_in_extension_popup_window.js
+++ b/gfx/layers/apz/test/mochitest/browser_test_scrolling_in_extension_popup_window.js
@@ -98,7 +98,7 @@ add_task(async () => {
return new Promise(resolve => {
content.window.addEventListener(
"scroll",
- event => {
+ () => {
dump("Got a scroll event in the popup content document\n");
resolve();
},
diff --git a/gfx/layers/apz/test/mochitest/helper_basic_scrollend.html b/gfx/layers/apz/test/mochitest/helper_basic_scrollend.html
index 9d71fe6251..6c31859690 100644
--- a/gfx/layers/apz/test/mochitest/helper_basic_scrollend.html
+++ b/gfx/layers/apz/test/mochitest/helper_basic_scrollend.html
@@ -19,7 +19,7 @@ const searchParams = new URLSearchParams(location.search);
async function test() {
var scrollendCount = 0;
- function onScrollend(e) {
+ function onScrollend() {
scrollendCount += 1;
}
diff --git a/gfx/layers/apz/test/mochitest/helper_browser_test_utils.js b/gfx/layers/apz/test/mochitest/helper_browser_test_utils.js
index ac68c9b1d4..22a072e48d 100644
--- a/gfx/layers/apz/test/mochitest/helper_browser_test_utils.js
+++ b/gfx/layers/apz/test/mochitest/helper_browser_test_utils.js
@@ -4,7 +4,7 @@ Services.scriptloader.loadSubScript(
this
);
-function openSelectPopup(selector = "select", win = window) {
+function openSelectPopup(selector, win = window) {
let popupShownPromise = BrowserTestUtils.waitForSelectPopupShown(win);
EventUtils.synthesizeKey("KEY_ArrowDown", { altKey: true }, win);
return popupShownPromise;
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1346632.html b/gfx/layers/apz/test/mochitest/helper_bug1346632.html
index f91f8159b5..c7f92c3810 100644
--- a/gfx/layers/apz/test/mochitest/helper_bug1346632.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1346632.html
@@ -28,7 +28,7 @@
async function test() {
var root = document.scrollingElement;
var scrollPos = root.scrollTop;
- var scrollPromise = new Promise((resolve, reject) => {
+ var scrollPromise = new Promise((resolve) => {
document.addEventListener("scroll", () => {
ok(root.scrollTop > scrollPos, "document scrolled after dragging scrollbar");
resolve();
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1414336.html b/gfx/layers/apz/test/mochitest/helper_bug1414336.html
index 636328b7e4..c0d35db401 100644
--- a/gfx/layers/apz/test/mochitest/helper_bug1414336.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1414336.html
@@ -62,14 +62,14 @@ waitUntilApzStable().then(async () => {
let target0 = window.document.getElementById("target0");
let target0_events = ["pointerdown", "pointermove"];
- target0_events.forEach((elem, index, arr) => {
+ target0_events.forEach((elem) => {
target0.addEventListener(elem, (event) => {
is(event.type, target0_events[0], "receive " + event.type + " on target0");
target0_events.shift();
}, { once: true });
});
- target0.addEventListener("pointercancel", (event) => {
+ target0.addEventListener("pointercancel", () => {
ok(false, "Shouldn't receive pointercancel when content prevents default on touchstart");
// Wait until the event is done processing before we end the subtest,
// otherwise on Android the pointer events pref is flipped back to false
@@ -81,7 +81,7 @@ waitUntilApzStable().then(async () => {
event.preventDefault();
}, { once: true });
- target0.addEventListener("pointerup", (event) => {
+ target0.addEventListener("pointerup", () => {
ok(!target0_events.length, " should receive " + target0_events + " on target0");
// Wait until the event is done processing before we end the subtest,
// otherwise on Android the pointer events pref is flipped back to false
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1502010_unconsumed_pan.html b/gfx/layers/apz/test/mochitest/helper_bug1502010_unconsumed_pan.html
index 73badf4bc7..8534e8886b 100644
--- a/gfx/layers/apz/test/mochitest/helper_bug1502010_unconsumed_pan.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1502010_unconsumed_pan.html
@@ -38,7 +38,7 @@
async function test() {
var target = document.getElementById("carousel");
- target.addEventListener("pointercancel", (event) => {
+ target.addEventListener("pointercancel", () => {
ok(false, "Received pointercancel, uh-oh!");
endEventReceived = true;
setTimeout(checkForTestEnd, 0);
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1506497_touch_action_fixed_on_fixed.html b/gfx/layers/apz/test/mochitest/helper_bug1506497_touch_action_fixed_on_fixed.html
index cc73fe99ea..b853bde04d 100644
--- a/gfx/layers/apz/test/mochitest/helper_bug1506497_touch_action_fixed_on_fixed.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1506497_touch_action_fixed_on_fixed.html
@@ -11,7 +11,7 @@
<script type="application/javascript">
async function test() {
- document.getElementById("overlay").addEventListener("touchstart", function(e) {
+ document.getElementById("overlay").addEventListener("touchstart", function() {
// no need to do anything here. Just having a non-passive touchstart
// listener will force APZ to wait for the main thread to handle the
// touch event. The bug is that the touch-action:none property on the
@@ -34,7 +34,7 @@ async function test() {
// This promise will resolve after the main thread has processed
// all the synthesized touch events.
let promiseTouchEnd = new Promise(resolve => {
- var waitForTouchEnd = function(e) {
+ var waitForTouchEnd = function() {
dump("touchend listener hit\n");
resolve();
};
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1695598.html b/gfx/layers/apz/test/mochitest/helper_bug1695598.html
index fb6102e33d..7961d7ced4 100644
--- a/gfx/layers/apz/test/mochitest/helper_bug1695598.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug1695598.html
@@ -19,7 +19,7 @@
let utils = SpecialPowers.getDOMWindowUtils(window);
let timeStamp = document.timeline.currentTime;
- async function sendScrollEvent(aRafTimestamp) {
+ async function sendScrollEvent() {
if (i < scrollEvents) {
if (timeStamp == document.timeline.currentTime) {
// If we are in a rAF callback at the same time stamp we've already
diff --git a/gfx/layers/apz/test/mochitest/helper_content_response_timeout.html b/gfx/layers/apz/test/mochitest/helper_content_response_timeout.html
index 41a0319699..c0481d01a4 100644
--- a/gfx/layers/apz/test/mochitest/helper_content_response_timeout.html
+++ b/gfx/layers/apz/test/mochitest/helper_content_response_timeout.html
@@ -11,7 +11,7 @@ div { height: 1000vh; }
</style>
<div id='target'></div>
<script>
-window.addEventListener('wheel', (e) => {
+window.addEventListener('wheel', () => {
const timeAtStart = window.performance.now();
while (window.performance.now() - timeAtStart < 200) {
// Make a 200ms busy state.
diff --git a/gfx/layers/apz/test/mochitest/helper_displayport_expiry.html b/gfx/layers/apz/test/mochitest/helper_displayport_expiry.html
index 023786a270..b463e4f39c 100644
--- a/gfx/layers/apz/test/mochitest/helper_displayport_expiry.html
+++ b/gfx/layers/apz/test/mochitest/helper_displayport_expiry.html
@@ -53,7 +53,7 @@ async function test() {
await promiseFrame();
let paintCount = 0;
- function countPaints(e) {
+ function countPaints() {
paintCount += 1;
}
diff --git a/gfx/layers/apz/test/mochitest/helper_fission_event_region_override.html b/gfx/layers/apz/test/mochitest/helper_fission_event_region_override.html
index 82f529bebd..8ebfc492f2 100644
--- a/gfx/layers/apz/test/mochitest/helper_fission_event_region_override.html
+++ b/gfx/layers/apz/test/mochitest/helper_fission_event_region_override.html
@@ -29,7 +29,7 @@ let code_for_oopif_to_run = function() {
let result = { x: e.clientX, y: e.clientY };
FissionTestHelper.fireEventInEmbedder("OOPIF:WheelData", result);
}, { passive: true });
- document.addEventListener("scroll", function(e) {
+ document.addEventListener("scroll", function() {
dump(`OOPIF got scroll to ${window.scrollX},${window.scrollY}\n`);
let result = { x: window.scrollX, y: window.scrollY };
FissionTestHelper.fireEventInEmbedder("OOPIF:Scrolled", result);
diff --git a/gfx/layers/apz/test/mochitest/helper_fission_scroll_oopif.html b/gfx/layers/apz/test/mochitest/helper_fission_scroll_oopif.html
index 2911b1eaf0..5a192c9f9e 100644
--- a/gfx/layers/apz/test/mochitest/helper_fission_scroll_oopif.html
+++ b/gfx/layers/apz/test/mochitest/helper_fission_scroll_oopif.html
@@ -66,7 +66,7 @@ let make_oopif_scrollable = function() {
FissionTestHelper.fireEventInEmbedder("OOPIF:Scrollable", result);
});
// Also register a scroll listener for when it actually gets scrolled.
- window.addEventListener("scroll", function(e) {
+ window.addEventListener("scroll", function() {
dump(`OOPIF got scroll event, now at ${window.scrollY}\n`);
let result = { y: window.scrollY };
FissionTestHelper.fireEventInEmbedder("OOPIF:Scrolled", result);
diff --git a/gfx/layers/apz/test/mochitest/helper_fullscreen.html b/gfx/layers/apz/test/mochitest/helper_fullscreen.html
index 32de4979f2..7ac443a1cc 100644
--- a/gfx/layers/apz/test/mochitest/helper_fullscreen.html
+++ b/gfx/layers/apz/test/mochitest/helper_fullscreen.html
@@ -27,7 +27,7 @@
});
}
- async function test(testDriver) {
+ async function test() {
target.requestFullscreen();
await waitForFullscreenChange();
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_deep_scene_stack.html b/gfx/layers/apz/test/mochitest/helper_hittest_deep_scene_stack.html
index a04b1d3e83..30a9740d24 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_deep_scene_stack.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_deep_scene_stack.html
@@ -38,7 +38,7 @@ for (var i = 3; i < 1000; i++) {
}
document.body.appendChild(div);
-async function test(testDriver) {
+async function test() {
var config = getHitTestConfig();
var utils = config.utils;
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html b/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html
index 0f20719d46..b83b864aa2 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_fixed-2.html
@@ -45,7 +45,7 @@ async function test() {
e.stopPropagation(); // do not propagate event to |fixed| ancestor
resolve();
});
- fixed.addEventListener("click", e => {
+ fixed.addEventListener("click", () => {
// Since target's listener calls stopPropagation(), if we get here
// then the coordinates of the click event did not correspond to
// |target|, but somewhere else on |fixed|.
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_fixed-3.html b/gfx/layers/apz/test/mochitest/helper_hittest_fixed-3.html
index 2004ea9ae4..092c5b0dfa 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_fixed-3.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_fixed-3.html
@@ -72,7 +72,7 @@ async function test() {
e.stopPropagation(); // do not propagate event to ancestors
resolve();
});
- fixed.addEventListener("click", e => {
+ fixed.addEventListener("click", () => {
// Since target's listener calls stopPropagation(), if we get here
// then the coordinates of the click event did not correspond to
// |target|, but somewhere else on |fixed|.
@@ -82,7 +82,7 @@ async function test() {
todo(false, "Fixed ancestor should not be hit");
resolve();
});
- window.addEventListener("click", e => {
+ window.addEventListener("click", () => {
// Similarly, the root content document's window should not be hit.
ok(false, "Root document should not be hit");
resolve();
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_fixed.html b/gfx/layers/apz/test/mochitest/helper_hittest_fixed.html
index 530c53fd7a..3185d83bf5 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_fixed.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_fixed.html
@@ -53,7 +53,7 @@ async function test() {
e.stopPropagation(); // do not propagate event to |fixed| ancestor
resolve();
});
- fixed.addEventListener("click", e => {
+ fixed.addEventListener("click", () => {
// Since target's listener calls stopPropagation(), if we get here
// then the coordinates of the click event did not correspond to
// |target|, but somewhere else on |fixed|.
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_hidden_inactive_scrollframe.html b/gfx/layers/apz/test/mochitest/helper_hittest_hidden_inactive_scrollframe.html
index 0abed82156..6d9ea7bc53 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_hidden_inactive_scrollframe.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_hidden_inactive_scrollframe.html
@@ -26,7 +26,7 @@
</body>
<script type="application/javascript">
-function test(testDriver) {
+function test() {
var config = getHitTestConfig();
var utils = config.utils;
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-2.html b/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-2.html
index 9838a02aa9..b6128aaa87 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-2.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_iframe_perspective-2.html
@@ -44,7 +44,7 @@ async function test() {
}
});
- window.addEventListener("mousedown", event => {
+ window.addEventListener("mousedown", () => {
ok(true, "Parent document should have received mouse-down");
resolve();
});
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html b/gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html
index c245258b68..c33dff3f28 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_overscroll.html
@@ -63,7 +63,7 @@ function startListeningForClickEventsInChrome() {
topWin = Services.wm.getMostRecentWindow("navigator:geckoview");
}
let chromeReceivedClick = false;
- function chromeListener(e) {
+ function chromeListener() {
chromeReceivedClick = true;
}
topWin.addEventListener("click", chromeListener);
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_contextmenu.html b/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_contextmenu.html
index 8aff3103dd..0bb3972c8a 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_contextmenu.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_contextmenu.html
@@ -43,7 +43,7 @@ function startListeningForContextmenuEventsInChrome() {
topWin = Services.wm.getMostRecentWindow("navigator:geckoview");
}
let chromeReceivedContextmenu = false;
- function chromeListener(e) {
+ function chromeListener() {
chromeReceivedContextmenu = true;
}
topWin.addEventListener("contextmenu", chromeListener);
@@ -95,7 +95,7 @@ async function test() {
let midGutter = 4 / deviceScale; // gutter is 8 *screen* pixels
startListeningForContextmenuEventsInChrome();
let contentReceivedContextmenu = false;
- let contentListener = function(e) {
+ let contentListener = function() {
contentReceivedContextmenu = true;
};
document.addEventListener("contextmenu", contentListener);
diff --git a/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_subframe.html b/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_subframe.html
index 36918b3682..ff97c34bd5 100644
--- a/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_subframe.html
+++ b/gfx/layers/apz/test/mochitest/helper_hittest_overscroll_subframe.html
@@ -84,7 +84,7 @@ async function test() {
// This makes sure we catch the case where the overscroll transform causes
// the event to incorrectly target the document.
let receivedClick = false;
- let listener = function(e) {
+ let listener = function() {
receivedClick = true;
};
document.addEventListener("click", listener);
diff --git a/gfx/layers/apz/test/mochitest/helper_key_scroll.html b/gfx/layers/apz/test/mochitest/helper_key_scroll.html
index 021e2803b7..4f574abd10 100644
--- a/gfx/layers/apz/test/mochitest/helper_key_scroll.html
+++ b/gfx/layers/apz/test/mochitest/helper_key_scroll.html
@@ -32,7 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
// page. This scroll is done synchronously because APZ doesn't have
// current focus state at page load.
let scrollBottomPromise = new Promise(resolve => {
- let checkBottom = function(e) {
+ let checkBottom = function() {
if (window.scrollY < window.scrollMaxY) {
return;
}
@@ -63,7 +63,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1383365
// This scroll should be asynchronous now that the focus state is up to date.
let scrollTopPromise = new Promise(resolve => {
- let checkTop = function(e) {
+ let checkTop = function() {
if (window.scrollY > 0) {
return;
}
diff --git a/gfx/layers/apz/test/mochitest/helper_main_thread_smooth_scroll_scrollend.html b/gfx/layers/apz/test/mochitest/helper_main_thread_smooth_scroll_scrollend.html
index 4f07db516e..c4a98ec7fa 100644
--- a/gfx/layers/apz/test/mochitest/helper_main_thread_smooth_scroll_scrollend.html
+++ b/gfx/layers/apz/test/mochitest/helper_main_thread_smooth_scroll_scrollend.html
@@ -25,7 +25,7 @@
async function test() {
let scrollendCount = 0;
- window.addEventListener("scrollend", e => {
+ window.addEventListener("scrollend", () => {
scrollendCount += 1;
});
diff --git a/gfx/layers/apz/test/mochitest/helper_minimum_scale_1_0.html b/gfx/layers/apz/test/mochitest/helper_minimum_scale_1_0.html
index 17ccb3a54d..9c98ecf727 100644
--- a/gfx/layers/apz/test/mochitest/helper_minimum_scale_1_0.html
+++ b/gfx/layers/apz/test/mochitest/helper_minimum_scale_1_0.html
@@ -22,7 +22,7 @@
<script type="application/javascript">
const utils = SpecialPowers.getDOMWindowUtils(window);
- async function test(testDriver) {
+ async function test() {
utils.scrollToVisual(100, 0, utils.UPDATE_TYPE_MAIN_THREAD,
utils.SCROLL_MODE_INSTANT);
diff --git a/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html b/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html
index 7280a26006..1c26fafdb7 100644
--- a/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html
+++ b/gfx/layers/apz/test/mochitest/helper_no_scalable_with_initial_scale.html
@@ -22,7 +22,7 @@
<script type="application/javascript">
const utils = SpecialPowers.getDOMWindowUtils(window);
- async function test(testDriver) {
+ async function test() {
utils.scrollToVisual(100, 0, utils.UPDATE_TYPE_MAIN_THREAD,
utils.SCROLL_MODE_INSTANT);
diff --git a/gfx/layers/apz/test/mochitest/helper_programmatic_scroll_behavior.html b/gfx/layers/apz/test/mochitest/helper_programmatic_scroll_behavior.html
index 721ce7e538..755c4115e2 100644
--- a/gfx/layers/apz/test/mochitest/helper_programmatic_scroll_behavior.html
+++ b/gfx/layers/apz/test/mochitest/helper_programmatic_scroll_behavior.html
@@ -35,7 +35,7 @@ async function test() {
// trigger one scroll event, so a scroll event count of 1 indicates that a
// instant scroll was conducted.
let scrollCount = 0;
- window.addEventListener("scroll", (e) => {
+ window.addEventListener("scroll", () => {
scrollCount += 1;
});
diff --git a/gfx/layers/apz/test/mochitest/helper_touch_action_regions.html b/gfx/layers/apz/test/mochitest/helper_touch_action_regions.html
index 6a8a09e55a..14e800a561 100644
--- a/gfx/layers/apz/test/mochitest/helper_touch_action_regions.html
+++ b/gfx/layers/apz/test/mochitest/helper_touch_action_regions.html
@@ -293,7 +293,7 @@ function* test(testDriver) {
// waitUntilApzStable().then(runContinuation(myTest));
function runContinuation(testFunction) {
return function() {
- return new Promise(function(resolve, reject) {
+ return new Promise(function(resolve) {
var testContinuation = null;
function driveTest() {
diff --git a/gfx/layers/apz/test/mochitest/helper_zoomed_pan.html b/gfx/layers/apz/test/mochitest/helper_zoomed_pan.html
index 98547fb73f..0692c2f588 100644
--- a/gfx/layers/apz/test/mochitest/helper_zoomed_pan.html
+++ b/gfx/layers/apz/test/mochitest/helper_zoomed_pan.html
@@ -42,7 +42,7 @@
x: 0,
y: 0,
dx: (width) => -computeDelta(width),
- dy: (height) => 0,
+ dy: () => 0,
expected: {
x: [OFFSET_CSS_PX, "x-offset was adjusted"],
y: [0, "y-offset was not affected"],
@@ -51,7 +51,7 @@
{
x: OFFSET_CSS_PX,
y: 0,
- dx: (width) => 0,
+ dx: () => 0,
dy: (height) => -computeDelta(height),
expected: {
x: [OFFSET_CSS_PX, "x-offset was not affected"],
diff --git a/gfx/layers/apz/test/mochitest/test_smoothness.html b/gfx/layers/apz/test/mochitest/test_smoothness.html
index 64cb8bcefa..0f2ca3219e 100644
--- a/gfx/layers/apz/test/mochitest/test_smoothness.html
+++ b/gfx/layers/apz/test/mochitest/test_smoothness.html
@@ -23,7 +23,7 @@
SimpleTest.waitForExplicitFinish();
var utils = SpecialPowers.getDOMWindowUtils(window);
- async function sendScrollEvent(aRafTimestamp) {
+ async function sendScrollEvent() {
var scrollDiv = document.getElementById("content");
if (i < scrollEvents) {
diff --git a/gfx/layers/apz/test/mochitest/test_touch_listeners_impacting_wheel.html b/gfx/layers/apz/test/mochitest/test_touch_listeners_impacting_wheel.html
index 71147d5238..0598f1a201 100644
--- a/gfx/layers/apz/test/mochitest/test_touch_listeners_impacting_wheel.html
+++ b/gfx/layers/apz/test/mochitest/test_touch_listeners_impacting_wheel.html
@@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1203140
const kResponseTimeoutMs = 2 * 60 * 1000; // 2 minutes
-function takeSnapshots(e) {
+function takeSnapshots() {
// Grab some snapshots, and make sure some of them are different (i.e. check
// the page is scrolling in the compositor, concurrently with this wheel
// listener running).
@@ -69,7 +69,7 @@ async function test() {
// Ensure the div is layerized by scrolling it
await promiseMoveMouseAndScrollWheelOver(box, 10, 10);
- box.addEventListener("touchstart", function(e) {
+ box.addEventListener("touchstart", function() {
ok(false, "This should never be run");
});
box.addEventListener("wheel", takeSnapshots, { capture: false, passive: true });
diff --git a/gfx/layers/apz/test/reftest/reftest.list b/gfx/layers/apz/test/reftest/reftest.list
index 77bfff3e6e..9af67384a8 100644
--- a/gfx/layers/apz/test/reftest/reftest.list
+++ b/gfx/layers/apz/test/reftest/reftest.list
@@ -1,14 +1,14 @@
# The following tests test the async positioning of the scrollbars.
# Basic root-frame scrollbar with async scrolling
# First make sure that we are actually drawing scrollbars
-skip-if(!asyncPan) pref(apz.allow_zooming,true) != async-scrollbar-1-v.html about:blank
-skip-if(!asyncPan) pref(apz.allow_zooming,true) != async-scrollbar-1-v-ref.html about:blank
-fuzzy-if(Android,0-5,0-6) fuzzy-if(gtkWidget,1-8,8-32) fuzzy-if(cocoaWidget,16-22,20-44) skip-if(!asyncPan) pref(apz.allow_zooming,true) == async-scrollbar-1-v.html async-scrollbar-1-v-ref.html
-fuzzy-if(Android,0-13,0-10) fuzzy-if(gtkWidget,1-30,4-32) fuzzy-if(cocoaWidget,14-22,20-44) skip-if(!asyncPan) pref(apz.allow_zooming,true) == async-scrollbar-1-h.html async-scrollbar-1-h-ref.html
-fuzzy-if(Android,0-13,0-21) fuzzy-if(gtkWidget,1-4,4-24) fuzzy-if(cocoaWidget,11-18,44-88) skip-if(!asyncPan) pref(apz.allow_zooming,true) == async-scrollbar-1-vh.html async-scrollbar-1-vh-ref.html
-fuzzy-if(Android,0-5,0-6) fuzzy-if(gtkWidget,1-8,8-32) fuzzy-if(cocoaWidget,16-22,20-44) skip-if(!asyncPan) pref(apz.allow_zooming,true) == async-scrollbar-1-v-rtl.html async-scrollbar-1-v-rtl-ref.html
-fuzzy-if(Android,0-14,0-10) fuzzy-if(gtkWidget,1-30,12-32) fuzzy-if(cocoaWidget,14-22,20-44) skip-if(!asyncPan) pref(apz.allow_zooming,true) == async-scrollbar-1-h-rtl.html async-scrollbar-1-h-rtl-ref.html
-fuzzy-if(Android,0-43,0-26) fuzzy-if(gtkWidget,0-14,12-32) fuzzy-if(cocoaWidget,11-18,26-76) skip-if(!asyncPan) pref(apz.allow_zooming,true) == async-scrollbar-1-vh-rtl.html async-scrollbar-1-vh-rtl-ref.html
+skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) != async-scrollbar-1-v.html about:blank
+skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) != async-scrollbar-1-v-ref.html about:blank
+fuzzy-if(Android,0-5,0-6) fuzzy-if(gtkWidget,1-8,8-32) fuzzy-if(cocoaWidget,16-22,20-44) skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) == async-scrollbar-1-v.html async-scrollbar-1-v-ref.html
+fuzzy-if(Android,0-13,0-10) fuzzy-if(gtkWidget,1-30,4-32) fuzzy-if(cocoaWidget,14-22,20-44) skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) == async-scrollbar-1-h.html async-scrollbar-1-h-ref.html
+fuzzy-if(Android,0-13,0-21) fuzzy-if(gtkWidget,1-4,4-24) fuzzy-if(cocoaWidget,11-18,44-88) skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) == async-scrollbar-1-vh.html async-scrollbar-1-vh-ref.html
+fuzzy-if(Android,0-5,0-6) fuzzy-if(gtkWidget,1-8,8-32) fuzzy-if(cocoaWidget,16-22,20-44) skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) == async-scrollbar-1-v-rtl.html async-scrollbar-1-v-rtl-ref.html
+fuzzy-if(Android,0-14,0-10) fuzzy-if(gtkWidget,1-30,12-32) fuzzy-if(cocoaWidget,14-22,20-44) skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) == async-scrollbar-1-h-rtl.html async-scrollbar-1-h-rtl-ref.html
+fuzzy-if(Android,0-43,0-26) fuzzy-if(gtkWidget,0-14,12-32) fuzzy-if(cocoaWidget,11-18,26-76) skip-if(useDrawSnapshot) pref(apz.allow_zooming,true) == async-scrollbar-1-vh-rtl.html async-scrollbar-1-vh-rtl-ref.html
# Different async zoom levels. Since the scrollthumb gets async-scaled in the
# compositor, the border-radius ends of the scrollthumb are going to be a little
@@ -37,7 +37,7 @@ fuzzy-if(Android,0-28,0-23) fuzzy-if(!Android,0-107,0-34) pref(apz.allow_zooming
# Meta-viewport tag support
skip-if(!Android) pref(apz.allow_zooming,true) == initial-scale-1.html initial-scale-1-ref.html
-skip-if(!asyncPan) == frame-reconstruction-scroll-clamping.html frame-reconstruction-scroll-clamping-ref.html
+skip-if(useDrawSnapshot) == frame-reconstruction-scroll-clamping.html frame-reconstruction-scroll-clamping-ref.html
# Test that position:fixed and position:sticky elements are attached to the
# layout viewport.
diff --git a/gfx/layers/apz/testutil/APZTestData.h b/gfx/layers/apz/testutil/APZTestData.h
index e4a73c80cc..d180bbcf1d 100644
--- a/gfx/layers/apz/testutil/APZTestData.h
+++ b/gfx/layers/apz/testutil/APZTestData.h
@@ -144,10 +144,10 @@ class APZTestData {
// A helper class for logging data for a paint.
class APZPaintLogHelper {
public:
- APZPaintLogHelper(APZTestData* aTestData, SequenceNumber aPaintSequenceNumber)
+ APZPaintLogHelper(APZTestData* aTestData, SequenceNumber aPaintSequenceNumber,
+ bool aIsTestLoggingEnabled)
: mTestData(aTestData), mPaintSequenceNumber(aPaintSequenceNumber) {
- MOZ_ASSERT(!aTestData || StaticPrefs::apz_test_logging_enabled(),
- "don't call me");
+ MOZ_ASSERT(!aTestData || aIsTestLoggingEnabled, "don't call me");
}
template <typename Value>
diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp
index 9ad65ce981..508cd8e67f 100644
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -518,7 +518,8 @@ nsEventStatus APZCCallbackHelper::DispatchSynthesizedMouseEvent(
WidgetMouseEvent::eNormal);
event.mRefPoint = LayoutDeviceIntPoint::Truncate(aRefPoint.x, aRefPoint.y);
event.mButton = MouseButton::ePrimary;
- event.mButtons |= MouseButtonsFlag::ePrimaryFlag;
+ event.mButtons = aMsg == eMouseDown ? MouseButtonsFlag::ePrimaryFlag
+ : MouseButtonsFlag::eNoButtons;
event.mInputSource = dom::MouseEvent_Binding::MOZ_SOURCE_TOUCH;
if (aMsg == eMouseLongTap) {
event.mFlags.mOnlyChromeDispatch = true;
diff --git a/gfx/layers/apz/util/APZEventState.cpp b/gfx/layers/apz/util/APZEventState.cpp
index 7384296f45..5db6a08429 100644
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -240,7 +240,7 @@ void APZEventState::ProcessLongTap(PresShell* aPresShell,
false;
#elif defined(MOZ_WIDGET_ANDROID)
// On Android, GeckoView calls preventDefault() in a JSActor
- // (ContentDelegateChild.jsm) when opening context menu so that we can
+ // (ContentDelegateChild.sys.mjs) when opening context menu so that we can
// tell whether contextmenu opens in response to the contextmenu event by
// checking where preventDefault() got called.
preventDefaultResult == PreventDefaultResult::ByChrome;