Closed Bug 1609002 Opened 4 years ago Closed 4 years ago

Keep position:fixed elements attached to the layout viewport during async scrolling (WebRender implementation)

Categories

(Core :: Graphics: WebRender, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: botond, Assigned: jnicol)

References

Details

Attachments

(2 files)

When we implemented bug 656036 (attaching position:fixed elements to the layout viewport rather than the visual viewport), one piece of that work was compositor changes to keep fixed elements attached to the layout viewport during async scrolling.

The compositor changes were implemented for non-WebRender, which was sufficient at the time because the behaviour change only affected platforms with zooming, i.e. only Android, which did not use WebRender.

However, we now want to bring WebRender to Android (and, in parallel, we are bringing zooming to desktop which already uses WebRender in some cases), so we need to implement corresponding compositor changes in WebRender.

Conceptually, the compositor changes we made in bug 656036 were as follows:

  • Instead of every APZC having a single "async transform", the root content APZC's "async transform" is divided into two components: a "visual" component (representing async scrolling of the visual viewport relative to the layout viewport), and a "layout" component (representing async scrolling of the layout viewport relative to the document).
  • Instead of the root content APZC's entire async transform being applied to content scrolled by the root APZC, only the "layout" component is applied to that content.
  • The "visual" component is instead applied to the entire "async zoom container", which includes not only the scrolled content but also position:fixed content.

A rough outline of how to go about implementing these changes for WebRender:

(In reply to Botond Ballo [:botond] from comment #2)

(The fact that on the Gecko side, we set the zoom animation id specifically on the async zoom container display item, suggests that this should work, or at least is the right approach.)

Priority: -- → P2

Summary of mine and Botond's further conversations on slack, after attempting to implement what's described in comment 2:

  • AsyncPanZoomController::GetCurrentAsyncTransform() returns on the asynchronous part of the transform, ie the difference between the current transform and the transform at the previous content paint.
  • The value of the scale set in zoomAnimationId is expected to be the total zoom, ie sync and async combined.
  • The sync part of the translation is already baked in to the previous sent display list (via the display items bounds)
  • The async part of the translation must be in post-scaled coordinate space.

Combining these, means the transform we set zoomAnimationId to should be:

zoom = apzc->GetCurrentPinchZoomScale();
translation = apzc->GetCurrentAsyncTransform(eVisual).mTranslation;
transform = Matrix4x4::Scaling(zoom.scale, zoom.scale, 1.0f) * Matrix4x4::Translation(translation);

Seems to work on local builds, testing on try now.

Assignee: nobody → jnicol
Status: NEW → ASSIGNED

Depends on D60292

Pushed by jnicol@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2c45e23bf71f
Attach fixed-position elements to the layout viewport in webrender. r=botond
https://hg.mozilla.org/integration/autoland/rev/72e0cabfec72
Update test expectations. r=botond
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
Regressions: 1613144
Regressions: 1620014
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: