mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix crashes when a wheel transaction has a null confirmed apzc. (bug 1147249, r=kats)
This commit is contained in:
parent
fcd90b7e73
commit
b033e4e8f6
@ -265,8 +265,9 @@ WheelBlockState::ShouldAcceptNewEvent() const
|
||||
// If we're not in a transaction, start a new one.
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetApzc();
|
||||
if (!apzc || apzc->IsDestroyed()) {
|
||||
if (apzc->IsDestroyed()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -276,6 +277,8 @@ WheelBlockState::ShouldAcceptNewEvent() const
|
||||
bool
|
||||
WheelBlockState::MaybeTimeout(const ScrollWheelInput& aEvent)
|
||||
{
|
||||
MOZ_ASSERT(InTransaction());
|
||||
|
||||
if (MaybeTimeout(aEvent.mTimeStamp)) {
|
||||
return true;
|
||||
}
|
||||
@ -296,6 +299,8 @@ WheelBlockState::MaybeTimeout(const ScrollWheelInput& aEvent)
|
||||
bool
|
||||
WheelBlockState::MaybeTimeout(const TimeStamp& aTimeStamp)
|
||||
{
|
||||
MOZ_ASSERT(InTransaction());
|
||||
|
||||
// End the transaction if the event occurred > 1.5s after the most recently
|
||||
// seen wheel event.
|
||||
TimeDuration duration = aTimeStamp - mLastEventTime;
|
||||
@ -317,6 +322,8 @@ WheelBlockState::MaybeTimeout(const TimeStamp& aTimeStamp)
|
||||
void
|
||||
WheelBlockState::OnMouseMove(const ScreenIntPoint& aPoint)
|
||||
{
|
||||
MOZ_ASSERT(InTransaction());
|
||||
|
||||
if (!GetTargetApzc()->Contains(aPoint)) {
|
||||
EndTransaction();
|
||||
return;
|
||||
@ -334,6 +341,17 @@ WheelBlockState::OnMouseMove(const ScreenIntPoint& aPoint)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WheelBlockState::UpdateTargetApzc(const nsRefPtr<AsyncPanZoomController>& aTargetApzc)
|
||||
{
|
||||
InputBlockState::UpdateTargetApzc(aTargetApzc);
|
||||
|
||||
// If we found there was no target apzc, then we end the transaction.
|
||||
if (!GetTargetApzc()) {
|
||||
EndTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
WheelBlockState::InTransaction() const
|
||||
{
|
||||
@ -342,7 +360,13 @@ WheelBlockState::InTransaction() const
|
||||
if (GetBlockId() != sLastWheelBlockId) {
|
||||
return false;
|
||||
}
|
||||
return !mTransactionEnded;
|
||||
|
||||
if (mTransactionEnded) {
|
||||
return false;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(GetTargetApzc());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
bool IsTargetConfirmed() const;
|
||||
|
||||
protected:
|
||||
void UpdateTargetApzc(const nsRefPtr<AsyncPanZoomController>& aTargetApzc);
|
||||
virtual void UpdateTargetApzc(const nsRefPtr<AsyncPanZoomController>& aTargetApzc);
|
||||
|
||||
private:
|
||||
nsRefPtr<AsyncPanZoomController> mTargetApzc;
|
||||
@ -224,6 +224,9 @@ public:
|
||||
*/
|
||||
void Update(const ScrollWheelInput& aEvent);
|
||||
|
||||
protected:
|
||||
void UpdateTargetApzc(const nsRefPtr<AsyncPanZoomController>& aTargetApzc) override;
|
||||
|
||||
private:
|
||||
nsTArray<ScrollWheelInput> mEvents;
|
||||
TimeStamp mLastEventTime;
|
||||
|
Loading…
Reference in New Issue
Block a user