зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1265424 - Record if the target was confirmed via a timeout or not. r=botond
MozReview-Commit-ID: BMiJsKlh2HB
This commit is contained in:
Родитель
575dbe7dfd
Коммит
38176020f4
|
@ -25,7 +25,8 @@ static uint64_t sBlockCounter = InputBlockState::NO_BLOCK_ID + 1;
|
|||
InputBlockState::InputBlockState(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
bool aTargetConfirmed)
|
||||
: mTargetApzc(aTargetApzc)
|
||||
, mTargetConfirmed(aTargetConfirmed)
|
||||
, mTargetConfirmed(aTargetConfirmed ? TargetConfirmationState::eConfirmed
|
||||
: TargetConfirmationState::eUnconfirmed)
|
||||
, mBlockId(sBlockCounter++)
|
||||
, mTransformToApzc(aTargetApzc->GetTransformToThis())
|
||||
{
|
||||
|
@ -35,12 +36,16 @@ InputBlockState::InputBlockState(const RefPtr<AsyncPanZoomController>& aTargetAp
|
|||
}
|
||||
|
||||
bool
|
||||
InputBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc)
|
||||
InputBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
TargetConfirmationState aState)
|
||||
{
|
||||
if (mTargetConfirmed) {
|
||||
MOZ_ASSERT(aState == TargetConfirmationState::eConfirmed
|
||||
|| aState == TargetConfirmationState::eTimedOut);
|
||||
|
||||
if (mTargetConfirmed != TargetConfirmationState::eUnconfirmed) {
|
||||
return false;
|
||||
}
|
||||
mTargetConfirmed = true;
|
||||
mTargetConfirmed = aState;
|
||||
|
||||
TBS_LOG("%p got confirmed target APZC %p\n", this, mTargetApzc.get());
|
||||
if (mTargetApzc == aTargetApzc) {
|
||||
|
@ -85,7 +90,7 @@ InputBlockState::GetBlockId() const
|
|||
bool
|
||||
InputBlockState::IsTargetConfirmed() const
|
||||
{
|
||||
return mTargetConfirmed;
|
||||
return mTargetConfirmed != TargetConfirmationState::eUnconfirmed;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -359,7 +364,8 @@ WheelBlockState::SetContentResponse(bool aPreventDefault)
|
|||
}
|
||||
|
||||
bool
|
||||
WheelBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc)
|
||||
WheelBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
TargetConfirmationState aState)
|
||||
{
|
||||
// The APZC that we find via APZCCallbackHelpers may not be the same APZC
|
||||
// ESM or OverscrollHandoff would have computed. Make sure we get the right
|
||||
|
@ -370,7 +376,7 @@ WheelBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aT
|
|||
apzc = apzc->BuildOverscrollHandoffChain()->FindFirstScrollable(event);
|
||||
}
|
||||
|
||||
InputBlockState::SetConfirmedTargetApzc(apzc);
|
||||
InputBlockState::SetConfirmedTargetApzc(apzc, aState);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -603,7 +609,8 @@ PanGestureBlockState::PanGestureBlockState(const RefPtr<AsyncPanZoomController>&
|
|||
}
|
||||
|
||||
bool
|
||||
PanGestureBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc)
|
||||
PanGestureBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
TargetConfirmationState aState)
|
||||
{
|
||||
// The APZC that we find via APZCCallbackHelpers may not be the same APZC
|
||||
// ESM or OverscrollHandoff would have computed. Make sure we get the right
|
||||
|
@ -618,7 +625,7 @@ PanGestureBlockState::SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController
|
|||
}
|
||||
}
|
||||
|
||||
InputBlockState::SetConfirmedTargetApzc(apzc);
|
||||
InputBlockState::SetConfirmedTargetApzc(apzc, aState);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,12 +39,19 @@ class InputBlockState
|
|||
public:
|
||||
static const uint64_t NO_BLOCK_ID = 0;
|
||||
|
||||
enum class TargetConfirmationState {
|
||||
eUnconfirmed,
|
||||
eTimedOut,
|
||||
eConfirmed
|
||||
};
|
||||
|
||||
explicit InputBlockState(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
bool aTargetConfirmed);
|
||||
virtual ~InputBlockState()
|
||||
{}
|
||||
|
||||
virtual bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc);
|
||||
virtual bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
TargetConfirmationState aState);
|
||||
const RefPtr<AsyncPanZoomController>& GetTargetApzc() const;
|
||||
const RefPtr<const OverscrollHandoffChain>& GetOverscrollHandoffChain() const;
|
||||
uint64_t GetBlockId() const;
|
||||
|
@ -65,7 +72,7 @@ private:
|
|||
|
||||
private:
|
||||
RefPtr<AsyncPanZoomController> mTargetApzc;
|
||||
bool mTargetConfirmed;
|
||||
TargetConfirmationState mTargetConfirmed;
|
||||
const uint64_t mBlockId;
|
||||
|
||||
// The APZC that was actually scrolled by events in this input block.
|
||||
|
@ -227,7 +234,8 @@ public:
|
|||
void HandleEvents() override;
|
||||
bool MustStayActive() override;
|
||||
const char* Type() override;
|
||||
bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc) override;
|
||||
bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
TargetConfirmationState aState) override;
|
||||
|
||||
void AddEvent(const ScrollWheelInput& aEvent);
|
||||
|
||||
|
@ -348,7 +356,8 @@ public:
|
|||
void HandleEvents() override;
|
||||
bool MustStayActive() override;
|
||||
const char* Type() override;
|
||||
bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc) override;
|
||||
bool SetConfirmedTargetApzc(const RefPtr<AsyncPanZoomController>& aTargetApzc,
|
||||
TargetConfirmationState aState) override;
|
||||
|
||||
void AddEvent(const PanGestureInput& aEvent);
|
||||
|
||||
|
|
|
@ -118,7 +118,8 @@ InputQueue::ReceiveTouchInput(const RefPtr<AsyncPanZoomController>& aTarget,
|
|||
// from a fast fling to a pinch state (i.e. second finger goes down while
|
||||
// the first finger is moving).
|
||||
block->SetDuringFastFling();
|
||||
block->SetConfirmedTargetApzc(aTarget);
|
||||
block->SetConfirmedTargetApzc(aTarget,
|
||||
InputBlockState::TargetConfirmationState::eConfirmed);
|
||||
if (gfxPrefs::TouchActionEnabled()) {
|
||||
block->SetAllowedTouchBehaviors(currentBehaviors);
|
||||
}
|
||||
|
@ -586,7 +587,9 @@ InputQueue::MainThreadTimeout(const uint64_t& aInputBlockId) {
|
|||
// target apzc in the case where the main thread doesn't get back to us
|
||||
// fast enough.
|
||||
success = mInputBlockQueue[i]->TimeoutContentResponse();
|
||||
success |= mInputBlockQueue[i]->SetConfirmedTargetApzc(mInputBlockQueue[i]->GetTargetApzc());
|
||||
success |= mInputBlockQueue[i]->SetConfirmedTargetApzc(
|
||||
mInputBlockQueue[i]->GetTargetApzc(),
|
||||
InputBlockState::TargetConfirmationState::eTimedOut);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +627,8 @@ InputQueue::SetConfirmedTargetApzc(uint64_t aInputBlockId, const RefPtr<AsyncPan
|
|||
for (size_t i = 0; i < mInputBlockQueue.Length(); i++) {
|
||||
CancelableBlockState* block = mInputBlockQueue[i].get();
|
||||
if (block->GetBlockId() == aInputBlockId) {
|
||||
success = block->SetConfirmedTargetApzc(aTargetApzc);
|
||||
success = block->SetConfirmedTargetApzc(aTargetApzc,
|
||||
InputBlockState::TargetConfirmationState::eConfirmed);
|
||||
block->RecordContentResponseTime();
|
||||
break;
|
||||
}
|
||||
|
@ -647,7 +651,8 @@ InputQueue::ConfirmDragBlock(uint64_t aInputBlockId, const RefPtr<AsyncPanZoomCo
|
|||
DragBlockState* block = mInputBlockQueue[i]->AsDragBlock();
|
||||
if (block && block->GetBlockId() == aInputBlockId) {
|
||||
block->SetDragMetrics(aDragMetrics);
|
||||
success = block->SetConfirmedTargetApzc(aTargetApzc);
|
||||
success = block->SetConfirmedTargetApzc(aTargetApzc,
|
||||
InputBlockState::TargetConfirmationState::eConfirmed);
|
||||
block->RecordContentResponseTime();
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче