Hi,
In Grid Layout we have a optimization in the painting code since many
years ago.
Basically it avoids to loop all the children (grid items) of a grid
container in order to paint it. Instead if check which columns and rows
are "visible" and paint only the items in those (there are corner cases
and things like that but this is the main idea). That way we avoid to
loop all the grid items on painting and we only process the ones that
are visible.
This optimization is implemented in GridPainter::PaintChildren() [1],
where we use paint_info.GetCullRect().Rect() to check what we should paint.
However we have realized that lately (we don't know since when it
happens) this CullRect is really big.
For example in a 800x600 window, if the grid is bigger than that like
1000x1000 we get that size as the CullRect. If we have a grid of
2000x2000, again we get 2000x2000. Only if we have something huge like
5000x5000 (or bigger) then we get 4800x4600.
With such big numbers the grid specific optimization doesn't make sense
anymore, as we're having a more complex code and likely painting the
whole grid in most cases.
BTW, this is not noticeable on the perftests as they measure layout time
and not painting, so we didn't get any regression because of this.
So the question is if anyone know when this was modified or why we're
seeing such big CullRects?
And if this is the expected behavior for that, probably we should just
remove the Grid Layout optimization to simplify the code.
What do you think?
Thanks,
Rego
[1]
https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/paint/grid_painter.cc?l=47