Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImprove clipping and positioning documentation #2892
Conversation
leeoniya
commented
Jul 13, 2018
|
Thanks for writing this documentation! I read through it and it clarified a few things for me. I agree that differentiating between the three kinds of things in the API would be good and make things more robust. I was looking at the gecko side code and it seems like every clip node that we create with a parent has what is effectively a spatial node as the parent (i.e. it's the WrClipId corresponding to a scroll frame, a reference frame, or a sticky node) with one exception: here we create a clip node with a mask, and then use that clip code as the parent for other clip nodes that might get defined on items nested inside the mask. If we can do this in a different way (e.g. including the mask in the clip chain of the nested items) then that would clean this up and we should be able to separate WrClipId from a WrSpatialNodeId on the gecko side. That would be a good first step towards a better API, I think. |
|
Nice writeup, thank you! I got a few questions/concerns. |
| # Original Design | ||
|
|
||
| To understand the current design for clipping and positioning (transformations | ||
| and scrolling) in WebRender if can be useful to have a little background about |
This comment has been minimized.
This comment has been minimized.
| intersecting content from outside the scroll area. | ||
| 3. Items in the same scrolling root, clipped by different clips one or more of | ||
| which are defined outside the scrolling root itself. | ||
| 4. Items which are clipped by some clips in the hierarchy, but not others ie |
This comment has been minimized.
This comment has been minimized.
| elements. Every display list item has an assigned `ClipChain` which | ||
| specifies what `ClipNodes` are applied to that item. | ||
|
|
||
| The `SpatialNode` of the clips applied to each item are completely independent of |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mrobinson
Jul 16, 2018
Author
Member
I changed this to make the inflection of the noun match the subject.
|
|
||
| One holdover from the previous design is that both `ClipNode` and `SpatialNodes` | ||
| have a parent node, which is either a `SpatialNode` or a `ClipNode`. From this | ||
| node WebRender can determine both a parent `ClipNode` and a parent `SpatialNode` |
This comment has been minimized.
This comment has been minimized.
kvark
Jul 13, 2018
Member
This is confusing me quite a bit. Why do we want to support the ClipNode being a parent, ever?
This comment has been minimized.
This comment has been minimized.
mrobinson
Jul 16, 2018
Author
Member
Nowadays there is no reason this has to be the case, but consider that in the past the only way to combine clip nodes was to have them be part of the ancestry in the ClipScrollTree. With the ClipChain API and the fact that an item can have both a positioning node and clip node assigned, it isn't strictly necessary. Once both Gecko and Servo are using the ClipChain API for all clips and never using ClipNodes as positioning nodes, we can fix this for good.
This comment has been minimized.
This comment has been minimized.
kvark
Jul 16, 2018
Member
Thank you for explanation! @staktrace do you know if there is an issue to file/track for this on Gecko side?
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| # Clipping and Positioning in the Display List | ||
|
|
||
| Each non-structural WebRender display list item has | ||
| * A `ClipId` of a `SpatialNode` or `ClipNode` for positioning |
This comment has been minimized.
This comment has been minimized.
| to the evolutionary nature of the design. The general trend is that the display | ||
| list gradually moves toward the internal representation. The most important of | ||
| these incongruities is that while `ClipNodes`, sticky frames, and scroll frames | ||
| are defined and simply return a ClipId, reference frames return a ClipId, but |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| ## Converting `ClipId` to global `ClipScrollTree` indices | ||
|
|
||
| WebRender must access `ClipNodes` and `SpatialNodes` quite a bit when building | ||
| scenes and frames, so it tries to convert `CiipIds`, which are already |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| WebRender must access `ClipNodes` and `SpatialNodes` quite a bit when building | ||
| scenes and frames, so it tries to convert `CiipIds`, which are already | ||
| per-pipeline indices, to global scene-wide indices. Internally this a |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| scene-wide `ClipScrollTree`. | ||
|
|
||
| Nodes are added to their respective arrays sequentially as the display list is | ||
| processed during "flattening." When encountering an iframe, the |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mrobinson
Jul 16, 2018
Author
Member
So weirdly this is the style in American English, which I admit is bizarre. Since the rest of the document is written in American English though, maybe it makes sense to be consistent here.
|
This will be great to have updated, thanks! |
|
Thanks for the review! I've updated the PR fixing the issues you mentioned and leaving comments in others. |
| # Original Design | ||
|
|
||
| To understand the current design for clipping and positioning (transformations | ||
| and scrolling) in WebRender if can be useful to have a little background about |
This comment has been minimized.
This comment has been minimized.
| elements. Every display list item has an assigned `ClipChain` which | ||
| specifies what `ClipNodes` are applied to that item. | ||
|
|
||
| The `SpatialNode` of the clips applied to each item are completely independent of |
This comment has been minimized.
This comment has been minimized.
mrobinson
Jul 16, 2018
Author
Member
I changed this to make the inflection of the noun match the subject.
|
|
||
| One holdover from the previous design is that both `ClipNode` and `SpatialNodes` | ||
| have a parent node, which is either a `SpatialNode` or a `ClipNode`. From this | ||
| node WebRender can determine both a parent `ClipNode` and a parent `SpatialNode` |
This comment has been minimized.
This comment has been minimized.
mrobinson
Jul 16, 2018
Author
Member
Nowadays there is no reason this has to be the case, but consider that in the past the only way to combine clip nodes was to have them be part of the ancestry in the ClipScrollTree. With the ClipChain API and the fact that an item can have both a positioning node and clip node assigned, it isn't strictly necessary. Once both Gecko and Servo are using the ClipChain API for all clips and never using ClipNodes as positioning nodes, we can fix this for good.
| to the evolutionary nature of the design. The general trend is that the display | ||
| list gradually moves toward the internal representation. The most important of | ||
| these incongruities is that while `ClipNodes`, sticky frames, and scroll frames | ||
| are defined and simply return a ClipId, reference frames return a ClipId, but |
This comment has been minimized.
This comment has been minimized.
| ## Converting `ClipId` to global `ClipScrollTree` indices | ||
|
|
||
| WebRender must access `ClipNodes` and `SpatialNodes` quite a bit when building | ||
| scenes and frames, so it tries to convert `CiipIds`, which are already |
This comment has been minimized.
This comment has been minimized.
|
|
||
| WebRender must access `ClipNodes` and `SpatialNodes` quite a bit when building | ||
| scenes and frames, so it tries to convert `CiipIds`, which are already | ||
| per-pipeline indices, to global scene-wide indices. Internally this a |
This comment has been minimized.
This comment has been minimized.
| scene-wide `ClipScrollTree`. | ||
|
|
||
| Nodes are added to their respective arrays sequentially as the display list is | ||
| processed during "flattening." When encountering an iframe, the |
This comment has been minimized.
This comment has been minimized.
mrobinson
Jul 16, 2018
Author
Member
So weirdly this is the style in American English, which I admit is bizarre. Since the rest of the document is written in American English though, maybe it makes sense to be consistent here.
The new documentation gives a more complete and up-to-date picture of WebRender's clipping and positioning architecture.
|
@bors-servo r+ |
|
|
Improve clipping and positioning documentation The new documentation gives a more complete and up-to-date picture of WebRender's clipping and positioning architecture. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2892) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
Improve clipping and positioning documentation The new documentation gives a more complete and up-to-date picture of WebRender's clipping and positioning architecture. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2892) <!-- Reviewable:end -->
|
|
mrobinson commentedJul 13, 2018
•
edited by larsbergstrom
The new documentation gives a more complete and up-to-date picture of
WebRender's clipping and positioning architecture.
This change is