Title: [292524] trunk
Revision
292524
Author
[email protected]
Date
2022-04-07 00:11:27 -0700 (Thu, 07 Apr 2022)

Log Message

Grid items that establish an independent formatting context should not be subgrids.
https://bugs.webkit.org/show_bug.cgi?id=237692

Reviewed by Alan Bujtas.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-grid/subgrid/abs-pos-003-expected.html: Removed.
* web-platform-tests/css/css-grid/subgrid/abs-pos-003.html: Removed.
* web-platform-tests/css/css-grid/subgrid/abs-pos-004-expected.html: Removed.
* web-platform-tests/css/css-grid/subgrid/abs-pos-004.html: Removed.
* web-platform-tests/css/css-grid/subgrid/independent-formatting-context-expected.html: Added.
* web-platform-tests/css/css-grid/subgrid/independent-formatting-context.html: Added.

Removes tests that expect position:absolute combined with grid-template-X: subgrid to work.
Adds new test to confirm that elements that establish an independent formatting context can't
also be a subgrid.

Source/WebCore:

New WPT css/css-grid/subgrid/independent-formatting-context.html added to check this case.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::createsNewFormattingContext const):
* rendering/RenderBox.h:
(WebCore::RenderBox::markForPaginationRelayoutIfNeeded):
(WebCore::RenderBox::isWritingModeRoot const): Deleted.
(WebCore::RenderBox::isDeprecatedFlexItem const): Deleted.
(WebCore::RenderBox::isFlexItemIncludingDeprecated const): Deleted.
* rendering/RenderElement.cpp:
(WebCore::RenderElement::createsNewFormattingContext const):
* rendering/RenderElement.h:
(WebCore::RenderElement::isWritingModeRoot const):
(WebCore::RenderElement::isDeprecatedFlexItem const):
(WebCore::RenderElement::isFlexItemIncludingDeprecated const):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::isBlockContainer const):
* rendering/RenderObject.h:

Grid items establish a new formatting context, unless they're a subgrid [1], but subgrid
is disabled if any other property causes the element to establish a formatting context [2].
Adds a new helper to check everything except grid, so that we can resolve this without
infinite recursion.
Stops writing-mode changes from establishing an independent formatting context if
the box is a grid container, since this should only happen is the box is a block
container [3].
Adds new helper for isBlockContainer, since writing-mode changes use it.

[1] https://drafts.csswg.org/css-grid-2/#grid-item-display
[2] https://drafts.csswg.org/css-grid-2/#subgrid-listing
[3] https://drafts.csswg.org/css-writing-modes/#block-flow

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::isSubgrid const):
(WebCore::RenderGrid::createsNewFormattingContext const):
(WebCore::RenderGrid::mayBeSubgridExcludingAbsPos const): Deleted.
(WebCore::RenderGrid::gridSpanCoversRealTracks const): Deleted.
* rendering/RenderGrid.h:
* rendering/style/GridPositionsResolver.cpp:
(WebCore::adjustGridPositionsFromStyle):

