RESOLVED FIXED 243321
[css-aspect-ratio] The transferred min/max sizes should be constrained by defined sizes
https://bugs.webkit.org/show_bug.cgi?id=243321
Summary [css-aspect-ratio] The transferred min/max sizes should be constrained by def...
cathiechen
Reported 2022-07-28 15:51:32 PDT
The transferred min/max sizes should be constrained by defined sizes. https://www.w3.org/TR/css-sizing-4/#aspect-ratio-size-transfers
Attachments
WIP-patch (14.73 KB, patch)
2022-07-28 15:54 PDT, cathiechen
ews-feeder: commit-queue-
WIP-patch (14.86 KB, patch)
2022-08-01 08:19 PDT, cathiechen
no flags
WIP-patch (13.87 KB, patch)
2022-08-01 11:00 PDT, cathiechen
no flags
WIP-patch (13.87 KB, patch)
2022-08-01 11:25 PDT, cathiechen
no flags
cathiechen
Comment 1 2022-07-28 15:54:34 PDT
Created attachment 461283 [details] WIP-patch WIP Patch.
Rob Buis
Comment 2 2022-08-01 03:03:18 PDT
Comment on attachment 461283 [details] WIP-patch View in context: https://bugs.webkit.org/attachment.cgi?id=461283&action=review > Source/WebCore/rendering/RenderBox.cpp:5576 > + if (!style().hasAspectRatio()) Can this happen? Should it be an ASSERT?
Rob Buis
Comment 3 2022-08-01 03:07:57 PDT
Comment on attachment 461283 [details] WIP-patch View in context: https://bugs.webkit.org/attachment.cgi?id=461283&action=review > Source/WebCore/rendering/RenderBox.cpp:5557 > std::pair<LayoutUnit, LayoutUnit> RenderBox::computeMinMaxLogicalWidthFromAspectRatio() const I think this can be merged with computeMinMaxLogicalHeightFromAspectRatio. > Source/WebCore/rendering/RenderBox.cpp:5559 > + if (!style().hasAspectRatio()) Can this happen? Should it be an ASSERT?
cathiechen
Comment 4 2022-08-01 08:14:35 PDT
Comment on attachment 461283 [details] WIP-patch View in context: https://bugs.webkit.org/attachment.cgi?id=461283&action=review >> Source/WebCore/rendering/RenderBox.cpp:5559 >> + if (!style().hasAspectRatio()) > > Can this happen? Should it be an ASSERT? Done, thanks >> Source/WebCore/rendering/RenderBox.cpp:5576 >> + if (!style().hasAspectRatio()) > > Can this happen? Should it be an ASSERT? Done
cathiechen
Comment 5 2022-08-01 08:19:02 PDT
Created attachment 461333 [details] WIP-patch
cathiechen
Comment 6 2022-08-01 11:00:15 PDT
Created attachment 461335 [details] WIP-patch
Rob Buis
Comment 7 2022-08-01 11:07:55 PDT
Comment on attachment 461335 [details] WIP-patch View in context: https://bugs.webkit.org/attachment.cgi?id=461335&action=review > LayoutTests/TestExpectations:-4602 > -webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-045.html [ ImageOnlyFailure ] Possibly it fixes select-element-001.html (on Mac). > Source/WebCore/rendering/RenderBox.cpp:679 > + return; Should this be an ASSERT too? > Source/WebCore/rendering/RenderBox.cpp:693 > + auto shouldCheckTransferredSizes = [&](const Length& dependedLength, const Length& determinedLength) { dependend* > Source/WebCore/rendering/RenderBox.h:726 > + enum class ConstrainWidthOrHeight { Width, Height }; This seems a bit superfluous. Something like ConstrainDimension { Width, Height }; ?
cathiechen
Comment 8 2022-08-01 11:19:11 PDT
Comment on attachment 461335 [details] WIP-patch View in context: https://bugs.webkit.org/attachment.cgi?id=461335&action=review >> LayoutTests/TestExpectations:-4602 >> -webkit.org/b/214463 imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-045.html [ ImageOnlyFailure ] > > Possibly it fixes select-element-001.html (on Mac). Yes, removed. >> Source/WebCore/rendering/RenderBox.cpp:679 >> + return; > > Should this be an ASSERT too? Done >> Source/WebCore/rendering/RenderBox.cpp:693 >> + auto shouldCheckTransferredSizes = [&](const Length& dependedLength, const Length& determinedLength) { > > dependend* Done, thanks >> Source/WebCore/rendering/RenderBox.h:726 >> + enum class ConstrainWidthOrHeight { Width, Height }; > > This seems a bit superfluous. Something like ConstrainDimension { Width, Height }; ? Done, thanks!
cathiechen
Comment 9 2022-08-01 11:25:36 PDT
Created attachment 461336 [details] WIP-patch
Rob Buis
Comment 10 2022-08-01 13:21:20 PDT
Comment on attachment 461335 [details] WIP-patch View in context: https://bugs.webkit.org/attachment.cgi?id=461335&action=review > Source/WebCore/rendering/RenderBox.cpp:744 > + return std::clamp(logicalWidth, computedMinWidth, computedMaxWidth); Here we should take care to optimize the non preferred aspect ratio case, which should be the more common one. > Source/WebCore/rendering/RenderBox.cpp:766 > + LayoutUnit MaxH = computedLogicalMaxHeight ? computedLogicalMaxHeight.value() : LayoutUnit::max(); Variable names should not start with capitals. > Source/WebCore/rendering/RenderBox.cpp:767 > + LayoutUnit MinH = computedLogicalMinHeight ? computedLogicalMinHeight.value() : LayoutUnit(); Ditto. > Source/WebCore/rendering/RenderBox.cpp:770 > + return std::clamp(logicalHeight, MinH, MaxH); See above.
cathiechen
Comment 11 2022-08-02 11:50:32 PDT
Radar WebKit Bug Importer
Comment 12 2022-08-04 15:52:15 PDT
EWS
Comment 13 2022-08-09 10:29:34 PDT
Committed 253262@main (94a7be7787d3): <https://commits.webkit.org/253262@main> Reviewed commits have been landed. Closing PR #2952 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.