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

RESOLVED FIXED in Firefox 66

Status

()

enhancement
P3
normal
RESOLVED FIXED
6 months ago
4 months ago

People

(Reporter: botond, Assigned: botond)

Tracking

(Blocks 2 bugs)

Trunk
mozilla66
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox65 wontfix, firefox66 fixed)

Details

Attachments

(2 attachments)

Assignee

Description

6 months ago
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).
Assignee

Updated

5 months ago
Blocks: 1516722
Assignee

Updated

5 months ago
Blocks: 1516471
Assignee

Comment 1

5 months ago
(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.
Assignee

Updated

5 months ago
Blocks: 1516056
Assignee

Updated

5 months ago
Assignee: nobody → botond
Assignee

Updated

5 months ago
Blocks: 1509575
Assignee

Updated

5 months ago
Blocks: 1517895
Assignee

Updated

5 months ago
No longer blocks: 1516056
Assignee

Comment 4

4 months ago

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.

Comment 5

4 months ago
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
Assignee

Updated

4 months ago
Blocks: 1519285

Comment 6

4 months ago
bugherder
Status: NEW → RESOLVED
Last Resolved: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.