Makes isSubgrid return false if the element establishes an independent formatting context
(excluding contexts established by being a grid item), and removes no longer needed code
for handling position:absolute subgrids.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292523 => 292524)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-07 07:11:27 UTC (rev 292524)
@@ -1,3 +1,21 @@
+2022-04-07  Matt Woodrow  <[email protected]>
+
+        Grid items that establish an independent formatting context should not be subgrids.
+        https://bugs.webkit.org/show_bug.cgi?id=237692
+
+        Reviewed by Alan Bujtas.
+
+        * web-platform-tests/css/css-grid/subgrid/abs-pos-003-expected.html: Removed.
+        * web-platform-tests/css/css-grid/subgrid/abs-pos-003.html: Removed.
+        * web-platform-tests/css/css-grid/subgrid/abs-pos-004-expected.html: Removed.
+        * web-platform-tests/css/css-grid/subgrid/abs-pos-004.html: Removed.
+        * web-platform-tests/css/css-grid/subgrid/independent-formatting-context-expected.html: Added.
+        * web-platform-tests/css/css-grid/subgrid/independent-formatting-context.html: Added.
+
+        Removes tests that expect position:absolute combined with grid-template-X: subgrid to work.
+        Adds new test to confirm that elements that establish an independent formatting context can't
+        also be a subgrid.
+
 2022-04-06  Tim Nguyen  <[email protected]>
 
         [:has() pseudo-class] Support invalidation for :placeholder-shown

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003-expected.html (292523 => 292524)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003-expected.html	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003-expected.html	2022-04-07 07:11:27 UTC (rev 292524)
@@ -1,122 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-     Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html><head>
-  <meta charset="utf-8">
-  <title>Reference: abs.pos. subgrid edge cases</title>
-  <link rel="author" title="Mats Palmgren" href=""
-<style>
-html,body {
-  color:black; background-color:white; font:16px/3em monospace;
-}
-
-.grid {
-  display: inline-grid;
-  position: relative;
-  border: 1px solid;
-  margin-right: 20px;
-}
-.a { grid-template-areas: '.' }
-.c { grid-template-columns: auto }
-.r { grid-template-rows: auto }
-
-.subgrid {
-  position: absolute;
-  display: grid;
-  padding: 10px;
-}
-
-x {
-  width: 1em;
-  height: 1em;
-  background: grey;
-}
-
-a {
-  position: absolute;
-  inset: 0;
-  background: purple;
-}
-
-</style>
-</head>
-<body>
-
-<div class="grid"><div class="subgrid t1"></div></div>
-<div class="grid"><div class="subgrid t1"><x></x></div></div>
-<div class="grid"><div class="subgrid t1"><x></x><x></x></div></div>
-<div class="grid"><div class="subgrid t1"></div></div>
-<div class="grid a"><div class="subgrid t1"></div></div>
-<div class="grid a"><div class="subgrid t1"><x></x></div></div>
-<div class="grid a"><div class="subgrid t1"><x></x></div></div>
-<div class="grid c"><div class="subgrid t1"></div></div>
-<div class="grid c"><div class="subgrid t1"><x></x></div></div>
-<div class="grid c"><div class="subgrid t1"><x></x><x></x></div></div>
-<div class="grid r"><div class="subgrid t1"></div></div>
-<div class="grid r"><div class="subgrid t1"><x></x></div></div>
-<div class="grid r"><div class="subgrid t1"><x></x></div></div>
-
-<div class="grid"><div class="subgrid t2"></div></div>
-<div class="grid"><div class="subgrid t2"><x></x></div></div>
-<div class="grid"><div class="subgrid t2"></div></div>
-<div class="grid"><div class="subgrid t2"><x></x><x></x></div></div>
-<div class="grid a"><div class="subgrid t2"></div></div>
-<div class="grid a"><div class="subgrid t2"><x></x></div></div>
-<div class="grid a"><div class="subgrid t2"><x></x><x></x></div></div>
-<div class="grid c"><div class="subgrid t2"></div></div>
-<div class="grid c"><div class="subgrid t2"><x></x></div></div>
-<div class="grid c"><div class="subgrid t2"><x></x><x></x></div></div>
-<div class="grid r"><div class="subgrid t2"></div></div>
-<div class="grid r"><div class="subgrid t2"><x></x></div></div>
-<div class="grid r"><div class="subgrid t2"><x></x><x></x></div></div>
-
-<div class="grid"><div class="subgrid t3"></div></div>
-<div class="grid"><div class="subgrid t3"><x></x></div></div>
-<div class="grid"><div class="subgrid t3"></div></div>
-<div class="grid"><div class="subgrid t3"><x></x><x></x></div></div>
-<div class="grid a"><div class="subgrid t3"></div></div>
-<div class="grid a"><div class="subgrid t3"><x></x></div></div>
-<div class="grid a"><div class="subgrid t3"><x></x></div></div>
-<div class="grid c"><div class="subgrid t3"></div></div>
-<div class="grid c"><div class="subgrid t3"><x></x></div></div>
-<div class="grid c"><div class="subgrid t3"><x></x><x></x></div></div>
-<div class="grid r"><div class="subgrid t3"></div></div>
-<div class="grid r"><div class="subgrid t3"><x></x></div></div>
-<div class="grid r"><div class="subgrid t3"><x></x></div></div>
-
-<br>
-
-<div class="grid"><div class="subgrid t1"><a></a></div></div>
-<div class="grid"><div class="subgrid t1"><a></a><a></a></div></div>
-<div class="grid"><div class="subgrid t1"><a></a></div></div>
-<div class="grid a"><div class="subgrid t1"><a></a></div></div>
-<div class="grid a"><div class="subgrid t1"><a></a><a></a></div></div>
-<div class="grid c"><div class="subgrid t1"><a></a></div></div>
-<div class="grid c"><div class="subgrid t1"><a></a><a></a></div></div>
-<div class="grid r"><div class="subgrid t1"><a></a></div></div>
-<div class="grid r"><div class="subgrid t1"><a></a><a></a></div></div>
-
-<div class="grid"><div class="subgrid t2"><a></a></div></div>
-<div class="grid"><div class="subgrid t2"><a></a><a></a></div></div>
-<div class="grid"><div class="subgrid t2"><a></a></div></div>
-<div class="grid a"><div class="subgrid t2"><a></a></div></div>
-<div class="grid a"><div class="subgrid t2"><a></a><a></a></div></div>
-<div class="grid c"><div class="subgrid t2"><a></a></div></div>
-<div class="grid c"><div class="subgrid t2"><a></a><a></a></div></div>
-<div class="grid r"><div class="subgrid t2"><a></a></div></div>
-<div class="grid r"><div class="subgrid t2"><a></a><a></a></div></div>
-
-<div class="grid"><div class="subgrid t3"><a></a></div></div>
-<div class="grid"><div class="subgrid t3"><a></a></div></div>
-<div class="grid"><div class="subgrid t3"><a></a><a></a></div></div>
-<div class="grid a"><div class="subgrid t3"><a></a></div></div>
-<div class="grid a"><div class="subgrid t3"><a></a><a></a></div></div>
-<div class="grid c"><div class="subgrid t3"><a></a></div></div>
-<div class="grid c"><div class="subgrid t3"><a></a><a></a></div></div>
-<div class="grid r"><div class="subgrid t3"><a></a></div></div>
-<div class="grid r"><div class="subgrid t3"><a></a><a></a></div></div>
-
-</body>
-</html>

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003.html (292523 => 292524)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003.html	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-003.html	2022-04-07 07:11:27 UTC (rev 292524)
@@ -1,133 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-     Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html><head>
-  <meta charset="utf-8">
-  <title>CSS Grid Test: abs.pos. subgrid edge cases</title>
-  <link rel="author" title="Mats Palmgren" href=""
-  <link rel="help" href=""
-  <link rel="match" href=""
-<style>
-html,body {
-  color:black; background-color:white; font:16px/3em monospace;
-}
-
-.grid {
-  display: inline-grid;
-  position: relative;
-  border: 1px solid;
-  margin-right: 20px;
-}
-.a { grid-template-areas: '.' }
-.c { grid-template-columns: auto }
-.r { grid-template-rows: auto }
-
-.subgrid {
-  position: absolute;
-  display: grid;
-  padding: 10px;
-}
-.t1 { grid: subgrid / subgrid; }
-.t2 { grid: none / subgrid; }
-.t3 { grid: subgrid / none; }
-
-x {
-  width: 1em;
-  height: 1em;
-  background: grey;
-}
-
-a {
-  position: absolute;
-  inset: 0;
-  background: purple;
-}
-
-.o { overflow: hidden; }
-.abs {
-  grid-auto-rows: 3em;
-  grid-auto-columns: 3em;
-}
-.abs x { width:auto; height:auto; }
-</style>
-</head>
-<body>
-
-<div class="grid"><div class="subgrid t1"></div></div>
-<div class="grid"><div class="subgrid t1"><x></x></div></div>
-<div class="grid"><div class="subgrid t1"><x></x><x></x></div></div>
-<div class="grid abs"><div class="subgrid t1 o"><x></x></div></div>
-<div class="grid a"><div class="subgrid t1"></div></div>
-<div class="grid a"><div class="subgrid t1"><x></x></div></div>
-<div class="grid a"><div class="subgrid t1"><x></x><x></x></div></div>
-<div class="grid c"><div class="subgrid t1"></div></div>
-<div class="grid c"><div class="subgrid t1"><x></x></div></div>
-<div class="grid c"><div class="subgrid t1"><x></x><x></x></div></div>
-<div class="grid r"><div class="subgrid t1"></div></div>
-<div class="grid r"><div class="subgrid t1"><x></x></div></div>
-<div class="grid r"><div class="subgrid t1"><x></x><x></x></div></div>
-
-<div class="grid"><div class="subgrid t2"></div></div>
-<div class="grid"><div class="subgrid t2"><x></x></div></div>
-<div class="grid abs"><div class="subgrid t2 o"><x></x></div></div>
-<div class="grid"><div class="subgrid t2"><x></x><x></x></div></div>
-<div class="grid a"><div class="subgrid t2"></div></div>
-<div class="grid a"><div class="subgrid t2"><x></x></div></div>
-<div class="grid a"><div class="subgrid t2"><x></x><x></x></div></div>
-<div class="grid c"><div class="subgrid t2"></div></div>
-<div class="grid c"><div class="subgrid t2"><x></x></div></div>
-<div class="grid c"><div class="subgrid t2"><x></x><x></x></div></div>
-<div class="grid r"><div class="subgrid t2"></div></div>
-<div class="grid r"><div class="subgrid t2"><x></x></div></div>
-<div class="grid r"><div class="subgrid t2"><x></x><x></x></div></div>
-
-<div class="grid"><div class="subgrid t3"></div></div>
-<div class="grid"><div class="subgrid t3"><x></x></div></div>
-<div class="grid abs"><div class="subgrid t3 o"><x></x></div></div>
-<div class="grid"><div class="subgrid t3"><x></x><x></x></div></div>
-<div class="grid a"><div class="subgrid t3"></div></div>
-<div class="grid a"><div class="subgrid t3"><x></x></div></div>
-<div class="grid a"><div class="subgrid t3"><x></x><x></x></div></div>
-<div class="grid c"><div class="subgrid t3"></div></div>
-<div class="grid c"><div class="subgrid t3"><x></x></div></div>
-<div class="grid c"><div class="subgrid t3"><x></x><x></x></div></div>
-<div class="grid r"><div class="subgrid t3"></div></div>
-<div class="grid r"><div class="subgrid t3"><x></x></div></div>
-<div class="grid r"><div class="subgrid t3"><x></x><x></x></div></div>
-
-<br>
-
-<div class="grid"><div class="subgrid t1"><a></a></div></div>
-<div class="grid"><div class="subgrid t1"><a></a><a></a></div></div>
-<div class="grid abs"><div class="subgrid t1 o"><a></a></div></div>
-<div class="grid a"><div class="subgrid t1"><a></a></div></div>
-<div class="grid a"><div class="subgrid t1"><a></a><a></a></div></div>
-<div class="grid c"><div class="subgrid t1"><a></a></div></div>
-<div class="grid c"><div class="subgrid t1"><a></a><a></a></div></div>
-<div class="grid r"><div class="subgrid t1"><a></a></div></div>
-<div class="grid r"><div class="subgrid t1"><a></a><a></a></div></div>
-
-<div class="grid"><div class="subgrid t2"><a></a></div></div>
-<div class="grid"><div class="subgrid t2"><a></a><a></a></div></div>
-<div class="grid abs"><div class="subgrid t2 o"><a></a></div></div>
-<div class="grid a"><div class="subgrid t2"><a></a></div></div>
-<div class="grid a"><div class="subgrid t2"><a></a><a></a></div></div>
-<div class="grid c"><div class="subgrid t2"><a></a></div></div>
-<div class="grid c"><div class="subgrid t2"><a></a><a></a></div></div>
-<div class="grid r"><div class="subgrid t2"><a></a></div></div>
-<div class="grid r"><div class="subgrid t2"><a></a><a></a></div></div>
-
-<div class="grid"><div class="subgrid t3"><a></a></div></div>
-<div class="grid"><div class="subgrid t3"><a></a><a></a></div></div>
-<div class="grid abs"><div class="subgrid t3 o"><a></a></div></div>
-<div class="grid a"><div class="subgrid t3"><a></a></div></div>
-<div class="grid a"><div class="subgrid t3"><a></a><a></a></div></div>
-<div class="grid c"><div class="subgrid t3"><a></a></div></div>
-<div class="grid c"><div class="subgrid t3"><a></a><a></a></div></div>
-<div class="grid r"><div class="subgrid t3"><a></a></div></div>
-<div class="grid r"><div class="subgrid t3"><a></a><a></a></div></div>
-
-</body>
-</html>

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004-expected.html (292523 => 292524)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004-expected.html	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004-expected.html	2022-04-07 07:11:27 UTC (rev 292524)
@@ -1,198 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-     Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html><head>
-  <title>Reference: abs.pos. subgrid edge cases</title>
-  <link rel="author" title="Mats Palmgren" href=""
-<style>
-html,body {
-  color:black; background-color:white; font:15px/1 monospace;
-}
-
-body > div {
-  display: inline-block;
-  height: 20px;
-  border: 1px solid;
-  margin: 1px;
-  vertical-align: top;
-}
-body > div > div { height: 20px; background: lightgrey; }
-body > div > div > div { height: 20px; }
-</style>
-</head>
-<body>
-
-<script>
-let results = [
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "10px", "0", "10px", "0", "10px", "lime" ],
-  [ "50px", "0", "50px", "0", "10px", "lime" ],
-  [ "50px", "0", "50px", "0", "10px", "lime" ],
-  [ "50px", "0", "50px", "0", "50px", "lime" ],
-  [ "50px", "0", "50px", "0", "10px", "lime" ],
-  [ "50px", "0", "50px", "0", "10px", "lime" ],
-  [ "50px", "0", "50px", "0", "50px", "lime" ],
-  [ "50px", "0", "40px", "0", "40px", "lime" ],
-  [ "50px", "0", "40px", "0", "40px", "lime" ],
-  [ "50px", "0", "40px", "0", "40px", "lime" ],
-  [ "50px", "0", "40px", "0", "40px", "lime" ],
-  [ "50px", "0", "40px", "0", "40px", "lime" ],
-  [ "50px", "0", "40px", "0", "40px", "lime" ],
-
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "10px", "0", "10px", "0", "10px", "blue" ],
-  [ "50px", "0", "50px", "0", "10px", "blue" ],
-  [ "50px", "0", "50px", "0", "10px", "blue" ],
-  [ "50px", "0", "50px", "0", "50px", "blue" ],
-  [ "50px", "0", "50px", "0", "10px", "blue" ],
-  [ "50px", "0", "50px", "0", "10px", "blue" ],
-  [ "50px", "0", "50px", "0", "50px", "blue" ],
-  [ "50px", "0", "40px", "0", "40px", "blue" ],
-  [ "50px", "0", "40px", "0", "40px", "blue" ],
-  [ "50px", "0", "40px", "0", "40px", "blue" ],
-  [ "50px", "0", "40px", "0", "40px", "blue" ],
-  [ "50px", "0", "40px", "0", "40px", "blue" ],
-  [ "50px", "0", "40px", "0", "40px", "blue" ],
-
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "20px", "0", "20px", "0", "20px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "30px", "lime" ],
-
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "20px", "0", "20px", "0", "20px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "30px", "blue" ],
-
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "30px", "0", "30px", "0", "30px", "lime" ],
-  [ "50px", "20px", "30px", "0", "10px", "lime" ],
-  [ "50px", "20px", "30px", "0", "10px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "20px", "30px", "0", "10px", "lime" ],
-  [ "50px", "20px", "30px", "0", "10px", "lime" ],
-  [ "50px", "0", "0", "20px", "30px", "lime" ],
-  [ "50px", "0", "0", "0", "20px", "lime" ],
-  [ "50px", "0", "0", "0", "20px", "lime" ],
-  [ "50px", "0", "0", "0", "20px", "lime" ],
-  [ "50px", "0", "0", "0", "20px", "lime" ],
-  [ "50px", "0", "0", "0", "20px", "lime" ],
-  [ "50px", "0", "0", "0", "20px", "lime" ],
-
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "30px", "0", "30px", "0", "30px", "blue" ],
-  [ "50px", "20px", "30px", "0", "10px", "blue" ],
-  [ "50px", "20px", "30px", "0", "10px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "20px", "30px", "0", "10px", "blue" ],
-  [ "50px", "20px", "30px", "0", "10px", "blue" ],
-  [ "50px", "0", "0", "20px", "30px", "blue" ],
-  [ "50px", "0", "0", "0", "20px", "blue" ],
-  [ "50px", "0", "0", "0", "20px", "blue" ],
-  [ "50px", "0", "0", "0", "20px", "blue" ],
-  [ "50px", "0", "0", "0", "20px", "blue" ],
-  [ "50px", "0", "0", "0", "20px", "blue" ],
-  [ "50px", "0", "0", "0", "20px", "blue" ],
-];
-results.forEach(function(arr) {
-  let grid_width, subgrid_width, subgrid_pos, item_pos, item_width, item_bg;
-  [grid_width, subgrid_pos, subgrid_width, item_pos, item_width, item_bg] = arr;
-  let grid = document.createElement('div');
-  grid.style.width = grid_width;
-  let subgrid = document.createElement('div');
-  subgrid.style.width = subgrid_width;
-  subgrid.style.marginLeft = subgrid_pos;
-  let subgridItem = document.createElement('div');
-  subgridItem.style.width = item_width;
-  subgridItem.style.marginLeft = item_pos;
-  subgridItem.style.backgroundColor = item_bg;
-  subgrid.appendChild(subgridItem);
-  grid.appendChild(subgrid);
-  document.body.appendChild(grid);
-});
-</script>
-
-</body>
-</html>

Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004.html (292523 => 292524)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004.html	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/abs-pos-004.html	2022-04-07 07:11:27 UTC (rev 292524)
@@ -1,104 +0,0 @@
-<!DOCTYPE HTML>
-<!--
-     Any copyright is dedicated to the Public Domain.
-     http://creativecommons.org/publicdomain/zero/1.0/
--->
-<html><head>
-  <title>CSS Grid Test: abs.pos. subgrid edge cases</title>
-  <link rel="author" title="Mats Palmgren" href=""
-  <link rel="help" href=""
-  <link rel="match" href=""
-<style>
-html,body {
-  color:black; background-color:white; font:15px/1 monospace;
-}
-
-.grid {
-  position: relative;
-  display: inline-grid;
-  grid-auto-columns: 10px;
-  grid-auto-rows: 20px;
-  grid-auto-flow: column;
-  border: 1px solid;
-  margin: 1px;
-  vertical-align: top;
-}
-
-.subgrid {
-  position: absolute;
-  inset: 0;
-  display: grid;
-  background: lightgrey;
-}
-.t1 { grid: subgrid / subgrid; }
-.t2 { grid: none / subgrid; }
-.t3 { grid: subgrid / none; }
-
-x {
-  background: lime;
-  grid-area: 1/1/-1/-1;
-}
-fail {
-  background: red;
-}
-
-.a {
-  position: absolute;
-  grid-area: 1/1/-1/-1;
-  inset: 0;
-  background: blue;
-}
-
-.o { overflow: hidden; }
-
-.start .subgrid {
-  grid-column-start: 3;
-}
-.end .subgrid {
-  grid-column-end: 1;
-}
-.start, .end {
-  width: 50px;
-}
-.end {
-  justify-content: end;
-}
-.start > fail, .end > fail {
-  background: initial;
-}
-</style>
-</head>
-<body>
-
-<script>
-function make_grids(items, abspos) {
-  ["", "o", "start", "end"].forEach(function(grid1) {
-    ["", "o"].forEach(function(subgrid1) {
-      ["t1", "t2", "t3"].forEach(function(subgrid2) {
-        let grid = document.createElement('div');
-        for (let i = 0; i < items; ++i) {
-          grid.appendChild(document.createElement('fail'));
-        }
-        grid.className = "grid " + grid1;
-        document.body.appendChild(grid);
-        document.body.offsetHeight;
-        let subgrid = document.createElement('div');
-        subgrid.className = "subgrid " + subgrid1 + " " + subgrid2;
-        let subgridItem = document.createElement('x');
-        if (abspos) {
-          subgridItem.className = "a";
-        }
-        subgrid.appendChild(subgridItem);
-        grid.appendChild(subgrid);
-      })
-    })
-  });
-}
-for (let i = 1; i <= 3; ++i) {
-  make_grids(i, false);
-  make_grids(i, true);
-}
-</script>
-
-</body>
-</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/independent-formatting-context-expected.html (0 => 292524)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/independent-formatting-context-expected.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/independent-formatting-context-expected.html	2022-04-07 07:11:27 UTC (rev 292524)
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+  <meta charset="utf-8">
+  <title>Test: subgrid disabled if grid item establishes independent formatting context</title>
+  <link rel="author" title="Matt Woodrow" href=""
+  <link rel="help" href=""
+  <style>
+html,body {
+  color:black; background-color:white; font:16px/1 monospace; padding:0; margin:0;
+}
+
+.grid {
+  display: inline-block;
+  background-color: green;
+  width: 100px;
+  height: 100px;
+  margin-right: 20px;
+}
+
+  </style>
+</head>
+<body>
+
+<div class="grid">
+</div>
+
+<div class="grid">
+</div>
+
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/independent-formatting-context.html (0 => 292524)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/independent-formatting-context.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/subgrid/independent-formatting-context.html	2022-04-07 07:11:27 UTC (rev 292524)
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML>
+<!--
+     Any copyright is dedicated to the Public Domain.
+     http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<html><head>
+  <meta charset="utf-8">
+  <title>Test: subgrid disabled if grid item establishes independent formatting context</title>
+  <link rel="author" title="Matt Woodrow" href=""
+  <link rel="help" href=""
+  <link rel="match" href=""
+  <style>
+html,body {
+  color:black; background-color:white; font:16px/1 monospace; padding:0; margin:0;
+}
+
+.grid {
+  position: relative;
+  display: inline-grid;
+  grid-template-rows: 0px 100px;
+  width: 100px;
+  margin-right: 20px;
+}
+
+.subgrid {
+  display: grid;
+  grid-template-rows: subgrid;
+  grid-row: 1 / 3;
+  width: 100px;
+  height: 100px;
+  background-color: red;
+}
+
+.first {
+  background-color: green;
+  grid-row: 1;
+}
+
+.second {
+  background-color: red;
+  grid-row: 2;
+}
+
+  </style>
+</head>
+<body>
+
+<div class="grid">
+  <div class="subgrid" style="position:absolute">
+    <div class="first"></div>
+  </div>
+</div>
+
+<div class="grid">
+  <div class="subgrid" style="contain: layout">
+    <div class="first"></div>
+  </div>
+</div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (292523 => 292524)


