summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/src/AsyncPanZoomController.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /gfx/layers/apz/src/AsyncPanZoomController.cpp
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/src/AsyncPanZoomController.cpp')
-rw-r--r--gfx/layers/apz/src/AsyncPanZoomController.cpp41
1 files changed, 27 insertions, 14 deletions
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp
index edbd2ecffa..a070340421 100644
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -242,11 +242,6 @@ typedef PlatformSpecificStateBase
* Setting this pref to true will cause APZ to handle mouse-dragging of
* scrollbar thumbs.
*
- * \li\b apz.drag.initial.enabled
- * Setting this pref to true will cause APZ to try to handle mouse-dragging
- * of scrollbar thumbs without an initial round-trip to content to start it
- * if possible. Only has an effect if apz.drag.enabled is also true.
- *
* \li\b apz.drag.touch.enabled
* Setting this pref to true will cause APZ to handle touch-dragging of
* scrollbar thumbs. Only has an effect if apz.drag.enabled is also true.
@@ -1310,10 +1305,13 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(
if (RefPtr<GeckoContentController> controller =
GetGeckoContentController()) {
MOZ_ASSERT(GetCurrentTouchBlock());
- controller->NotifyAPZStateChange(
- GetGuid(), APZStateChange::eStartTouch,
+ const bool canBePanOrZoom =
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->CanBePanned(
- this),
+ this) ||
+ (ZoomConstraintsAllowDoubleTapZoom() &&
+ GetCurrentTouchBlock()->TouchActionAllowsDoubleTapZoom());
+ controller->NotifyAPZStateChange(
+ GetGuid(), APZStateChange::eStartTouch, canBePanOrZoom,
Some(GetCurrentTouchBlock()->GetBlockId()));
}
mLastTouch.mTimeStamp = mTouchStartTime = aEvent.mTimeStamp;
@@ -3112,7 +3110,7 @@ nsEventStatus AsyncPanZoomController::GenerateSingleTap(
// touch block caused a `click` event or not, thus for long-tap events,
// it's not necessary.
if (aType != TapType::eLongTapUp) {
- touch->SetSingleTapOccurred();
+ touch->SetSingleTapState(apz::SingleTapState::WasClick);
}
}
// Because this may be being running as part of
@@ -3143,7 +3141,7 @@ void AsyncPanZoomController::OnTouchEndOrCancel() {
MOZ_ASSERT(GetCurrentTouchBlock());
controller->NotifyAPZStateChange(
GetGuid(), APZStateChange::eEndTouch,
- GetCurrentTouchBlock()->SingleTapOccurred(),
+ static_cast<int>(GetCurrentTouchBlock()->SingleTapState()),
Some(GetCurrentTouchBlock()->GetBlockId()));
}
}
@@ -3160,6 +3158,21 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(
return GenerateSingleTap(TapType::eSingleTap, aEvent.mPoint,
aEvent.modifiers);
}
+
+ // Ignore the event if it does not have valid local coordinates.
+ // GenerateSingleTap will not send a tap in this case.
+ if (!ConvertToGecko(aEvent.mPoint)) {
+ return nsEventStatus_eIgnore;
+ }
+
+ // Here we need to wait for the call to OnSingleTapConfirmed, we need to tell
+ // it to ActiveElementManager so that we can do element activation once
+ // ActiveElementManager got a single tap event later.
+ if (TouchBlockState* touch = GetCurrentTouchBlock()) {
+ if (!touch->IsDuringFastFling()) {
+ touch->SetSingleTapState(apz::SingleTapState::NotYetDetermined);
+ }
+ }
return nsEventStatus_eIgnore;
}
@@ -5304,10 +5317,10 @@ void AsyncPanZoomController::UpdateCheckerboardEvent(
const MutexAutoLock& aProofOfLock, uint32_t aMagnitude) {
if (mCheckerboardEvent && mCheckerboardEvent->RecordFrameInfo(aMagnitude)) {
// This checkerboard event is done. Report some metrics to telemetry.
- mozilla::glean::gfx_checkerboard::severity.AccumulateSamples(
- {mCheckerboardEvent->GetSeverity()});
- mozilla::glean::gfx_checkerboard::peak_pixel_count.AccumulateSamples(
- {mCheckerboardEvent->GetPeak()});
+ mozilla::glean::gfx_checkerboard::severity.AccumulateSingleSample(
+ mCheckerboardEvent->GetSeverity());
+ mozilla::glean::gfx_checkerboard::peak_pixel_count.AccumulateSingleSample(
+ mCheckerboardEvent->GetPeak());
mozilla::glean::gfx_checkerboard::duration.AccumulateRawDuration(
mCheckerboardEvent->GetDuration());