Title: [280290] trunk
- Revision
- 280290
- Author
- [email protected]
- Date
- 2021-07-26 00:42:45 -0700 (Mon, 26 Jul 2021)
Log Message
[css-grid] svg image as grid items should use the overriding logical width/height when defined to compute the logical height/width
https://bugs.webkit.org/show_bug.cgi?id=228105
Source/WebCore:
As discussed at https://github.com/w3c/csswg-drafts/issues/6286#issuecomment-866986544, degenerate
aspect ratios derived from SVG width/height attributes fall back to viewbox aspect ratio
(whether due to negative values or zero values).
When computing the logical height/width using an intrinsic aspect ratio, RenderReplaced uses the
overridingLogicalWidth/overridingLogicalHeight whenever defined as long as the flex or
grid item has an intrinsic size. For an SVG graphic though, it's common to have an intrinsic aspect
ratio but not to have an intrinsic width or height. For this special case, we still should use
overridingLogicalWidth/overridingLogicalHeight for logical height/width calculations.
Reviewed by Javier Fernandez.
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):
(WebCore::RenderReplaced::computeReplacedLogicalHeight const):
LayoutTests:
Reviewed by Javier Fernandez.
Update TestExpectations as 4 failed grid WPT tests are now passing.
* TestExpectations:
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (280289 => 280290)
--- trunk/LayoutTests/ChangeLog 2021-07-25 22:32:20 UTC (rev 280289)
+++ trunk/LayoutTests/ChangeLog 2021-07-26 07:42:45 UTC (rev 280290)
@@ -1,3 +1,14 @@
+2021-07-26 Ziran Sun <[email protected]>
+
+ [css-grid] svg image as grid items should use the overriding logical width/height when defined to compute the logical height/width
+ https://bugs.webkit.org/show_bug.cgi?id=228105
+
+ Reviewed by Javier Fernandez.
+
+ Update TestExpectations as 4 failed grid WPT tests are now passing.
+
+ * TestExpectations:
+
2021-07-25 Alexey Shvayka <[email protected]>
Partly implement Function.prototype.{caller,arguments} reflection proposal
Modified: trunk/LayoutTests/TestExpectations (280289 => 280290)
--- trunk/LayoutTests/TestExpectations 2021-07-25 22:32:20 UTC (rev 280289)
+++ trunk/LayoutTests/TestExpectations 2021-07-26 07:42:45 UTC (rev 280290)
@@ -4273,10 +4273,6 @@
webkit.org/b/209460 imported/w3c/web-platform-tests/css/css-grid/abspos/descendant-static-position-002.html [ ImageOnlyFailure ]
webkit.org/b/209460 imported/w3c/web-platform-tests/css/css-grid/abspos/descendant-static-position-003.html [ ImageOnlyFailure ]
webkit.org/b/212201 imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-limits-001.html [ Skip ]
-webkit.org/b/227900 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-aspect-ratio-stretch-1.html [ ImageOnlyFailure ]
-webkit.org/b/227900 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-aspect-ratio-stretch-2.html [ ImageOnlyFailure ]
-webkit.org/b/227900 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-aspect-ratio-stretch-3.html [ ImageOnlyFailure ]
-webkit.org/b/227900 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-aspect-ratio-stretch-4.html [ ImageOnlyFailure ]
webkit.org/b/212246 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-baseline-align-cycles-001.html [ ImageOnlyFailure ]
webkit.org/b/212246 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-content-baseline-001.html [ ImageOnlyFailure ]
webkit.org/b/212246 imported/w3c/web-platform-tests/css/css-grid/alignment/grid-item-content-baseline-002.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (280289 => 280290)
--- trunk/Source/WebCore/ChangeLog 2021-07-25 22:32:20 UTC (rev 280289)
+++ trunk/Source/WebCore/ChangeLog 2021-07-26 07:42:45 UTC (rev 280290)
@@ -1,3 +1,24 @@
+2021-07-26 Ziran Sun <[email protected]>
+
+ [css-grid] svg image as grid items should use the overriding logical width/height when defined to compute the logical height/width
+ https://bugs.webkit.org/show_bug.cgi?id=228105
+
+ As discussed at https://github.com/w3c/csswg-drafts/issues/6286#issuecomment-866986544, degenerate
+ aspect ratios derived from SVG width/height attributes fall back to viewbox aspect ratio
+ (whether due to negative values or zero values).
+
+ When computing the logical height/width using an intrinsic aspect ratio, RenderReplaced uses the
+ overridingLogicalWidth/overridingLogicalHeight whenever defined as long as the flex or
+ grid item has an intrinsic size. For an SVG graphic though, it's common to have an intrinsic aspect
+ ratio but not to have an intrinsic width or height. For this special case, we still should use
+ overridingLogicalWidth/overridingLogicalHeight for logical height/width calculations.
+
+ Reviewed by Javier Fernandez.
+
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::computeReplacedLogicalWidth const):
+ (WebCore::RenderReplaced::computeReplacedLogicalHeight const):
+
2021-07-24 Devin Rousso <[email protected]>
[Apple Pay] Do not add coupon code `ApplePayErrorCode` values for systems that do not support it
Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (280289 => 280290)
--- trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-07-25 22:32:20 UTC (rev 280289)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp 2021-07-26 07:42:45 UTC (rev 280290)
@@ -553,7 +553,7 @@
// For flex or grid items where the logical height has been overriden then we should use that size to compute the replaced width as long as the flex or
// grid item has an intrinsic size. It is possible (indeed, common) for an SVG graphic to have an intrinsic aspect ratio but not to have an intrinsic
// width or height. There are also elements with intrinsic sizes but without intrinsic ratio (like an iframe).
- if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalHeight() && hasIntrinsicWidth && hasIntrinsicHeight)
+ if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalHeight() && ((hasIntrinsicWidth && hasIntrinsicHeight) || (contentRenderer && contentRenderer->isSVGRoot() && (hasIntrinsicWidth || hasIntrinsicHeight))))
return computeReplacedLogicalWidthRespectingMinMaxWidth(roundToInt(round(overridingContentLogicalHeight() * intrinsicRatio)), shouldComputePreferred);
// If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'.
@@ -623,7 +623,7 @@
bool hasIntrinsicWidth = constrainedSize.hasIntrinsicWidth || constrainedSize.width() > 0;
// See computeReplacedLogicalHeight() for a similar check for heights.
- if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalWidth() && hasIntrinsicHeight && hasIntrinsicWidth)
+ if (intrinsicRatio && (isFlexItem() || isGridItem()) && hasOverridingLogicalWidth() && ((hasIntrinsicWidth && hasIntrinsicHeight) || (contentRenderer && contentRenderer->isSVGRoot() && (hasIntrinsicWidth || hasIntrinsicHeight))))
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'.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes