зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1349750 - Have APZ initiate async scrollbar dragging when possible. r=kats
MozReview-Commit-ID: 1snCEl6H9bN --HG-- extra : rebase_source : dce1353e5ccebfacd5d100719ebb684dfa0f516b
This commit is contained in:
Родитель
390338b8cd
Коммит
6606b827b5
|
@ -781,7 +781,8 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
MouseInput& mouseInput = aEvent.AsMouseInput();
|
||||
mouseInput.mHandledByAPZ = true;
|
||||
|
||||
if (DragTracker::StartsDrag(mouseInput)) {
|
||||
bool startsDrag = DragTracker::StartsDrag(mouseInput);
|
||||
if (startsDrag) {
|
||||
// If this is the start of a drag we need to unambiguously know if it's
|
||||
// going to land on a scrollbar or not. We can't apply an untransform
|
||||
// here without knowing that, so we need to ensure the untransform is
|
||||
|
@ -805,7 +806,8 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
|
||||
if (apzc) {
|
||||
bool targetConfirmed = (hitResult != HitNothing && hitResult != HitDispatchToContentRegion);
|
||||
if (gfxPrefs::APZDragEnabled() && hitScrollbar) {
|
||||
bool apzDragEnabled = gfxPrefs::APZDragEnabled();
|
||||
if (apzDragEnabled && hitScrollbar) {
|
||||
// If scrollbar dragging is enabled and we hit a scrollbar, wait
|
||||
// for the main-thread confirmation because it contains drag metrics
|
||||
// that we need.
|
||||
|
@ -815,6 +817,34 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
|
|||
apzc, targetConfirmed,
|
||||
mouseInput, aOutInputBlockId);
|
||||
|
||||
// Under some conditions, we can confirm the drag block right away.
|
||||
// Otherwise, we have to wait for a main-thread confirmation.
|
||||
if (apzDragEnabled && startsDrag && hitScrollbarNode &&
|
||||
hitScrollbarNode->IsScrollThumbNode() &&
|
||||
hitScrollbarNode->GetScrollThumbData().mIsAsyncDraggable &&
|
||||
// check that the scrollbar's target scroll frame is layerized
|
||||
hitScrollbarNode->GetScrollTargetId() == apzc->GetGuid().mScrollId &&
|
||||
!apzc->IsScrollInfoLayer() && mInputQueue->GetCurrentDragBlock()) {
|
||||
uint64_t dragBlockId = mInputQueue->GetCurrentDragBlock()->GetBlockId();
|
||||
const ScrollThumbData& thumbData = hitScrollbarNode->GetScrollThumbData();
|
||||
// AsyncPanZoomController::HandleInputEvent() will call
|
||||
// TransformToLocal() on the event, but we need its mLocalOrigin now
|
||||
// to compute a drag start offset for the AsyncDragMetrics.
|
||||
mouseInput.TransformToLocal(apzc->GetTransformToThis());
|
||||
CSSCoord dragStart = apzc->ConvertScrollbarPoint(
|
||||
mouseInput.mLocalOrigin, thumbData);
|
||||
// ConvertScrollbarPoint() got the drag start offset relative to
|
||||
// the scroll track. Now get it relative to the thumb.
|
||||
dragStart -= thumbData.mThumbStart;
|
||||
mInputQueue->ConfirmDragBlock(
|
||||
dragBlockId, apzc,
|
||||
AsyncDragMetrics(apzc->GetGuid().mScrollId,
|
||||
apzc->GetGuid().mPresShellId,
|
||||
dragBlockId,
|
||||
dragStart,
|
||||
thumbData.mDirection));
|
||||
}
|
||||
|
||||
if (result == nsEventStatus_eConsumeDoDefault) {
|
||||
// This input event is part of a drag block, so whether or not it is
|
||||
// directed at a scrollbar depends on whether the drag block started
|
||||
|
|
Загрузка…
Ссылка в новой задаче