Changeset 280631 in webkit
- Timestamp:
- Aug 4, 2021, 3:57:08 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (4 diffs)
-
Source/WebCore/rendering/RenderBox.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r280630 r280631 1 2021-08-04 Cathie Chen <cathiechen@igalia.com> 2 3 REGRESSION (r277997) Images get stretched with aspect-ratio and max-width: x% 4 https://bugs.webkit.org/show_bug.cgi?id=228076 5 6 Reviewed by Antti Koivisto. 7 8 * TestExpectations: 9 1 10 2021-08-04 Tim Horton <timothy_horton@apple.com> 2 11 -
trunk/LayoutTests/TestExpectations
r280592 r280631 4712 4712 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-025.html [ ImageOnlyFailure ] 4713 4713 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-026.html [ ImageOnlyFailure ] 4714 webkit.org/b/228076 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-027.html [ ImageOnlyFailure ]4715 webkit.org/b/228076 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-028.html [ ImageOnlyFailure ]4716 4714 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-001.html [ ImageOnlyFailure ] 4717 4715 webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/contain-intrinsic-size-002.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r280630 r280631 1 2021-08-04 Cathie Chen <cathiechen@igalia.com> 2 3 REGRESSION (r277997) Images get stretched with aspect-ratio and max-width: x% 4 https://bugs.webkit.org/show_bug.cgi?id=228076 5 6 Reviewed by Antti Koivisto. 7 8 The image get stretched because constrainLogicalWidthInFragmentByMinMax returns the intrinsic width while computing MinSize. 9 According to [1], the box's minimum width is its min-content size not the MinIntrinsic width which is used because of 10 the recursion. To break the recursion, computeIntrinsicLogicalWidthUsing calls computeLogicalWidthFromAspectRatioInternal instead, 11 then checks children's width. 12 13 [1] https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum 14 15 * rendering/RenderBox.cpp: 16 (WebCore::RenderBox::constrainLogicalWidthInFragmentByMinMax const): If shouldComputeLogicalWidthFromAspectRatio, 17 the length should be treated as MinContent not MinIntrinsic. 18 (WebCore::RenderBox::computeIntrinsicLogicalWidthUsing const): To break the loop, call computeLogicalWidthFromAspectRatioInternal instead 19 to get the width from aspect-ratio and if there is child, make sure the min/max logical width not less than content's width. 20 (WebCore::RenderBox::computeLogicalWidthFromAspectRatioInternal const): 21 (WebCore::RenderBox::computeLogicalWidthFromAspectRatio const): 22 * rendering/RenderBox.h: 23 1 24 2021-08-04 Tim Horton <timothy_horton@apple.com> 2 25 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r280509 r280631 665 665 // Make sure we actually used the aspect ratio. 666 666 if (shouldComputeLogicalWidthFromAspectRatio()) 667 minLength = Length(LengthType::Min Intrinsic);667 minLength = Length(LengthType::MinContent); 668 668 } 669 669 return std::max(logicalWidth, computeLogicalWidthInFragmentUsing(MinSize, minLength, availableWidth, cb, fragment)); … … 2697 2697 LayoutUnit minLogicalWidth; 2698 2698 LayoutUnit maxLogicalWidth; 2699 if (!logicalWidthLength.isMinIntrinsic() && shouldComputeLogicalWidthFromAspectRatio()) 2700 minLogicalWidth = maxLogicalWidth = computeLogicalWidthFromAspectRatio(); 2701 else 2699 if (!logicalWidthLength.isMinIntrinsic() && shouldComputeLogicalWidthFromAspectRatio()) { 2700 minLogicalWidth = maxLogicalWidth = computeLogicalWidthFromAspectRatioInternal() - borderAndPadding; 2701 if (firstChild()) { 2702 LayoutUnit minChildrenLogicalWidth; 2703 LayoutUnit maxChildrenLogicalWidth; 2704 computeIntrinsicKeywordLogicalWidths(minChildrenLogicalWidth, maxChildrenLogicalWidth); 2705 minLogicalWidth = std::max(minLogicalWidth, minChildrenLogicalWidth); 2706 maxLogicalWidth = std::max(maxLogicalWidth, maxChildrenLogicalWidth); 2707 } 2708 } else 2702 2709 computeIntrinsicKeywordLogicalWidths(minLogicalWidth, maxLogicalWidth); 2703 2710 … … 5303 5310 } 5304 5311 5305 LayoutUnit RenderBox::computeLogicalWidthFromAspectRatio (RenderFragmentContainer* fragment) const5312 LayoutUnit RenderBox::computeLogicalWidthFromAspectRatioInternal() const 5306 5313 { 5307 5314 ASSERT(shouldComputeLogicalWidthFromAspectRatio()); … … 5309 5316 LayoutUnit logicalHeightforAspectRatio = computedValues.m_extent; 5310 5317 5311 auto logicalWidth = inlineSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalHeightforAspectRatio); 5312 5318 return inlineSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), LayoutUnit(style().logicalAspectRatio()), style().boxSizingForAspectRatio(), logicalHeightforAspectRatio); 5319 } 5320 5321 LayoutUnit RenderBox::computeLogicalWidthFromAspectRatio(RenderFragmentContainer* fragment) const 5322 { 5323 auto logicalWidth = computeLogicalWidthFromAspectRatioInternal(); 5313 5324 LayoutUnit containerWidthInInlineDirection = std::max<LayoutUnit>(0, containingBlockLogicalWidthForContentInFragment(fragment)); 5314 5325 return constrainLogicalWidthInFragmentByMinMax(logicalWidth, containerWidthInInlineDirection, *containingBlock(), fragment, AllowIntrinsic::No); -
trunk/Source/WebCore/rendering/RenderBox.h
r280075 r280631 710 710 bool shouldIgnoreAspectRatio() const; 711 711 bool shouldComputeLogicalWidthFromAspectRatio() const; 712 LayoutUnit computeLogicalWidthFromAspectRatioInternal() const; 712 713 LayoutUnit computeLogicalWidthFromAspectRatio(RenderFragmentContainer* = nullptr) const; 713 714 std::pair<LayoutUnit, LayoutUnit> computeMinMaxLogicalWidthFromAspectRatio() const;
Note:
See TracChangeset
for help on using the changeset viewer.