--- trunk/Source/WebCore/ChangeLog	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/ChangeLog	2022-04-07 07:11:27 UTC (rev 292524)
@@ -1,3 +1,55 @@
+2022-04-07  Matt Woodrow  <[email protected]>
+
+        Grid items that establish an independent formatting context should not be subgrids.
+        https://bugs.webkit.org/show_bug.cgi?id=237692
+
+        Reviewed by Alan Bujtas.
+
+        New WPT css/css-grid/subgrid/independent-formatting-context.html added to check this case.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::createsNewFormattingContext const):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::markForPaginationRelayoutIfNeeded):
+        (WebCore::RenderBox::isWritingModeRoot const): Deleted.
+        (WebCore::RenderBox::isDeprecatedFlexItem const): Deleted.
+        (WebCore::RenderBox::isFlexItemIncludingDeprecated const): Deleted.
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::createsNewFormattingContext const):
+        * rendering/RenderElement.h:
+        (WebCore::RenderElement::isWritingModeRoot const):
+        (WebCore::RenderElement::isDeprecatedFlexItem const):
+        (WebCore::RenderElement::isFlexItemIncludingDeprecated const):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::isBlockContainer const):
+        * rendering/RenderObject.h:
+
+        Grid items establish a new formatting context, unless they're a subgrid [1], but subgrid
+        is disabled if any other property causes the element to establish a formatting context [2].
+        Adds a new helper to check everything except grid, so that we can resolve this without
+        infinite recursion.
+        Stops writing-mode changes from establishing an independent formatting context if
+        the box is a grid container, since this should only happen is the box is a block
+        container [3].
+        Adds new helper for isBlockContainer, since writing-mode changes use it.
+
+        [1] https://drafts.csswg.org/css-grid-2/#grid-item-display
+        [2] https://drafts.csswg.org/css-grid-2/#subgrid-listing
+        [3] https://drafts.csswg.org/css-writing-modes/#block-flow
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::isSubgrid const):
+        (WebCore::RenderGrid::createsNewFormattingContext const):
+        (WebCore::RenderGrid::mayBeSubgridExcludingAbsPos const): Deleted.
+        (WebCore::RenderGrid::gridSpanCoversRealTracks const): Deleted.
+        * rendering/RenderGrid.h:
+        * rendering/style/GridPositionsResolver.cpp:
+        (WebCore::adjustGridPositionsFromStyle):
+
+        Makes isSubgrid return false if the element establishes an independent formatting context
+        (excluding contexts established by being a grid item), and removes no longer needed code
+        for handling position:absolute subgrids.
+
 2022-04-06  Tim Nguyen  <[email protected]>
 
         [:has() pseudo-class] Support invalidation for :placeholder-shown

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2022-04-07 07:11:27 UTC (rev 292524)
@@ -4944,11 +4944,9 @@
     return style().width().isAuto();
 }
 
