Bug 1289432 - Allow the CurrentBlock() and CurrentXXXBlock() functions to return null, and guard/assert at the callsites. r=botond

MozReview-Commit-ID: 77LWZBtAB9Y
This commit is contained in:
Kartikaya Gupta 2016-09-14 07:54:36 -04:00
Родитель 43f18cb292
Коммит f8d4e33b0b
5 изменённых файлов: 103 добавлений и 85 удалений

Просмотреть файл

@ -1087,15 +1087,17 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent
case OVERSCROLL_ANIMATION:
case WHEEL_SCROLL:
case PAN_MOMENTUM:
CurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll);
MOZ_ASSERT(GetCurrentTouchBlock());
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll);
MOZ_FALLTHROUGH;
case NOTHING: {
mX.StartTouch(point.x, aEvent.mTime);
mY.StartTouch(point.y, aEvent.mTime);
if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
MOZ_ASSERT(GetCurrentTouchBlock());
controller->NotifyAPZStateChange(
GetGuid(), APZStateChange::eStartTouch,
CurrentTouchBlock()->GetOverscrollHandoffChain()->CanBePanned(this));
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->CanBePanned(this));
}
SetState(TOUCHING);
break;
@ -1134,7 +1136,8 @@ nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent)
return nsEventStatus_eIgnore;
}
if (gfxPrefs::TouchActionEnabled() && CurrentTouchBlock()->TouchActionAllowsPanningXY()) {
MOZ_ASSERT(GetCurrentTouchBlock());
if (gfxPrefs::TouchActionEnabled() && GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
// User tries to trigger a touch behavior. If allowed touch behavior is vertical pan
// + horizontal pan (touch-action value is equal to AUTO) we can return ConsumeNoDefault
// status immediately to trigger cancel event further. It should happen independent of
@ -1206,18 +1209,19 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
// that were not big enough to trigger scrolling. Clear that out.
mX.SetVelocity(0);
mY.SetVelocity(0);
MOZ_ASSERT(GetCurrentTouchBlock());
APZC_LOG("%p still has %u touch points active\n", this,
CurrentTouchBlock()->GetActiveTouchCount());
GetCurrentTouchBlock()->GetActiveTouchCount());
// In cases where the user is panning, then taps the second finger without
// entering a pinch, we will arrive here when the second finger is lifted.
// However the first finger is still down so we want to remain in state
// TOUCHING.
if (CurrentTouchBlock()->GetActiveTouchCount() == 0) {
if (GetCurrentTouchBlock()->GetActiveTouchCount() == 0) {
// It's possible we may be overscrolled if the user tapped during a
// previous overscroll pan. Make sure to snap back in this situation.
// An ancestor APZC could be overscrolled instead of this APZC, so
// walk the handoff chain as well.
CurrentTouchBlock()->GetOverscrollHandoffChain()->SnapBackOverscrolledApzc(this);
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->SnapBackOverscrolledApzc(this);
// SnapBackOverscrolledApzc() will put any APZC it causes to snap back
// into the OVERSCROLL_ANIMATION state. If that's not us, since we're
// done TOUCHING enter the NOTHING state.
@ -1232,7 +1236,8 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
case PANNING_LOCKED_Y:
case PAN_MOMENTUM:
{
CurrentTouchBlock()->GetOverscrollHandoffChain()->FlushRepaints();
MOZ_ASSERT(GetCurrentTouchBlock());
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->FlushRepaints();
mX.EndTouch(aEvent.mTime);
mY.EndTouch(aEvent.mTime);
ParentLayerPoint flingVelocity = GetVelocityVector();
@ -1260,9 +1265,9 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent)
// which nulls out mTreeManager, could be called concurrently.
if (APZCTreeManager* treeManagerLocal = GetApzcTreeManager()) {
FlingHandoffState handoffState{flingVelocity,
CurrentTouchBlock()->GetOverscrollHandoffChain(),
GetCurrentTouchBlock()->GetOverscrollHandoffChain(),
false /* not handoff */,
CurrentTouchBlock()->GetScrolledApzc()};
GetCurrentTouchBlock()->GetScrolledApzc()};
treeManagerLocal->DispatchFling(this, handoffState);
}
return nsEventStatus_eConsumeNoDefault;
@ -1298,7 +1303,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
mPinchPaintTimerSet = false;
// Note that there may not be a touch block at this point, if we received the
// PinchGestureEvent directly from widget code without any touch events.
if (HasReadyTouchBlock() && !CurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
if (HasReadyTouchBlock() && !GetCurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
return nsEventStatus_eIgnore;
}
@ -1313,7 +1318,7 @@ nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEve
nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
APZC_LOG("%p got a scale in state %d\n", this, mState);
if (HasReadyTouchBlock() && !CurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
if (HasReadyTouchBlock() && !GetCurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
return nsEventStatus_eIgnore;
}
@ -1419,7 +1424,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
mPinchPaintTimerSet = false;
if (HasReadyTouchBlock() && !CurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
if (HasReadyTouchBlock() && !GetCurrentTouchBlock()->TouchActionAllowsPinchZoom()) {
return nsEventStatus_eIgnore;
}
@ -1451,7 +1456,7 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
// further up in the handoff chain rather than on the current APZC, so
// we need to clear overscroll along the entire handoff chain.
if (HasReadyTouchBlock()) {
CurrentTouchBlock()->GetOverscrollHandoffChain()->ClearOverscroll();
GetCurrentTouchBlock()->GetOverscrollHandoffChain()->ClearOverscroll();
} else {
ClearOverscroll();
}
@ -1625,7 +1630,7 @@ AsyncPanZoomController::AllowScrollHandoffInCurrentBlock() const
{
bool result = mInputQueue->AllowScrollHandoff();
if (!gfxPrefs::APZAllowImmediateHandoff()) {
if (InputBlockState* currentBlock = CurrentInputBlock()) {
if (InputBlockState* currentBlock = GetCurrentInputBlock()) {
// Do not allow handoff beyond the first APZC to scroll.
if (currentBlock->GetScrolledApzc() == this) {
result = false;
@ -1704,8 +1709,9 @@ nsEventStatus AsyncPanZoomController::OnScrollWheel(const ScrollWheelInput& aEve
CancelAnimation();
MOZ_ASSERT(mInputQueue->GetCurrentWheelBlock());
OverscrollHandoffState handoffState(
*mInputQueue->CurrentWheelBlock()->GetOverscrollHandoffChain(),
*mInputQueue->GetCurrentWheelBlock()->GetOverscrollHandoffChain(),
distance,
ScrollSource::Wheel);
ParentLayerPoint startPoint = aEvent.mLocalOrigin;
@ -1794,7 +1800,8 @@ nsEventStatus AsyncPanZoomController::OnPanMayBegin(const PanGestureInput& aEven
mX.StartTouch(aEvent.mLocalPanStartPoint.x, aEvent.mTime);
mY.StartTouch(aEvent.mLocalPanStartPoint.y, aEvent.mTime);
CurrentPanGestureBlock()->GetOverscrollHandoffChain()->CancelAnimations();
MOZ_ASSERT(GetCurrentPanGestureBlock());
GetCurrentPanGestureBlock()->GetOverscrollHandoffChain()->CancelAnimations();
return nsEventStatus_eConsumeNoDefault;
}
@ -1891,8 +1898,9 @@ nsEventStatus AsyncPanZoomController::OnPan(const PanGestureInput& aEvent, bool
(uint32_t) ScrollInputMethod::ApzPanGesture);
ScreenPoint panDistance(fabs(physicalPanDisplacement.x), fabs(physicalPanDisplacement.y));
MOZ_ASSERT(GetCurrentPanGestureBlock());
OverscrollHandoffState handoffState(
*CurrentPanGestureBlock()->GetOverscrollHandoffChain(),
*GetCurrentPanGestureBlock()->GetOverscrollHandoffChain(),
panDistance,
ScrollSource::Wheel);
@ -1922,8 +1930,9 @@ nsEventStatus AsyncPanZoomController::OnPanEnd(const PanGestureInput& aEvent) {
// Drop any velocity on axes where we don't have room to scroll anyways
// (in this APZC, or an APZC further in the handoff chain).
// This ensures that we don't enlarge the display port unnecessarily.
MOZ_ASSERT(GetCurrentPanGestureBlock());
RefPtr<const OverscrollHandoffChain> overscrollHandoffChain =
CurrentPanGestureBlock()->GetOverscrollHandoffChain();
GetCurrentPanGestureBlock()->GetOverscrollHandoffChain();
if (!overscrollHandoffChain->CanScrollInDirection(this, Layer::HORIZONTAL)) {
mX.SetVelocity(0);
}
@ -1982,13 +1991,12 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent)
if (controller) {
LayoutDevicePoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
CancelableBlockState* block = CurrentInputBlock();
MOZ_ASSERT(block);
if (!block->AsTouchBlock()) {
TouchBlockState* touch = GetCurrentTouchBlock();
if (!touch) {
APZC_LOG("%p dropping long-press because some non-touch block interrupted it\n", this);
return nsEventStatus_eIgnore;
}
if (block->AsTouchBlock()->IsDuringFastFling()) {
if (touch->IsDuringFastFling()) {
APZC_LOG("%p dropping long-press because of fast fling\n", this);
return nsEventStatus_eIgnore;
}
@ -2011,10 +2019,8 @@ nsEventStatus AsyncPanZoomController::GenerateSingleTap(TapType aType,
if (controller) {
LayoutDevicePoint geckoScreenPoint;
if (ConvertToGecko(aPoint, &geckoScreenPoint)) {
CancelableBlockState* block = CurrentInputBlock();
MOZ_ASSERT(block);
TouchBlockState* touch = block->AsTouchBlock();
// |block| may be a non-touch block in the case where this function is
TouchBlockState* touch = GetCurrentTouchBlock();
// |touch| may be null in the case where this function is
// invoked by GestureEventListener on a timeout. In that case we already
// verified that the single tap is allowed so we let it through.
// XXX there is a bug here that in such a case the touch block that
@ -2049,8 +2055,9 @@ nsEventStatus AsyncPanZoomController::GenerateSingleTap(TapType aType,
void AsyncPanZoomController::OnTouchEndOrCancel() {
if (RefPtr<GeckoContentController> controller = GetGeckoContentController()) {
MOZ_ASSERT(GetCurrentTouchBlock());
controller->NotifyAPZStateChange(
GetGuid(), APZStateChange::eEndTouch, CurrentTouchBlock()->SingleTapOccurred());
GetGuid(), APZStateChange::eEndTouch, GetCurrentTouchBlock()->SingleTapOccurred());
}
}
@ -2058,7 +2065,8 @@ nsEventStatus AsyncPanZoomController::OnSingleTapUp(const TapGestureInput& aEven
APZC_LOG("%p got a single-tap-up in state %d\n", this, mState);
// If mZoomConstraints.mAllowDoubleTapZoom is true we wait for a call to OnSingleTapConfirmed before
// sending event to content
if (!(mZoomConstraints.mAllowDoubleTapZoom && CurrentTouchBlock()->TouchActionAllowsDoubleTapZoom())) {
MOZ_ASSERT(GetCurrentTouchBlock());
if (!(mZoomConstraints.mAllowDoubleTapZoom && GetCurrentTouchBlock()->TouchActionAllowsDoubleTapZoom())) {
return GenerateSingleTap(TapType::eSingleTap, aEvent.mPoint, aEvent.modifiers);
}
return nsEventStatus_eIgnore;
@ -2073,11 +2081,12 @@ nsEventStatus AsyncPanZoomController::OnDoubleTap(const TapGestureInput& aEvent)
APZC_LOG("%p got a double-tap in state %d\n", this, mState);
RefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
if (mZoomConstraints.mAllowDoubleTapZoom && CurrentTouchBlock()->TouchActionAllowsDoubleTapZoom()) {
MOZ_ASSERT(GetCurrentTouchBlock());
if (mZoomConstraints.mAllowDoubleTapZoom && GetCurrentTouchBlock()->TouchActionAllowsDoubleTapZoom()) {
LayoutDevicePoint geckoScreenPoint;
if (ConvertToGecko(aEvent.mPoint, &geckoScreenPoint)) {
controller->HandleTap(TapType::eDoubleTap, geckoScreenPoint,
aEvent.modifiers, GetGuid(), CurrentTouchBlock()->GetBlockId());
aEvent.modifiers, GetGuid(), GetCurrentTouchBlock()->GetBlockId());
}
}
return nsEventStatus_eConsumeNoDefault;
@ -2153,7 +2162,8 @@ void AsyncPanZoomController::SetVelocityVector(const ParentLayerPoint& aVelocity
void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
// Handling of cross sliding will need to be added in this method after touch-action released
// enabled by default.
if (CurrentTouchBlock()->TouchActionAllowsPanningXY()) {
MOZ_ASSERT(GetCurrentTouchBlock());
if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
if (mX.CanScrollNow() && mY.CanScrollNow()) {
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
mY.SetAxisLocked(true);
@ -2169,7 +2179,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
} else {
SetState(NOTHING);
}
} else if (CurrentTouchBlock()->TouchActionAllowsPanningX()) {
} else if (GetCurrentTouchBlock()->TouchActionAllowsPanningX()) {
// Using bigger angle for panning to keep behavior consistent
// with IE.
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
@ -2181,7 +2191,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
// requires it.
SetState(NOTHING);
}
} else if (CurrentTouchBlock()->TouchActionAllowsPanningY()) {
} else if (GetCurrentTouchBlock()->TouchActionAllowsPanningY()) {
if (IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
mX.SetAxisLocked(true);
SetState(PANNING_LOCKED_Y);
@ -2203,8 +2213,9 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
void AsyncPanZoomController::HandlePanning(double aAngle) {
ReentrantMonitorAutoEnter lock(mMonitor);
MOZ_ASSERT(GetCurrentInputBlock());
RefPtr<const OverscrollHandoffChain> overscrollHandoffChain =
CurrentInputBlock()->GetOverscrollHandoffChain();
GetCurrentInputBlock()->GetOverscrollHandoffChain();
bool canScrollHorizontal = !mX.IsAxisLocked() &&
overscrollHandoffChain->CanScrollInDirection(this, Layer::HORIZONTAL);
bool canScrollVertical = !mY.IsAxisLocked() &&
@ -2305,7 +2316,7 @@ bool AsyncPanZoomController::AttemptScroll(ParentLayerPoint& aStartPoint,
// the earlier APZC was scrolled to its extent in the original direction).
// We want to disallow this.
bool scrollThisApzc = false;
if (InputBlockState* block = CurrentInputBlock()) {
if (InputBlockState* block = GetCurrentInputBlock()) {
scrollThisApzc = !block->GetScrolledApzc() || block->IsDownchainOfScrolledApzc(this);
}
@ -2326,7 +2337,7 @@ bool AsyncPanZoomController::AttemptScroll(ParentLayerPoint& aStartPoint,
if (!IsZero(adjustedDisplacement)) {
ScrollBy(adjustedDisplacement / mFrameMetrics.GetZoom());
if (CancelableBlockState* block = CurrentInputBlock()) {
if (CancelableBlockState* block = GetCurrentInputBlock()) {
if (block->AsTouchBlock() && (block->GetScrolledApzc() != this)) {
RefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
@ -2545,8 +2556,9 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
if (prevTouchPoint != touchPoint) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::SCROLL_INPUT_METHODS,
(uint32_t) ScrollInputMethod::ApzTouch);
MOZ_ASSERT(GetCurrentTouchBlock());
OverscrollHandoffState handoffState(
*CurrentTouchBlock()->GetOverscrollHandoffChain(),
*GetCurrentTouchBlock()->GetOverscrollHandoffChain(),
panDistance,
ScrollSource::Touch);
CallDispatchScroll(prevTouchPoint, touchPoint, handoffState);
@ -3611,21 +3623,21 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect, const uint32_t aFlags) {
}
CancelableBlockState*
AsyncPanZoomController::CurrentInputBlock() const
AsyncPanZoomController::GetCurrentInputBlock() const
{
return GetInputQueue()->CurrentBlock();
return GetInputQueue()->GetCurrentBlock();
}
TouchBlockState*
AsyncPanZoomController::CurrentTouchBlock() const
AsyncPanZoomController::GetCurrentTouchBlock() const
{
return GetInputQueue()->CurrentTouchBlock();
return GetInputQueue()->GetCurrentTouchBlock();
}
PanGestureBlockState*
AsyncPanZoomController::CurrentPanGestureBlock() const
AsyncPanZoomController::GetCurrentPanGestureBlock() const
{
return GetInputQueue()->CurrentPanGestureBlock();
return GetInputQueue()->GetCurrentPanGestureBlock();
}
void
@ -3639,7 +3651,7 @@ AsyncPanZoomController::ResetTouchInputState()
CancelAnimationAndGestureState();
// Clear overscroll along the entire handoff chain, in case an APZC
// later in the chain is overscrolled.
if (TouchBlockState* block = CurrentInputBlock()->AsTouchBlock()) {
if (TouchBlockState* block = GetCurrentTouchBlock()) {
block->GetOverscrollHandoffChain()->ClearOverscroll();
}
}

Просмотреть файл

@ -861,11 +861,11 @@ private:
void CancelAnimationAndGestureState();
RefPtr<InputQueue> mInputQueue;
CancelableBlockState* CurrentInputBlock() const;
TouchBlockState* CurrentTouchBlock() const;
CancelableBlockState* GetCurrentInputBlock() const;
TouchBlockState* GetCurrentTouchBlock() const;
bool HasReadyTouchBlock() const;
PanGestureBlockState* CurrentPanGestureBlock() const;
PanGestureBlockState* GetCurrentPanGestureBlock() const;
private:
/* ===================================================================

Просмотреть файл

@ -526,7 +526,8 @@ void GestureEventListener::CreateMaxTapTimeoutTask()
{
mLastTapInput = mLastTouchInput;
TouchBlockState* block = mAsyncPanZoomController->GetInputQueue()->CurrentTouchBlock();
TouchBlockState* block = mAsyncPanZoomController->GetInputQueue()->GetCurrentTouchBlock();
MOZ_ASSERT(block);
RefPtr<CancelableRunnable> task =
NewCancelableRunnableMethod<bool>(this,
&GestureEventListener::HandleInputTimeoutMaxTap,

Просмотреть файл

@ -458,7 +458,12 @@ InputQueue::StartNewTouchBlock(const RefPtr<AsyncPanZoomController>& aTarget,
TouchBlockState* newBlock = new TouchBlockState(aTarget, aTargetConfirmed,
mTouchCounter);
if (aCopyPropertiesFromCurrent) {
newBlock->CopyPropertiesFrom(*CurrentTouchBlock());
// We should never enter here without a current touch block, because this
// codepath is invoked from the OnLongPress handler in
// AsyncPanZoomController, which should bail out if there is no current
// touch block.
MOZ_ASSERT(GetCurrentTouchBlock());
newBlock->CopyPropertiesFrom(*GetCurrentTouchBlock());
}
SweepDepletedBlocks();
@ -470,44 +475,42 @@ InputQueue::StartNewTouchBlock(const RefPtr<AsyncPanZoomController>& aTarget,
}
CancelableBlockState*
InputQueue::CurrentBlock() const
InputQueue::GetCurrentBlock() const
{
APZThreadUtils::AssertOnControllerThread();
MOZ_ASSERT(!mInputBlockQueue.IsEmpty());
if (mInputBlockQueue.IsEmpty()) {
return nullptr;
}
return mInputBlockQueue[0].get();
}
TouchBlockState*
InputQueue::CurrentTouchBlock() const
InputQueue::GetCurrentTouchBlock() const
{
TouchBlockState* block = CurrentBlock()->AsTouchBlock();
MOZ_ASSERT(block);
return block;
CancelableBlockState* block = GetCurrentBlock();
return block ? block->AsTouchBlock() : mActiveTouchBlock.get();
}
WheelBlockState*
InputQueue::CurrentWheelBlock() const
InputQueue::GetCurrentWheelBlock() const
{
WheelBlockState* block = CurrentBlock()->AsWheelBlock();
MOZ_ASSERT(block);
return block;
CancelableBlockState* block = GetCurrentBlock();
return block ? block->AsWheelBlock() : mActiveWheelBlock.get();
}
DragBlockState*
InputQueue::CurrentDragBlock() const
InputQueue::GetCurrentDragBlock() const
{
DragBlockState* block = CurrentBlock()->AsDragBlock();
MOZ_ASSERT(block);
return block;
CancelableBlockState* block = GetCurrentBlock();
return block ? block->AsDragBlock() : mActiveDragBlock.get();
}
PanGestureBlockState*
InputQueue::CurrentPanGestureBlock() const
InputQueue::GetCurrentPanGestureBlock() const
{
PanGestureBlockState* block = CurrentBlock()->AsPanGestureBlock();
MOZ_ASSERT(block);
return block;
CancelableBlockState* block = GetCurrentBlock();
return block ? block->AsPanGestureBlock() : mActivePanGestureBlock.get();
}
WheelBlockState*
@ -531,12 +534,11 @@ InputQueue::HasReadyTouchBlock() const
bool
InputQueue::AllowScrollHandoff() const
{
MOZ_ASSERT(CurrentBlock());
if (CurrentBlock()->AsWheelBlock()) {
return CurrentBlock()->AsWheelBlock()->AllowScrollHandoff();
if (GetCurrentWheelBlock()) {
return GetCurrentWheelBlock()->AllowScrollHandoff();
}
if (CurrentBlock()->AsPanGestureBlock()) {
return CurrentBlock()->AsPanGestureBlock()->AllowScrollHandoff();
if (GetCurrentPanGestureBlock()) {
return GetCurrentPanGestureBlock()->AllowScrollHandoff();
}
return true;
}
@ -680,8 +682,8 @@ InputQueue::ProcessInputBlocks() {
APZThreadUtils::AssertOnControllerThread();
do {
CancelableBlockState* curBlock = CurrentBlock();
if (!curBlock->IsReadyForHandling()) {
CancelableBlockState* curBlock = GetCurrentBlock();
if (!curBlock || !curBlock->IsReadyForHandling()) {
break;
}

Просмотреть файл

@ -91,18 +91,21 @@ public:
*/
uint64_t InjectNewTouchBlock(AsyncPanZoomController* aTarget);
/**
* Returns the pending input block at the head of the queue.
* Returns the pending input block at the head of the queue, if there is one.
* This may return null if there all input events have been processed.
*/
CancelableBlockState* CurrentBlock() const;
/**
* Returns the current pending input block as a specific kind of block.
* These methods must only be called if the current pending block is of the
* requested type.
CancelableBlockState* GetCurrentBlock() const;
/*
* Returns the current pending input block as a specific kind of block. If
* GetCurrentBlock() returns null, these functions additionally check the
* mActiveXXXBlock field of the corresponding input type to see if there is
* a depleted but still active input block, and returns that if found. These
* functions may return null if no block is found.
*/
TouchBlockState* CurrentTouchBlock() const;
WheelBlockState* CurrentWheelBlock() const;
DragBlockState* CurrentDragBlock() const;
PanGestureBlockState* CurrentPanGestureBlock() const;
TouchBlockState* GetCurrentTouchBlock() const;
WheelBlockState* GetCurrentWheelBlock() const;
DragBlockState* GetCurrentDragBlock() const;
PanGestureBlockState* GetCurrentPanGestureBlock() const;
/**
* Returns true iff the pending block at the head of the queue is ready for
* handling.