commit 02ab4982167983981a616a95601883ed634e6e57 parent 328ab48a9800a2f09034721720af857254cc97f7 Author: Alison Maher <almaher@microsoft.com> Date: Fri, 10 Oct 2025 07:48:40 +0000 Bug 1992737 [wpt PR 55244] - [Masonry] Fix crash with masonry fieldset, a=testonly Automatic update from web-platform-tests [Masonry] Fix crash with masonry fieldset We hit a crash when masonry was set on a fieldset because LayoutMasonry() has a CHECK that the element passed in is not nullptr. However, CreateAnonymousWithParentAndDisplay() passes in nullptr for the element in the case of fieldsets. LayoutMasonry() needed the element to get the computed style, but it shouldn't cache any styles to begin with because they can change. Remove the cached var and query from Style() instead. Also add a test for changing the masonry direction dynamically, which is now passing, too. Bug: 449017553, 343257585 Change-Id: Icae5de85aea39f6388a19dea73b44ea91516714b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7007576 Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org> Reviewed-by: Kurt Catti-Schmidt <kschmi@microsoft.com> Commit-Queue: Alison Maher <almaher@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1525050} -- wpt-commits: 376744a6183d44b96db681e6c4cddcef7a114c13 wpt-pr: 55244 Diffstat:
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-grid/masonry/tentative/masonry-fieldset-crash.html b/testing/web-platform/tests/css/css-grid/masonry/tentative/masonry-fieldset-crash.html @@ -0,0 +1,6 @@ +<!DOCTYPE HTML> +<meta charset="utf-8"> +<title>Making a fieldset a masonry should not crash</title> +<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com"> +<link rel="help" href="https://issues.chromium.org/issues/449017553"> +<fieldset style="display: masonry;"></fieldset> diff --git a/testing/web-platform/tests/css/css-grid/masonry/tentative/track-sizing/dynamic-grid-track-direction.html b/testing/web-platform/tests/css/css-grid/masonry/tentative/track-sizing/dynamic-grid-track-direction.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> +<title>Computed style honors the grid track direction when it changes</title> +<link rel="help" href="https://drafts.csswg.org/css-grid-3"> +<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> +.masonry { + display: masonry; + grid-template-columns: 100px 100px; + grid-template-rows: 100px 100px 100px; +} +</style> +<div class="masonry"></div> +<script> + test(function() { + const container = document.querySelector('.masonry'); + const computedStyle = window.getComputedStyle(container); + assert_equals(computedStyle.getPropertyValue('grid-template-columns'), + "100px 100px"); + + container.style.masonryDirection = 'row'; + const computedStyleAfter = window.getComputedStyle(container); + assert_equals(computedStyleAfter.getPropertyValue('grid-template-rows'), + "100px 100px 100px"); + }); +</script> +</html>