-bool RenderBox::createsNewFormattingContext() const
+bool RenderBox::establishesIndependentFormattingContext() const
 {
-    return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasPotentiallyScrollableOverflow() || isFlexItemIncludingDeprecated()
-        || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElementRenderer() || isRenderFragmentedFlow()
-        || style().containsLayout() || paintContainmentApplies() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot;
+    return isGridItem() || RenderElement::establishesIndependentFormattingContext();
 }
 
 bool RenderBox::avoidsFloats() const

Modified: trunk/Source/WebCore/rendering/RenderBox.h (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderBox.h	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2022-04-07 07:11:27 UTC (rev 292524)
@@ -571,11 +571,6 @@
     virtual bool avoidsFloats() const;
 
     virtual void markForPaginationRelayoutIfNeeded() { }
-
-    bool isWritingModeRoot() const { return !parent() || parent()->style().writingMode() != style().writingMode(); }
-
-    bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
-    bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDeprecated(); }
     
     LayoutUnit lineHeight(bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
     LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const override;
@@ -683,7 +678,7 @@
 
     void willBeDestroyed() override;
 
-    bool createsNewFormattingContext() const;
+    bool establishesIndependentFormattingContext() const override;
 
     virtual bool shouldResetLogicalHeightBeforeLayout() const { return false; }
     void resetLogicalHeightBeforeLayoutIfNeeded();

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2022-04-07 07:11:27 UTC (rev 292524)
@@ -2389,4 +2389,22 @@
     return overflowY;
 }
 
+bool RenderElement::createsNewFormattingContext() const
+{
+    // Writing-mode changes establish an independent block formatting context
+    // if the box is a block-container.
+    // https://drafts.csswg.org/css-writing-modes/#block-flow
+    if (isWritingModeRoot() && isBlockContainer())
+        return true;
+    return isInlineBlockOrInlineTable() || isFlexItemIncludingDeprecated()
+        || isTableCell() || isTableCaption() || isFieldset() || isDocumentElementRenderer() || isRenderFragmentedFlow()
+        || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot || establishesIndependentFormattingContext();
 }
+
+bool RenderElement::establishesIndependentFormattingContext() const
+{
+    return isFloatingOrOutOfFlowPositioned() || hasPotentiallyScrollableOverflow() || style().containsLayout() || paintContainmentApplies();
+}
+
+
+}

Modified: trunk/Source/WebCore/rendering/RenderElement.h (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderElement.h	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderElement.h	2022-04-07 07:11:27 UTC (rev 292524)
@@ -271,6 +271,11 @@
     Overflow effectiveOverflowInlineDirection() const { return style().isHorizontalWritingMode() ? effectiveOverflowX() : effectiveOverflowY(); }
     Overflow effectiveOverflowBlockDirection() const { return style().isHorizontalWritingMode() ? effectiveOverflowY() : effectiveOverflowX(); }
 
+    bool isWritingModeRoot() const { return !parent() || parent()->style().writingMode() != style().writingMode(); }
+
+    bool isDeprecatedFlexItem() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isDeprecatedFlexibleBox(); }
+    bool isFlexItemIncludingDeprecated() const { return !isInline() && !isFloatingOrOutOfFlowPositioned() && parent() && parent()->isFlexibleBoxIncludingDeprecated(); }
+
 protected:
     enum BaseTypeFlag {
         RenderLayerModelObjectFlag  = 1 << 0,
@@ -327,6 +332,9 @@
 
     bool isVisibleInViewport() const;
 
+    bool createsNewFormattingContext() const;
+    virtual bool establishesIndependentFormattingContext() const;
+
 private:
     RenderElement(ContainerNode&, RenderStyle&&, BaseTypeFlags);
     void node() const = delete;

Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderGrid.cpp	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp	2022-04-07 07:11:27 UTC (rev 292524)
@@ -225,7 +225,7 @@
             m_hasAspectRatioBlockSizeDependentItem = true;
         }
 
