Confusion between logical and absolute scroll position for session history?
Categories
(Core :: Layout: Scrolling and Overflow, enhancement, P3)
Tracking
()
People
(Reporter: JanH, Unassigned)
Details
nsGfxScrollFrame normally uses GetLogicalVisualViewportOffset() when retrieving the current scroll position while dealing with session history.
Conversely, when restoring the scroll position we're transforming it back into an absolute one [1] before calling scrollTo().
There is one exception, though: If we're currently in a smooth scroll, the save logic just stores mDestination
directly without turning it into a logical scroll position [2]. I suspect that this isn't correct.
[1] https://searchfox.org/mozilla-central/rev/b29663c6c9c61b0bf29e8add490cbd6bad293a67/layout/generic/nsGfxScrollFrame.cpp#4339
[2] https://searchfox.org/mozilla-central/rev/b29663c6c9c61b0bf29e8add490cbd6bad293a67/layout/generic/nsGfxScrollFrame.cpp#6149
Comment 2•6 years ago
|
||
Jan's assessment seems accurate to me. It's likely an oversight.
One technique to avoid issues like this, that we've used with success elsewhere, is to represent logical vs. physical scroll offsets as different types. We have infrastructure to support this with out PointTyped
and IntPointTyped
classes [1], which allow encoding a "label" (Units
) in the type of a point.
Updated•3 years ago
|
Description
•