Bug 243209 - Fix aspect-ratio/flex-aspect-ratio-031.html
Summary: Fix aspect-ratio/flex-aspect-ratio-031.html
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-07-26 05:00 PDT by Rob Buis
Modified: 2022-07-29 08:52 PDT (History)
10 users (show)

See Also:


Attachments
Patch (5.64 KB, patch)
2022-07-26 05:06 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (4.83 KB, patch)
2022-07-26 08:25 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.67 KB, patch)
2022-07-27 08:57 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (7.63 KB, patch)
2022-07-29 05:42 PDT, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rob Buis 2022-07-26 05:00:39 PDT
Fix aspect-ratio/flex-aspect-ratio-031.html.
Comment 1 Rob Buis 2022-07-26 05:06:28 PDT
Created attachment 461220 [details]
Patch
Comment 2 Rob Buis 2022-07-26 08:25:10 PDT
Created attachment 461224 [details]
Patch
Comment 3 Rob Buis 2022-07-27 08:57:25 PDT
Created attachment 461247 [details]
Patch
Comment 4 Darin Adler 2022-07-28 09:54:33 PDT
Comment on attachment 461247 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=461247&action=review

> Source/WebCore/rendering/RenderFlexibleBox.cpp:930
> +        std::optional<LayoutUnit> childSize = mainAxisIsChildInlineAxis(child) ? child.computePercentageLogicalHeight(crossSizeLength) : adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLength, contentWidth()), crossSizeLength.type());

Slightly better if we just use auto here, I think.

> Source/WebCore/rendering/RenderFlexibleBox.cpp:947
> +            if (child.style().boxSizingForAspectRatio() == BoxSizing::ContentBox)
> +                crossSize -= isHorizontalFlow() ? child.verticalBorderAndPaddingExtent() : child.horizontalBorderAndPaddingExtent();
> +            else
> +                borderAndPadding = isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent();

Do we have enough test cases that we know we got all 4 of these cases right?

> Source/WebCore/rendering/RenderFlexibleBox.cpp:955
> +        return std::max(LayoutUnit(), LayoutUnit(crossSize * ratio) - borderAndPadding);

Could consider 0_lu instead of LayoutUnit().
Comment 5 Rob Buis 2022-07-29 05:42:49 PDT
Created attachment 461291 [details]
Patch
Comment 6 Rob Buis 2022-07-29 05:45:07 PDT
Comment on attachment 461247 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=461247&action=review

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:930
>> +        std::optional<LayoutUnit> childSize = mainAxisIsChildInlineAxis(child) ? child.computePercentageLogicalHeight(crossSizeLength) : adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLength, contentWidth()), crossSizeLength.type());
> 
> Slightly better if we just use auto here, I think.

Done.

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:947
>> +                borderAndPadding = isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent();
> 
> Do we have enough test cases that we know we got all 4 of these cases right?

Yes, this is tested by flex-aspect-ratio-025.html and flex-aspect-ratio-026.html. Sadly although this patch improves those tests more work is needed to make them fully pass.

>> Source/WebCore/rendering/RenderFlexibleBox.cpp:955
>> +        return std::max(LayoutUnit(), LayoutUnit(crossSize * ratio) - borderAndPadding);
> 
> Could consider 0_lu instead of LayoutUnit().

Done.
Comment 7 EWS 2022-07-29 08:51:46 PDT
Committed 252949@main (e1869c79a82b): <https://commits.webkit.org/252949@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 461291 [details].
Comment 8 Radar WebKit Bug Importer 2022-07-29 08:52:16 PDT
<rdar://problem/97787509>