Bug 1553824 - [css-grid-2] Invalidate any stored used track sizes on subgrids too. r=dholbert
authorMats Palmgren <mats@mozilla.com>
Thu, 23 May 2019 21:11:48 +0200
changeset 475399 f12c5ebd0bfce0915e7979bc95e7e8781c2f3a4f
parent 475398 386097a10f84a183ac8b16c4fbc7b391261f1fd2
child 475400 f43362b707d4ddbaf75d3e77e94137ad1069a2f2
push id36061
push usercbrindusan@mozilla.com
push dateFri, 24 May 2019 21:49:59 +0000
treeherdermozilla-central@5d3e1ea77693 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1553824
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1553824 - [css-grid-2] Invalidate any stored used track sizes on subgrids too. r=dholbert Differential Revision: https://phabricator.services.mozilla.com/D32372
layout/generic/crashtests/1553824.html
layout/generic/crashtests/crashtests.list
layout/generic/nsGridContainerFrame.cpp
new file mode 100644
--- /dev/null
+++ b/layout/generic/crashtests/1553824.html
@@ -0,0 +1,86 @@
+<body onload="test()">
+<script>
+function test() {
+  document.body.offsetWidth;
+  let grid = document.querySelector(".container");
+  grid.style = "grid-template-columns:none";
+}
+</script>
+
+<style>
+body {
+  font: 1.2em Arial, Verdana, sans-serif;
+  background-color: #fff;
+}
+
+.container {
+  display: grid;
+  gap: 10px;
+  grid-template-columns: 1fr 1fr 1fr 1fr;
+  grid-template-rows: auto auto auto;
+}
+
+header,
+footer,
+aside,
+li,.box {
+  background-color: rgb(120, 70, 123);
+  border: 5px solid rgb(88, 55, 112);
+  color: #fff;
+  border-radius: 5px;
+  padding: 20px;
+}
+
+aside {
+  grid-row: 1 / -1;
+  grid-column: 1;
+}
+
+header {
+  grid-column: 2 / -2;
+}
+
+ul {
+  gap: 10px;
+  grid-row: 2;
+  grid-column: 2 / -1;
+  margin: 0;
+  padding: 0;
+  list-style: none;
+  display: grid;
+  grid-template-columns: subgrid;
+}
+
+footer {
+  grid-row: 3;
+  grid-column: 2 / -1;
+}
+
+.box {
+  grid-column: -2;
+  grid-row:1;
+}
+
+</style>
+
+
+<div class="container">
+  <header>This is my header</header>
+  <div class="box"></div>
+  <aside>I should stretch from the top to the bottom of the grid</aside>
+  <ul>
+    <li>A</li>
+    <li>B</li>
+    <li>C</li>
+    <li>D</li>
+    <li>E</li>
+    <li>F</li>
+    <li>G</li>
+    <li>H</li>
+    <li>I</li>
+    <li>J</li>
+    <li>K</li>
+  </ul>
+  <footer>I am a footer</footer>
+</div>
+
--- a/layout/generic/crashtests/crashtests.list
+++ b/layout/generic/crashtests/crashtests.list
@@ -726,8 +726,9 @@ load 1515124.html
 pref(layout.css.column-span.enabled,true) load 1517033.html
 pref(layout.css.column-span.enabled,true) load 1517297.html
 load 1520798-1.xul
 load 1520798-2.html
 load 1539656.html
 load 1544060-1.html
 load 1544060-2.html
 load 1542441.html
+pref(layout.css.grid-template-subgrid-value.enabled,true) load 1553824.html
--- a/layout/generic/nsGridContainerFrame.cpp
+++ b/layout/generic/nsGridContainerFrame.cpp
@@ -3852,17 +3852,17 @@ void nsGridContainerFrame::Grid::Subgrid
 }
 
 void nsGridContainerFrame::Grid::PlaceGridItems(
     GridReflowInput& aState, const RepeatTrackSizingInput& aSizes) {
   MOZ_ASSERT(mCellMap.mCells.IsEmpty(), "unexpected entries in cell map");
 
   mAreas = aState.mFrame->GetImplicitNamedAreas();
 
-  if (aState.mFrame->HasSubgridItems()) {
+  if (aState.mFrame->HasSubgridItems() || aState.mFrame->IsSubgrid()) {
     if (auto* uts = aState.mFrame->GetUsedTrackSizes()) {
       uts->mCanResolveLineRangeSize = { false, false };
       uts->mSizes[eLogicalAxisInline].ClearAndRetainStorage();
       uts->mSizes[eLogicalAxisBlock].ClearAndRetainStorage();
     }
   }
 
   // SubgridPlaceGridItems will set these if we find any subgrid items.