Bug 228283 - Fix aspect-ratio-intrinsic-size-004.html
Summary: Fix aspect-ratio-intrinsic-size-004.html
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-07-26 09:34 PDT by Rob Buis
Modified: 2021-09-10 05:23 PDT (History)
12 users (show)

See Also:


Attachments
Patch (4.77 KB, patch)
2021-07-26 09:36 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (2.53 KB, patch)
2021-07-27 00:47 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.41 KB, patch)
2021-07-27 04:29 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.33 KB, patch)
2021-07-27 04:32 PDT, Rob Buis
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (5.34 KB, patch)
2021-07-27 04:48 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.27 KB, patch)
2021-08-14 13:56 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (3.39 KB, patch)
2021-08-14 22:52 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (4.39 KB, patch)
2021-08-27 02:19 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (4.46 KB, patch)
2021-08-27 03:57 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.38 KB, patch)
2021-08-27 05:15 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (6.17 KB, patch)
2021-08-27 09:21 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (5.51 KB, patch)
2021-08-30 00:40 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (3.96 KB, patch)
2021-08-31 03:12 PDT, Rob Buis
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (3.70 KB, patch)
2021-08-31 05:56 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (3.67 KB, patch)
2021-09-01 02:28 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (2.29 KB, patch)
2021-09-02 04:42 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (6.18 KB, patch)
2021-09-02 10:25 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (2.83 KB, patch)
2021-09-03 12:37 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (2.04 KB, patch)
2021-09-07 02:38 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (3.67 KB, patch)
2021-09-07 02:41 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (4.09 KB, patch)
2021-09-07 03:27 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (4.57 KB, patch)
2021-09-07 05:44 PDT, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (3.34 KB, patch)
2021-09-10 00:49 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 2021-07-26 09:34:18 PDT
Fix aspect-ratio-intrinsic-size-00?.html.
Comment 1 Rob Buis 2021-07-26 09:36:07 PDT
Created attachment 434211 [details]
Patch
Comment 2 Rob Buis 2021-07-26 09:38:14 PDT
Rough fix for now, I hope this bug could also fix aspect-ratio-intrinsic-size-005.html.
Comment 3 Rob Buis 2021-07-27 00:47:58 PDT
Created attachment 434275 [details]
Patch
Comment 4 Rob Buis 2021-07-27 04:29:22 PDT
Created attachment 434281 [details]
Patch
Comment 5 Rob Buis 2021-07-27 04:32:47 PDT
Created attachment 434282 [details]
Patch
Comment 6 Rob Buis 2021-07-27 04:48:41 PDT
Created attachment 434283 [details]
Patch
Comment 7 Radar WebKit Bug Importer 2021-08-02 09:35:17 PDT
<rdar://problem/81415269>
Comment 8 Rob Buis 2021-08-14 13:56:45 PDT
Created attachment 435550 [details]
Patch
Comment 9 Rob Buis 2021-08-14 22:52:18 PDT
Created attachment 435557 [details]
Patch
Comment 10 Rob Buis 2021-08-27 02:19:19 PDT
Created attachment 436615 [details]
Patch
Comment 11 Rob Buis 2021-08-27 03:57:42 PDT
Created attachment 436617 [details]
Patch
Comment 12 Rob Buis 2021-08-27 05:15:17 PDT
Created attachment 436618 [details]
Patch
Comment 13 EWS Watchlist 2021-08-27 05:16:10 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 14 Rob Buis 2021-08-27 09:21:25 PDT
Created attachment 436633 [details]
Patch
Comment 15 Rob Buis 2021-08-30 00:40:20 PDT
Created attachment 436759 [details]
Patch
Comment 16 Sergio Villar Senin 2021-08-30 01:14:12 PDT
Comment on attachment 436759 [details]
Patch

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

I've serious doubts about two call sites added by this patch  and thus the r-.

> Source/WebCore/rendering/RenderFlexibleBox.cpp:353
> +    dirtyForLayoutFromPercentageHeightDescendants();

