Title: [285987] trunk
- Revision
- 285987
- Author
- [email protected]
- Date
- 2021-11-18 01:12:50 -0800 (Thu, 18 Nov 2021)
Log Message
[css-grid] Transfer size for grid item with an aspect-ratio and stretch alignment against the definite row
https://bugs.webkit.org/show_bug.cgi?id=232987
Reviewed by Javier Fernandez.
Source/WebCore:
For a grid item with an aspect-ratio, if it has stretch alignment against the definite row, it should
try and resolve it if possible and transfer this size into the inline direction for the min/max content
size. For the case that the grid width is content sized, we need to update the width before laying out
the grid items. Since the min-content contribution of the grid item has changed based on the row sizes
calculated in step 2 of sizing algorithm, we also need to repeat the sizing algorithm steps to update
the width of the track sizes.
* rendering/GridLayoutFunctions.cpp:
(WebCore::GridLayoutFunctions::isAspectRatioBlockSizeDependentChild):
* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::updateGridAreaForAspectRatioItems):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::needsPreferredWidthsRecalculation const):
LayoutTests:
* TestExpectations: unskip the test that is now passing.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (285986 => 285987)
--- trunk/LayoutTests/ChangeLog 2021-11-18 07:58:23 UTC (rev 285986)
+++ trunk/LayoutTests/ChangeLog 2021-11-18 09:12:50 UTC (rev 285987)
@@ -1,3 +1,12 @@
+2021-11-18 Ziran Sun <[email protected]>
+
+ [css-grid] Transfer size for grid item with an aspect-ratio and stretch alignment against the definite row
+ https://bugs.webkit.org/show_bug.cgi?id=232987
+
+ Reviewed by Javier Fernandez.
+
+ * TestExpectations: unskip the test that is now passing.
+
2021-11-17 Youenn Fablet <[email protected]>
Add support for more rvfc metadata
Modified: trunk/LayoutTests/TestExpectations (285986 => 285987)
--- trunk/LayoutTests/TestExpectations 2021-11-18 07:58:23 UTC (rev 285986)
+++ trunk/LayoutTests/TestExpectations 2021-11-18 09:12:50 UTC (rev 285987)
@@ -1395,7 +1395,6 @@
imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-dynamic-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-repeat-max-width-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-grid/grid-items/aspect-ratio-004.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-item-inline-contribution-003.html [ ImageOnlyFailure ]
webkit.org/b/231021 imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-size-with-orthogonal-child-dynamic.html [ ImageOnlyFailure ]
webkit.org/b/231021 imported/w3c/web-platform-tests/css/css-grid/grid-items/percentage-margin-dynamic.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (285986 => 285987)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 07:58:23 UTC (rev 285986)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 09:12:50 UTC (rev 285987)
@@ -1,3 +1,24 @@
+2021-11-18 Ziran Sun <[email protected]>
+
+ [css-grid] Transfer size for grid item with an aspect-ratio and stretch alignment against the definite row
+ https://bugs.webkit.org/show_bug.cgi?id=232987
+
+ Reviewed by Javier Fernandez.
+
+ For a grid item with an aspect-ratio, if it has stretch alignment against the definite row, it should
+ try and resolve it if possible and transfer this size into the inline direction for the min/max content
+ size. For the case that the grid width is content sized, we need to update the width before laying out
+ the grid items. Since the min-content contribution of the grid item has changed based on the row sizes
+ calculated in step 2 of sizing algorithm, we also need to repeat the sizing algorithm steps to update
+ the width of the track sizes.
+
+ * rendering/GridLayoutFunctions.cpp:
+ (WebCore::GridLayoutFunctions::isAspectRatioBlockSizeDependentChild):
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::updateGridAreaForAspectRatioItems):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::needsPreferredWidthsRecalculation const):
+
2021-11-18 Antoine Quint <[email protected]>
[Model] [macOS] Add support for interaction on macOS
Modified: trunk/Source/WebCore/rendering/GridLayoutFunctions.cpp (285986 => 285987)
--- trunk/Source/WebCore/rendering/GridLayoutFunctions.cpp 2021-11-18 07:58:23 UTC (rev 285986)
+++ trunk/Source/WebCore/rendering/GridLayoutFunctions.cpp 2021-11-18 09:12:50 UTC (rev 285987)
@@ -84,7 +84,7 @@
bool isAspectRatioBlockSizeDependentChild(const RenderBox& child)
{
- return (child.style().hasAspectRatio() || child.hasIntrinsicAspectRatio()) && child.hasRelativeLogicalHeight();
+ return (child.style().hasAspectRatio() || child.hasIntrinsicAspectRatio()) && (child.hasRelativeLogicalHeight() || child.hasStretchedLogicalHeight());
}
GridTrackSizingDirection flowAwareDirectionForChild(const RenderGrid& grid, const RenderBox& child, GridTrackSizingDirection direction)
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (285986 => 285987)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-11-18 07:58:23 UTC (rev 285986)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-11-18 09:12:50 UTC (rev 285987)
@@ -960,8 +960,12 @@
populateGridPositionsForDirection(ForColumns);
populateGridPositionsForDirection(ForRows);
- for (auto& autoGridItem : autoGridItems)
+ for (auto& autoGridItem : autoGridItems) {
updateGridAreaLogicalSize(*autoGridItem, gridAreaBreadthForChildIncludingAlignmentOffsets(*autoGridItem, ForColumns), gridAreaBreadthForChildIncludingAlignmentOffsets(*autoGridItem, ForRows));
+ // For an item wtih aspect-ratio, if it has stretch alignment that stretches to the definite row, we also need to transfer the size before laying out the grid item.
+ if (autoGridItem->hasStretchedLogicalHeight())
+ applyStretchAlignmentToChildIfNeeded(*autoGridItem);
+ }
}
void RenderGrid::layoutGridItems()
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (285986 => 285987)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-11-18 07:58:23 UTC (rev 285986)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-11-18 09:12:50 UTC (rev 285987)
@@ -802,7 +802,7 @@
bool RenderReplaced::needsPreferredWidthsRecalculation() const
{
// If the height is a percentage and the width is auto, then the containingBlocks's height changing can cause this node to change it's preferred width because it maintains aspect ratio.
- return hasRelativeLogicalHeight() && style().logicalWidth().isAuto();
+ return (hasRelativeLogicalHeight() || (isGridItem() && hasStretchedLogicalHeight())) && style().logicalWidth().isAuto();
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes