Skip to content

Commit 21a661f

Browse files
stwrtmcatanzaro
authored andcommitted
Cherry-pick 259548.835@safari-7615-branch (b63d456). https://bugs.webkit.org/show_bug.cgi?id=257509
Crash in GridBaselineAlignment::baselineGroupForChild https://bugs.webkit.org/show_bug.cgi?id=257509 rdar://110027455 Reviewed by Alan Baradlay. Certain baseline properties are not properly handled in CSS Masonry. We will just disable these calculations for now and then remove this in the future. * LayoutTests/fast/css-grid-layout/baseline-masonry-crash-expected.html: Added. * LayoutTests/fast/css-grid-layout/baseline-masonry-crash.html: Added. * Source/WebCore/rendering/RenderGrid.cpp: (WebCore::RenderGrid::columnAxisBaselineOffsetForChild const): (WebCore::RenderGrid::rowAxisBaselineOffsetForChild const): Canonical link: https://commits.webkit.org/259548.835@safari-7615-branch
1 parent a474823 commit 21a661f

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<style>
2+
grid {
3+
display: inline-grid;
4+
grid-template-columns: auto;
5+
grid-template-rows: repeat(4,auto);
6+
}
7+
</style>
8+
9+
<p>This test passes if it does not crash.</p>
10+
11+
<grid>
12+
<<item>3</item>/item>
13+
<item>4</item>
14+
<item style="-webkit-align-self: baseline;">
15+
</grid>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<style>
2+
grid {
3+
display: inline-grid;
4+
grid-template-columns: masonry;
5+
grid-template-rows: repeat(4,auto);
6+
}
7+
</style>
8+
9+
<p>This test passes if it does not crash.</p>
10+
11+
<grid>
12+
<<item>3</item>/item>
13+
<item>4</item>
14+
<item style="-webkit-align-self: baseline;">
15+
</grid>

Source/WebCore/rendering/RenderGrid.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,6 +1817,11 @@ std::optional<LayoutUnit> RenderGrid::inlineBlockBaseline(LineDirectionMode) con
18171817

18181818
LayoutUnit RenderGrid::columnAxisBaselineOffsetForChild(const RenderBox& child) const
18191819
{
1820+
// FIXME : CSS Masonry does not properly handle baseline calculations currently.
1821+
// We will just skip this running this step if we detect the RenderGrid is Masonry for now.
1822+
if (isMasonry())
1823+
return LayoutUnit { };
1824+
18201825
if (isSubgridRows()) {
18211826
RenderGrid* outer = downcast<RenderGrid>(parent());
18221827
if (GridLayoutFunctions::isOrthogonalChild(*outer, *this))
@@ -1828,6 +1833,11 @@ LayoutUnit RenderGrid::columnAxisBaselineOffsetForChild(const RenderBox& child)
18281833

18291834
LayoutUnit RenderGrid::rowAxisBaselineOffsetForChild(const RenderBox& child) const
18301835
{
1836+
// FIXME : CSS Masonry does not properly handle baseline calculations currently.
1837+
// We will just skip this running this step if we detect the RenderGrid is Masonry for now.
1838+
if (isMasonry())
1839+
return LayoutUnit { };
1840+
18311841
if (isSubgridColumns()) {
18321842
RenderGrid* outer = downcast<RenderGrid>(parent());
18331843
if (GridLayoutFunctions::isOrthogonalChild(*outer, *this))

0 commit comments

Comments
 (0)