This looks pretty interesting indeed. I haven't realized before that it's only called from RenderBlockFlow and thus never for flexboxes. I wonder whether we should call it from RenderFlexibleBox::layoutAndPlaceChildren() to kind of mimic the location where it's called in RenderBlockFlow...

> Source/WebCore/rendering/RenderFlexibleBox.cpp:966
> +            return percentageLogicalHeightIsResolvable();

Hmm I am not sure we could call percentageLogicalHeightIsResolvable() here. This method could start the following sequence:

percentageLogicalHeightIsResolvable()->computePercentageLogicalHeight()->availableLogicalHeightForPercentageComputation()->useChildOverridingLogicalHeightForPercentageResolution()->useChildOverridingMainSizeForPercentageResolution()->canComputePercentageFlexBasis()->computePercentageLogicalHeight()->availableLogicalHeightForPercentageComputation() ...

entering a loop of calls. Do you have a test for this case?

> Source/WebCore/rendering/RenderFlexibleBox.cpp:1056
> +            addPercentHeightDescendant(*child);

Doesn't look 100% correct. A content dependent size (like min-content, max-content etc...) isn't also definite but it isn't a percentage.

Also it shouldn't be really called from RenderFlexibleBox, looks something we're missing in RenderBox to handle the case of items with aspect ratio.
Comment 17 Rob Buis 2021-08-31 03:12:38 PDT
Created attachment 436867 [details]
Patch
Comment 18 Rob Buis 2021-08-31 05:56:21 PDT
Created attachment 436879 [details]
Patch
Comment 19 Rob Buis 2021-09-01 02:28:52 PDT
Created attachment 437004 [details]
Patch
Comment 20 Rob Buis 2021-09-02 04:42:43 PDT
Created attachment 437136 [details]
Patch
Comment 21 Rob Buis 2021-09-02 10:25:28 PDT
Created attachment 437165 [details]
Patch
Comment 22 Rob Buis 2021-09-03 12:37:02 PDT
Created attachment 437297 [details]
Patch
Comment 23 Rob Buis 2021-09-07 02:38:42 PDT
Created attachment 437470 [details]
Patch
Comment 24 Rob Buis 2021-09-07 02:41:04 PDT
Created attachment 437471 [details]
Patch
Comment 25 Rob Buis 2021-09-07 03:27:07 PDT
Created attachment 437479 [details]
Patch
Comment 26 Rob Buis 2021-09-07 05:44:00 PDT
Created attachment 437492 [details]
Patch
Comment 27 Sergio Villar Senin 2021-09-09 02:31:47 PDT
Comment on attachment 437492 [details]
Patch

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

We're getting there, thanks for your patience providing alternatives :)

> Source/WebCore/rendering/RenderFlexibleBox.cpp:1789
> +

I'd better not use this name as is too similar to RenderBlock's needsPreferredWidthsRecalculation(). I'd go for a more specific name like childHasAspectRatioAndStretchedLogicalHeight() or the like.

However this method is so specific and used just once that I think we can get rid of it (or at the most convert it into a lambda in the place you use it)

> Source/WebCore/rendering/RenderFlexibleBox.cpp:1874
> +            child.setPreferredLogicalWidthsDirty(true, MarkOnlyThis);

The setPreferredLogicalWidthsDirty() is done by updateBlockChildDirtyBitsBeforeLayout(), you just need to set forceChildRelayout to true as in the block above for percentage children. So something like this:

if (!forceChildRelayout && (childHasPercentHeightDescendants(child) || (child.style().hasAspectRatio() && child.hasStretchedLogicalHeight()))) {
   [...]
   forceChildRelayout = true;
}

should do the job.
Comment 28 Rob Buis 2021-09-10 00:49:47 PDT
Created attachment 437849 [details]
Patch
Comment 29 Sergio Villar Senin 2021-09-10 04:30:02 PDT
Comment on attachment 437849 [details]
Patch

Awesome thanks!
Comment 30 EWS 2021-09-10 05:23:23 PDT
Committed r282264 (241542@main): <https://commits.webkit.org/241542@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 437849 [details].