Diff
Modified: trunk/LayoutTests/ChangeLog (280077 => 280078)
--- trunk/LayoutTests/ChangeLog 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/ChangeLog 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,3 +1,14 @@
+2021-07-20 Ziran Sun <[email protected]>
+
+ Images as grid items should use the overridingLogicalWidth when defined to compute the logical Height
+ https://bugs.webkit.org/show_bug.cgi?id=228022
+
+ Reviewed by Javier Fernandez.
+
+ Update TestExpectations as 3 failed grid WPT tests are now passing.
+
+ * TestExpectations:
+
2021-07-20 Rob Buis <[email protected]>
Fix grid aspect-ratio tests
Modified: trunk/LayoutTests/TestExpectations (280077 => 280078)
--- trunk/LayoutTests/TestExpectations 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/TestExpectations 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1443,9 +1443,6 @@
imported/w3c/web-platform-tests/css/css-grid/abspos/orthogonal-positioned-grid-descendants-015.html [ Pass Failure ]
webkit.org/b/216146 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-baseline-align-001.html [ ImageOnlyFailure ]
webkit.org/b/216146 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-baseline-justify-001.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-grid/alignment/replaced-alignment-with-aspect-ratio-002.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-grid/alignment/replaced-alignment-with-aspect-ratio-007.html [ ImageOnlyFailure ]
-imported/w3c/web-platform-tests/css/css-grid/alignment/replaced-alignment-with-aspect-ratio-008.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-aspect-ratio-001.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-auto-repeat-aspect-ratio-002.html [ ImageOnlyFailure ]
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (280077 => 280078)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,3 +1,18 @@
+2021-07-20 Ziran Sun <[email protected]>
+
+ Images as grid items should use the overridingLogicalWidth when defined to compute the logical Height
+ https://bugs.webkit.org/show_bug.cgi?id=228022
+
+ Reviewed by Javier Fernandez.
+
+ Update test expectations as the sub-tests are now passing.
+
+ * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-029-expected.txt:
+ * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-030-expected.txt:
+ * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-031-expected.txt:
+ * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-035-expected.txt:
+ * web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-036-expected.txt:
+
2021-07-20 Rob Buis <[email protected]>
Fix grid aspect-ratio tests
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-029-expected.txt (280077 => 280078)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-029-expected.txt 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-029-expected.txt 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,7 +1,5 @@
-FAIL .before 1 assert_equals:
-<img id="item" src="" class=" before" data-expected-width="200" data-expected-height="200">
-height expected 200 but got 100
+PASS .before 1
PASS .after 2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-030-expected.txt (280077 => 280078)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-030-expected.txt 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-030-expected.txt 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,7 +1,5 @@
PASS .before 1
-FAIL .after 2 assert_equals:
-<img id="item" src="" class=" before after" data-expected-width="200" data-expected-height="200">
-height expected 200 but got 100
+PASS .after 2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-031-expected.txt (280077 => 280078)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-031-expected.txt 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-031-expected.txt 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,7 +1,5 @@
-FAIL .before 1 assert_equals:
-<img id="item" src="" class=" before" data-expected-width="200" data-expected-height="200">
-height expected 200 but got 100
+PASS .before 1
PASS .after 2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-035-expected.txt (280077 => 280078)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-035-expected.txt 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-035-expected.txt 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,7 +1,5 @@
PASS .before 1
-FAIL .after 2 assert_equals:
-<img id="item" src="" class=" before after" data-expected-width="80" data-expected-height="80">
-height expected 80 but got 100
+PASS .after 2
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-036-expected.txt (280077 => 280078)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-036-expected.txt 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-grid/alignment/grid-alignment-implies-size-change-036-expected.txt 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,7 +1,5 @@
-FAIL .before 1 assert_equals:
-<img id="item" src="" class=" before" data-expected-width="80" data-expected-height="80">
-height expected 80 but got 100
+PASS .before 1
PASS .after 2
Modified: trunk/Source/WebCore/ChangeLog (280077 => 280078)
--- trunk/Source/WebCore/ChangeLog 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/Source/WebCore/ChangeLog 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1,3 +1,22 @@
+2021-07-20 Ziran Sun <[email protected]>
+
+ Images as grid items should use the overridingLogicalWidth when defined to compute the logical Height
+ https://bugs.webkit.org/show_bug.cgi?id=228022
+
+ Reviewed by Javier Fernandez.
+
+ When computing the logical height using an intrinsic aspect ratio, RenderReplaced should use the
+ overridingLogicalWidth whenever defined just as how it does for flex items. This change is to
+ replace the use of intrinsic (non-stretched) logical width in current code with the overridingLogicalWidth.
+
+ The current code doesn't set overringLogicalWidth while the width changes while stretches along Row Axis.
+ This change adds the logic in.
+
+ * rendering/RenderGrid.cpp:
+ (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::computeReplacedLogicalHeight const):
+
2021-07-20 Rob Buis <[email protected]>
Fix grid aspect-ratio tests
Modified: trunk/Source/WebCore/rendering/RenderGrid.cpp (280077 => 280078)
--- trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/Source/WebCore/rendering/RenderGrid.cpp 2021-07-20 11:26:28 UTC (rev 280078)
@@ -1149,12 +1149,15 @@
void RenderGrid::applyStretchAlignmentToChildIfNeeded(RenderBox& child)
{
ASSERT(child.overridingContainingBlockContentLogicalHeight());
+ ASSERT(child.overridingContainingBlockContentLogicalWidth());
- // We clear height override values because we will decide now whether it's allowed or
+ // We clear height and width override values because we will decide now whether it's allowed or
// not, evaluating the conditions which might have changed since the old values were set.
child.clearOverridingLogicalHeight();
+ child.clearOverridingLogicalWidth();
GridTrackSizingDirection childBlockDirection = GridLayoutFunctions::flowAwareDirectionForChild(*this, child, ForRows);
+ GridTrackSizingDirection childInlineDirection = GridLayoutFunctions::flowAwareDirectionForChild(*this, child, ForColumns);
bool blockFlowIsColumnAxis = childBlockDirection == ForRows;
bool allowedToStretchChildBlockSize = blockFlowIsColumnAxis ? allowedToStretchChildAlongColumnAxis(child) : allowedToStretchChildAlongRowAxis(child);
if (allowedToStretchChildBlockSize && !aspectRatioPrefersInline(child, blockFlowIsColumnAxis)) {
@@ -1170,7 +1173,15 @@
child.setLogicalHeight(0_lu);
child.setNeedsLayout(MarkOnlyThis);
}
- }
+ } else if (!allowedToStretchChildBlockSize && allowedToStretchChildAlongRowAxis(child)) {
+ LayoutUnit stretchedLogicalWidth = availableAlignmentSpaceForChildBeforeStretching(GridLayoutFunctions::overridingContainingBlockContentSizeForChild(child, childInlineDirection).value(), child);
+ LayoutUnit desiredLogicalWidth = constrainLogicalWidthInFragmentByMinMax(stretchedLogicalWidth, contentWidth(), *this, nullptr);
+ child.setOverridingLogicalWidth(desiredLogicalWidth);
+ if (desiredLogicalWidth != child.logicalWidth()) {
+ child.setLogicalWidth(0_lu);
+ child.setNeedsLayout(MarkOnlyThis);
+ }
+ }
}
// FIXME: This logic is shared by RenderFlexibleBox, so it should be moved to RenderBox.
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (280077 => 280078)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-07-20 11:08:00 UTC (rev 280077)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-07-20 11:26:28 UTC (rev 280078)
@@ -623,7 +623,7 @@
bool hasIntrinsicWidth = constrainedSize.hasIntrinsicWidth || constrainedSize.width() > 0;
// See computeReplacedLogicalHeight() for a similar check for heights.
- if (intrinsicRatio && isFlexItem() && hasOverridingLogicalWidth() && hasIntrinsicHeight && hasIntrinsicWidth)
+ if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalWidth() && hasIntrinsicHeight && hasIntrinsicWidth)
return computeReplacedLogicalHeightRespectingMinMaxHeight(roundToInt(round(overridingContentLogicalWidth() / intrinsicRatio)));
// If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'.