-        // We keep a cache of items with baseline as alignment values so that we only compute the baseline shims for
+        // We keep a cache of items with baseline as aligcnment values so that we only compute the baseline shims for
         // such items. This cache is needed for performance related reasons due to the cost of evaluating the item's
         // participation in a baseline context during the track sizing algorithm.
         if (isBaselineAlignmentForChild(*child, GridColumnAxis))
@@ -1653,9 +1653,17 @@
 
 bool RenderGrid::isSubgrid(GridTrackSizingDirection direction) const
 {
-    if (!mayBeSubgridExcludingAbsPos(direction))
+    // If the grid container is forced to establish an independent formatting
+    // context (like contain layout, or position:absolute), then the used value
+    // of grid-template-rows/columns is 'none' and the container is not a subgrid.
+    // https://drafts.csswg.org/css-grid-2/#subgrid-listing
+    if (RenderElement::establishesIndependentFormattingContext())
         return false;
-    return downcast<RenderGrid>(parent())->gridSpanCoversRealTracks(*this, direction);
+    if (direction == ForColumns ? !style().gridSubgridColumns() : !style().gridSubgridRows())
+        return false;
+    if (!is<RenderGrid>(parent()))
+        return false;
+    return true;
 }
 
 bool RenderGrid::isSubgridInParentDirection(GridTrackSizingDirection parentDirection) const
