Refactor Layout 2020 layout for a compositor-side scroll tree

This change refactors how layout is done in Layout 2020 in preparation
for a compositor-side scroll tree:

1. Now the SpatialId and ClipId of each fragment is stored separately.
   This will allow storing a scroll node id instead of only the handle
   to the WebRender spatial node.
2. Separate out stacking context tree construction and display list
   building. This change will make it possible to eventually build the
   stacking context tree without the full display list if we find that
   necessary. For instance, this might be useful to cache containing
   block boundaries.
3. Add a `DisplayList` struct that stores both the WebRender display
   list builder and the compositor info. This exposes the API to the
   layout thread for display list building.

In addition, this change adds a lot of missing documentation.  This
should not change behavior.
This commit is contained in:
Martin Robinson 2023-05-15 10:35:45 +02:00
parent c5d31c3ab6
commit b60e105526
5 changed files with 326 additions and 178 deletions

View file

@ -144,9 +144,9 @@ pub(super) fn build_linear(
let stops = fixup_stops(style, items, Length::new(gradient_line_length));
let linear_gradient = builder
.wr
.wr()
.create_gradient(start_point, end_point, stops, extend_mode);
builder.wr.push_gradient(
builder.wr().push_gradient(
&layer.common,
layer.bounds,
linear_gradient,
@ -244,9 +244,9 @@ pub(super) fn build_radial(
let stops = fixup_stops(style, items, Length::new(gradient_line_length));
let radial_gradient = builder
.wr
.wr()
.create_radial_gradient(center, radii, stops, extend_mode);
builder.wr.push_radial_gradient(
builder.wr().push_radial_gradient(
&layer.common,
layer.bounds,
radial_gradient,