0

[TabStripRefactor] Fixed bug with updateReorder

Bug: 381285152
Change-Id: I3d954ed870543c1e652e00cc08ef69eae40878e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6129290
Auto-Submit: Sirisha Kavuluru <skavuluru@google.com>
Reviewed-by: Zhe Li <zheliooo@google.com>
Commit-Queue: Sirisha Kavuluru <skavuluru@google.com>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1400976}
This commit is contained in:
Sirisha Kavuluru
2024-12-30 11:35:59 -08:00
committed by Chromium LUCI CQ
parent e073c66f62
commit 08fd62903c

@ -255,10 +255,15 @@ public class ReorderDelegate {
float deltaX) {
assert mActiveStrategy != null && getInReorderMode()
: "Attempted to update reorder without an active Strategy.";
// Update reorder scroll state / reorderX, return if accumulated delta is too small.
boolean success = updateReorderState(endX, deltaX);
if (!success) return;
mActiveStrategy.updateReorderPosition(stripViews, groupTitles, stripTabs, endX, deltaX);
// Return if accumulated delta is too small. This isn't the accumulated delta since the
// beginning of the drag. It accumulates the delta X until a threshold is crossed and then
// the event gets processed.
float accumulatedDeltaX = endX - getLastReorderX();
if (Math.abs(accumulatedDeltaX) < 1.f) return;
// Update reorder scroll state / reorderX.
updateReorderState(endX, deltaX);
mActiveStrategy.updateReorderPosition(
stripViews, groupTitles, stripTabs, endX, accumulatedDeltaX);
}
/**
@ -633,15 +638,7 @@ public class ReorderDelegate {
mLastReorderX = startX;
}
/**
* @return Whether reorder update can be processed further.
*/
private boolean updateReorderState(float endX, float deltaX) {
// This isn't the accumulated delta since the beginning of the drag. It accumulates
// the delta X until a threshold is crossed and then the event gets processed.
float accumulatedDeltaX = endX - getLastReorderX();
if (Math.abs(accumulatedDeltaX) < 1.f) return false;
private void updateReorderState(float endX, float deltaX) {
if (!LocalizationUtils.isLayoutRtl()) {
if (deltaX >= 1.f) {
mReorderScrollState |= REORDER_SCROLL_RIGHT;
@ -657,7 +654,6 @@ public class ReorderDelegate {
}
mLastReorderX = endX;
return true;
}
/**