[webkit-changes] [WebKit/WebKit] 215644: [grid][masonry] Update masonry items' offsets usin...

Sammy Gill noreply at github.com
Thu May 4 21:49:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 215644fbb8d3ce7fad0dc7732864cbf76928253a
      https://github.com/WebKit/WebKit/commit/215644fbb8d3ce7fad0dc7732864cbf76928253a
  Author: Sammy Gill <sammy.gill at apple.com>
  Date:   2023-05-04 (Thu, 04 May 2023)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/item-placement/masonry-rows-with-grid-width-changed-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/item-placement/masonry-rows-with-grid-width-changed-ref.html
    A LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/item-placement/masonry-rows-with-grid-width-changed.html
    M Source/WebCore/rendering/GridMasonryLayout.cpp

  Log Message:
  -----------
  [grid][masonry] Update masonry items' offsets using HashMap's set() instead of add().
https://bugs.webkit.org/show_bug.cgi?id=255023
rdar://107666148

Reviewed by Brent Fulgham.

During Masonry layout we compute the offsets that each item should have
in the masonry axis and store them into a HashMap that we will reference
later to adjust the items to their final position in the grid. Currently,
we add() to the HashMap which is problematic if we need to relayout the
items when, for example, the size of the window changes. This will not
update the offsets for the items correctly and so instead we should use
set() to accomplish this.

* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/item-placement/masonry-rows-with-grid-width-changed-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/item-placement/masonry-rows-with-grid-width-changed-ref.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/css-grid/masonry/tentative/item-placement/masonry-rows-with-grid-width-changed.html: Added.
* Source/WebCore/rendering/GridMasonryLayout.cpp:
(WebCore::GridMasonryLayout::updateItemOffset):

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




More information about the webkit-changes mailing list