Closed Bug 1507279 Opened 6 years ago Closed 6 years ago

Add an internal API for setting the visual viewport offset from the main thread

Categories

(Core :: Panning and Zooming, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox65 --- wontfix
firefox66 --- fixed

People

(Reporter: botond, Assigned: botond)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Several internal consumers (e.g. session history, scroll anchoring) have a need to change the visual viewport offset from the main thread. This bug tracks adding an internal API for making such changes. The API can live in nsIPresShell for C++ consumers, with an nsIDOMWindowUtils wrapper for JS consumers. The implementation would send a message to APZ and update the RCD-RSF visual viewport offset, while leaving the layout viewport offset alone (modulo changes needed to keep the layout viewport enclosing the visual viewport).
Blocks: 1516722
Blocks: 1516471
(In reply to Botond Ballo [:botond] from comment #0) > The implementation would send a message to APZ and update the RCD-RSF visual > viewport offset, while leaving the layout viewport offset alone (modulo > changes needed to keep the layout viewport enclosing the visual viewport). After thinking about this some more, I think it would make more sense to send the update as part of the next transaction, rather than having a separate message. We can add a "visual viewport offset updated" flag to ScrollMetadata, and have APZ accept both the layout and visual offsets sent by the main thread.
Blocks: 1516056
Assignee: nobody → botond
Blocks: 1509575
Blocks: 1517895
No longer blocks: 1516056

I would have liked to avoid introducing FrameMetrics::mVisualViewportOffset, but that would have required some refactoring that I haven't done yet, and I didn't want to risk this not landing in 66 given all the things in blocks.

For an example use of the API, see this patch.

Pushed by bballo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/bea2de966d14 Add a mechanism for the main thread to set a visual viewport offset. r=kats https://hg.mozilla.org/integration/autoland/rev/47c259e23cfe Expose the visual scrolling mechanism to internal JS users. r=kats
Blocks: 1519285
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
Regressions: 1629030
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: