bool WheelBlockState::AllowScrollHandoff() const { // If we're in a wheel transaction, we do not allow overscroll handoff until // a new event ends the wheel transaction. return !IsTargetConfirmed() || !InTransaction(); }
void WheelBlockState::Update(const ScrollWheelInput& aEvent) { // We might not be in a transaction if the block never started in a // transaction - for example, if nothing was scrollable. if (!InTransaction()) { return; } // If we can't scroll in the direction of the wheel event, we don't update // the last move time. This allows us to timeout a transaction even if the // mouse isn't moving. // // We skip this check if the target is not yet confirmed, so that when it is // confirmed, we don't timeout the transaction. nsRefPtr<AsyncPanZoomController> apzc = GetTargetApzc(); if (IsTargetConfirmed() && !apzc->CanScroll(aEvent)) { return; } // Update the time of the last known good event, and reset the mouse move // time to null. This will reset the delays on both the general transaction // timeout and the mouse-move-in-frame timeout. mLastEventTime = aEvent.mTimeStamp; mLastMouseMove = TimeStamp(); }
bool CancelableBlockState::IsReadyForHandling() const { if (!IsTargetConfirmed()) return false; return mContentResponded || mContentResponseTimerExpired; }
void WheelBlockState::Update(ScrollWheelInput& aEvent) { // We might not be in a transaction if the block never started in a // transaction - for example, if nothing was scrollable. if (!InTransaction()) { return; } // The current "scroll series" is a like a sub-transaction. It has a separate // timeout of 80ms. Since we need to compute wheel deltas at different phases // of a transaction (for example, when it is updated, and later when the // event action is taken), we affix the scroll series counter to the event. // This makes GetScrollWheelDelta() consistent. if (!mLastEventTime.IsNull() && (aEvent.mTimeStamp - mLastEventTime).ToMilliseconds() > kScrollSeriesTimeoutMs) { mScrollSeriesCounter = 0; } aEvent.mScrollSeriesNumber = ++mScrollSeriesCounter; // If we can't scroll in the direction of the wheel event, we don't update // the last move time. This allows us to timeout a transaction even if the // mouse isn't moving. // // We skip this check if the target is not yet confirmed, so that when it is // confirmed, we don't timeout the transaction. RefPtr<AsyncPanZoomController> apzc = GetTargetApzc(); if (IsTargetConfirmed() && !apzc->CanScroll(aEvent)) { return; } // Update the time of the last known good event, and reset the mouse move // time to null. This will reset the delays on both the general transaction // timeout and the mouse-move-in-frame timeout. mLastEventTime = aEvent.mTimeStamp; mLastMouseMove = TimeStamp(); }