Keep position:fixed elements attached to the layout viewport during async scrolling (WebRender implementation)
Categories
(Core :: Graphics: WebRender, enhancement, P2)
Tracking
()
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.
Reporter | ||
Comment 1•4 years ago
|
||
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.
Reporter | ||
Comment 2•4 years ago
|
||
A rough outline of how to go about implementing these changes for WebRender:
- In
APZCTreeManager::SampleForWebRender()
, for the root content APZC (apzc->IsRootContent()
), instead of querying the entire async transform, query theeLayout
andeVisual
components separately (see AsyncCompositionManager for example API usage). - Report the
eLayout
component normally viaUpdateScrollPosition()
. - For the
eVisual
component, report it separately as a transform applying to the async zoom container.- I think that tacking it onto the existing transform reported via
zoomAnimationId
should work, but this needs verification. - We may need changes on the WebRender side if currently WR is only expecting a scale for
zoomAnimationId
.
- I think that tacking it onto the existing transform reported via
Reporter | ||
Comment 3•4 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #2)
- I think that tacking it onto the existing transform reported via
zoomAnimationId
should work, but this needs verification.
(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.)
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 4•4 years ago
|
||
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 | ||
Comment 5•4 years ago
|
||
Updated•4 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
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
Comment 8•4 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2c45e23bf71f
https://hg.mozilla.org/mozilla-central/rev/72e0cabfec72
Description
•