-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix RangeMaintainingScrollPhysics #63146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it! This is what I was trying to do but it is a much simpler way of tracking it.
jacob314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
As it stands this breaks a bunch of tests. :-/ Investigating... |
055dc79 to
ca024e5
Compare
|
Well it passes the tests now, at least. |
|
@Hixie I've stared testing with this patch, and so far so good. Thanks! |
We definitely shouldn't just add epsilon, but maybe we could use |
goderbauer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should update the docs on RangeMaintainingScrollPhysics indicate that there are more cases where the range is not maintained.
It now uses the scroll metrics as they stood at the end of the last frame. It previously used a weird combination of the old extents and the newish position, which led to some weird effects when the position had been changed in expectation of a viewport or content dimension change.
|
Added more documentation. Will land on green unless I hear otherwise. Thanks for the reviews! |
|
Since this is a 1.20 cherrypick candidate, I landed on green. |
|
Fix for #60288 |
| _pendingDimensions = false; | ||
| } | ||
| assert(!_didChangeViewportDimensionOrReceiveCorrection, 'Use correctForNewDimensions() (and return true) to change the scroll offset during applyContentDimensions().'); | ||
| _lastMetrics = copyWith(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fixed!
We can not use the oldPosition above, for example, the _PagePosition.applyViewportDimension will correct the pixels due to resizing from zero, and it will cause RangeMaintainingScrollPhysics.adjustPositionForNewDimensions mistake. I am currently fix this bug (#65015 ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave this as-is in my reland and will let you follow up in #65015 (i'll review that shortly, sorry i missed that until now)
| } | ||
| } | ||
| if ((oldPosition.pixels < oldPosition.minScrollExtent) && | ||
| (oldPosition.pixels > oldPosition.maxScrollExtent)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
if ((oldPosition.pixels < oldPosition.minScrollExtent) ||
(oldPosition.pixels > oldPosition.maxScrollExtent))
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, how did that not get caught by the tests, yikes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing it doesn't cause any test failures even! what on earth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix in #65135
| /// | ||
| /// The second is to enforce the boundary when the position is in range. | ||
| /// | ||
| /// If the current velocity is zero, neither adjustment is made. The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the current velocity is non-zero
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. will fix in the reland.
It now uses the scroll metrics as they stood at the end of the last frame. It previously used a weird combination of the old extents and the newish position, which led to some weird effects when the position had been changed in expectation of a viewport or content dimension change.
It now uses the scroll metrics as they stood at the end of the last frame. It previously used a weird combination of the old extents and the newish position, which led to some weird effects when the position had been changed in expectation of a viewport or content dimension change.

It now uses the scroll metrics as they stood at the end of the last frame.
It previously used a weird combination of the old extents and the newish position, which led to some weird effects when the position had been changed in expectation of a viewport or content dimension change.