[webkit-changes] [WebKit/WebKit] ba849a: [css-grid] Grid track sizing algorithm logical hei...

Sammy Gill noreply at github.com
Mon Mar 25 10:58:37 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ba849a630cec232ab5f53e05503f0fdf40cccebd
      https://github.com/WebKit/WebKit/commit/ba849a630cec232ab5f53e05503f0fdf40cccebd
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2024-03-25 (Mon, 25 Mar 2024)

  Changed paths:
    A PerformanceTests/Layout/nested-grid-subgrid-free-space-columns.html
    M Source/WebCore/Headers.cmake
    M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
    M Source/WebCore/rendering/RenderGrid.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h

  Log Message:
  -----------
  [css-grid] Grid track sizing algorithm logical height computation unnecessarily dirties grid items.
https://bugs.webkit.org/show_bug.cgi?id=271083
rdar://124713418

Reviewed by Matt Woodrow.

In certain situations when trying to compute the logical height for a
grid item, the grid track sizing algorithm will update the grid item's
overriding containing block size and mark it dirty for layout. This
dirtying would occur even it we end up setting the override size to the
same value and could result in bad performance with particular types
of content. For example, nested grid content would run grid layout
multiple times which is currently expensive.

In this patch we avoid this extra call to layout by checking to see if
the override size is already set to the value we are attempting to set
it to. If it is then we will avoid dirtying the renderer.

This also ended up exposing an invalidation bug in which we were not
properly invalidating the grid items when there was a style change on
the grid related to its column or row sizes. This was demonstrated with
new failures in css-grid/layout-algorithm/grid-intrinsic-track-sizes-001.html
which was performing this behavior. Now when the grid style changes we
will check to see if any of the sizes for the columns or the rows are
different. If this occurs we should mark the grid items as dirty. This
is likely to be more than necessary since we could probably try to
identify the exact set of grid items that need to be invalidated, but
this approach is the least risky for now. Future patches should attempt
to reign this invalidation in a bit more.

Without this patch I was getting about 2 runs/s and afterwards I was
able to get about ~690 runs/s.

* PerformanceTests/Layout/nested-grid-subgrid-free-space-columns.html: Added.
* Source/WebCore/Headers.cmake:
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithmStrategy::logicalHeightForChild const):
* Source/WebCore/rendering/RenderGrid.cpp:
(WebCore::RenderGrid::styleDidChange):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::gridTrackSizes const):

Canonical link: https://commits.webkit.org/276633@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list