@@ -1678,18 +1686,6 @@
     return parentGrid.isSubgridOf(parentDirection, ancestor);
 }
 
-bool RenderGrid::mayBeSubgridExcludingAbsPos(GridTrackSizingDirection direction) const
-{
-    // Should exclude cases where we establish an IFC, like contain layout.
-    if (isExcludedFromNormalLayout())
-        return false;
-    if (direction == ForColumns ? !style().gridSubgridColumns() : !style().gridSubgridRows())
-        return false;
-    if (!is<RenderGrid>(parent()))
-        return false;
-    return true;
-}
-
 LayoutUnit RenderGrid::gridAreaBreadthForOutOfFlowChild(const RenderBox& child, GridTrackSizingDirection direction)
 {
     ASSERT(child.isOutOfFlowPositioned());
@@ -2107,26 +2103,16 @@
     return span;
 }
 
-bool RenderGrid::gridSpanCoversRealTracks(const RenderBox& child, GridTrackSizingDirection direction) const
+bool RenderGrid::establishesIndependentFormattingContext() const
 {
-    // Only out of flow positioned items can span to the special line that covers
-    // the padding area.
-    if (!child.isOutOfFlowPositioned())
-        return true;
-
-    int lastLine = numTracks(direction, m_grid);
-    int startLine, endLine;
-    bool startIsAuto, endIsAuto;
-    if (!computeGridPositionsForOutOfFlowChild(child, direction, startLine, startIsAuto, endLine, endIsAuto))
-        return lastLine > 0;
-
-    // If the resulting span covers only the padding area, then it's not a real
-    // track that could be used for a subgrid.
-    if (startIsAuto && !endLine)
-        return false;
-    if (endIsAuto && startLine == lastLine)
-        return false;
-    return true;
+    // Grid items establish a new independent formatting context, unless
+    // they're a subgrid
+    // https://drafts.csswg.org/css-grid-2/#grid-item-display
+    if (isGridItem()) {
+        if (!isSubgridRows() && !isSubgridColumns())
+            return true;
+    }
+    return RenderElement::establishesIndependentFormattingContext();
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderGrid.h (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderGrid.h	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderGrid.h	2022-04-07 07:11:27 UTC (rev 292524)
@@ -102,8 +102,6 @@
     // nested subgrids, where ancestor may not be our direct parent.
     bool isSubgridOf(GridTrackSizingDirection, const RenderGrid& ancestor);
 
-    bool mayBeSubgridExcludingAbsPos(GridTrackSizingDirection) const;
-
     const Grid& currentGrid() const
     {
         return m_grid;
@@ -220,6 +218,7 @@
     LayoutUnit translateRTLCoordinate(LayoutUnit) const;
 
     bool shouldResetLogicalHeightBeforeLayout() const override { return true; }
+    bool establishesIndependentFormattingContext() const override;
 
     bool aspectRatioPrefersInline(const RenderBox& child, bool blockFlowIsColumnAxis);
 
@@ -228,7 +227,6 @@
     GridSpan gridSpanForOutOfFlowChild(const RenderBox&, GridTrackSizingDirection) const;
 
     bool computeGridPositionsForOutOfFlowChild(const RenderBox&, GridTrackSizingDirection, int&, bool&, int&, bool&) const;
-    bool gridSpanCoversRealTracks(const RenderBox&, GridTrackSizingDirection) const;
 
     Grid m_grid;
 

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2022-04-07 07:11:27 UTC (rev 292524)
@@ -195,6 +195,17 @@
     return node() && node()->renderer() == this && node()->hasTagName(marqueeTag);
 }
 
+bool RenderObject::isBlockContainer() const
+{
+    auto display = style().display();
+    return (display == DisplayType::Block
+        || display == DisplayType::InlineBlock
+        || display == DisplayType::FlowRoot
+        || display == DisplayType::ListItem
+        || display == DisplayType::TableCell
+        || display == DisplayType::TableCaption) && !isRenderReplaced();
+}
+
 void RenderObject::setFragmentedFlowStateIncludingDescendants(FragmentedFlowState state, const RenderElement* fragmentedFlowRoot)
 {
     setFragmentedFlowState(state);

Modified: trunk/Source/WebCore/rendering/RenderObject.h (292523 => 292524)


--- trunk/Source/WebCore/rendering/RenderObject.h	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2022-04-07 07:11:27 UTC (rev 292524)
@@ -387,6 +387,7 @@
     bool hasIntrinsicAspectRatio() const { return isReplacedOrInlineBlock() && (isImage() || isVideo() || isCanvas()); }
     bool isAnonymous() const { return m_bitfields.isAnonymous(); }
     bool isAnonymousBlock() const;
+    bool isBlockContainer() const;
 
     bool isFloating() const { return m_bitfields.floating(); }
 

Modified: trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp (292523 => 292524)


--- trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp	2022-04-07 04:29:06 UTC (rev 292523)
+++ trunk/Source/WebCore/rendering/style/GridPositionsResolver.cpp	2022-04-07 07:11:27 UTC (rev 292524)
@@ -380,10 +380,7 @@
     if (finalPosition.isAuto() && initialPosition.isSpan() && !initialPosition.namedGridLine().isNull())
         initialPosition.setSpanPosition(1, String());
 
-    // Absolutely positioned items specifying subgrid might not actually be a subgrid if their grid
-    // span doesn't cover any tracks and only the padding area. We don't know if that is the case until
-    // we've figured out their grid position though, which is what we're trying to do now.
-    if (isIndefiniteSpan(initialPosition, finalPosition) && is<RenderGrid>(gridItem) && downcast<RenderGrid>(gridItem).mayBeSubgridExcludingAbsPos(direction)) {
+    if (isIndefiniteSpan(initialPosition, finalPosition) && is<RenderGrid>(gridItem) && downcast<RenderGrid>(gridItem).isSubgrid(direction)) {
         // Indefinite span for an item that is subgridded in this axis.
         int lineCount = (isForColumns ? gridItem.style().orderedNamedGridColumnLines() : gridItem.style().orderedNamedGridRowLines()).size();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to