REOPENED 223504
[css-grid] Set hasIntrinsicWidth & hasIntrinsicHeight properties for SVG element's intrinsic size
https://bugs.webkit.org/show_bug.cgi?id=223504
Summary [css-grid] Set hasIntrinsicWidth & hasIntrinsicHeight properties for SVG elem...
zsun
Reported 2021-03-19 02:47:05 PDT
The following WPT tests on stretched SVGs without an aspect-ratio are failing in WebKit: css/css-grid/alignment/grid-item-no-aspect-ratio-stretch-6.html css/css-grid/alignment/grid-item-no-aspect-ratio-stretch-7.html
Attachments
Patch (8.73 KB, patch)
2021-03-19 03:26 PDT, zsun
no flags
Patch (8.83 KB, patch)
2021-04-06 04:15 PDT, zsun
no flags
Patch (7.96 KB, patch)
2021-04-06 07:24 PDT, zsun
no flags
Patch (8.45 KB, patch)
2021-04-09 05:18 PDT, zsun
no flags
Rebase the original fix (18.60 KB, patch)
2022-02-27 17:12 PST, Wenson Hsieh
ews-feeder: commit-queue-
zsun
Comment 1 2021-03-19 03:26:49 PDT
Javier Fernandez
Comment 2 2021-03-24 10:18:17 PDT
Comment on attachment 423712 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=423712&action=review > Source/WebCore/rendering/svg/RenderSVGRoot.cpp:83 > + intrinsicSize.hasWidth = svgSVGElement().hasIntrinsicWidth(); I'm not sure I understand well enough the meaning of the hasWidth/hasHeight attributes. Looking at how you are using it, wouldn't be a clearer name something like "isIntrinsicWidth/isIntrinsiHeight" ?
Radar WebKit Bug Importer
Comment 3 2021-03-26 02:48:13 PDT
zsun
Comment 4 2021-04-02 03:46:08 PDT
(In reply to Javier Fernandez from comment #2) > Comment on attachment 423712 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=423712&action=review > > > Source/WebCore/rendering/svg/RenderSVGRoot.cpp:83 > > + intrinsicSize.hasWidth = svgSVGElement().hasIntrinsicWidth(); > > I'm not sure I understand well enough the meaning of the hasWidth/hasHeight > attributes. Looking at how you are using it, wouldn't be a clearer name > something like "isIntrinsicWidth/isIntrinsiHeight" ? hasWidth/hasHeight here means that whether width/height has been set. Since we are introducing these properties in FloatSize.h, I thought it might be better to make it more generic. When we call intrinsicSize.*, we know that we are referring width/height of the intrinsicSize. Also it's to be inline with has_width/has_height in Chromium for this situation.
zsun
Comment 5 2021-04-06 04:15:02 PDT
zsun
Comment 6 2021-04-06 07:24:48 PDT
Javier Fernandez
Comment 7 2021-04-09 04:42:21 PDT
Comment on attachment 425275 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425275&action=review r=me > Source/WebCore/rendering/RenderReplaced.cpp:630 > + bool hasIntrinsicHeight = constrainedSize.hasIntrinsicHeight || constrainedSize.height() > 0; I'd suggest a comment here to note that we are only updating the hasIntrinsicHeight flag for SVG elements, but that ideally, we would like to use it in all the cases and get rid of the constrainedSize.height() > 0 clause.
zsun
Comment 8 2021-04-09 05:18:30 PDT
EWS
Comment 9 2021-04-09 12:05:14 PDT
Committed r275772 (236347@main): <https://commits.webkit.org/236347@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 425614 [details].
Simon Fraser (smfr)
Comment 10 2022-02-16 16:57:05 PST
Comment on attachment 425614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425614&action=review > Source/WebCore/platform/graphics/FloatSize.h:76 > + bool hasIntrinsicWidth = false; > + bool hasIntrinsicHeight = false; Why are these here?
Simon Fraser (smfr)
Comment 11 2022-02-16 17:05:29 PST
Comment on attachment 425614 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425614&action=review >> Source/WebCore/platform/graphics/FloatSize.h:76 >> + bool hasIntrinsicHeight = false; > > Why are these here? This increased the size of FloatSize, FloatRect and all classes that use them, and means that FloatSize no longer fits into a 64-bit register. It's also a layering violation; it makes no sense for this basic geometry class to hold information related to layout.
Tim Horton
Comment 12 2022-02-16 17:17:43 PST
Wenson Hsieh
Comment 13 2022-02-27 17:12:11 PST
Created attachment 453361 [details] Rebase the original fix
Wenson Hsieh
Comment 14 2022-02-27 17:14:42 PST
(In reply to Tim Horton from comment #12) > Reverting in https://bugs.webkit.org/show_bug.cgi?id=236743, reopening. (Let's also ensure these WPT fixes don't get lost moving forward due to the revert) I uploaded a version of Ziran's original change that doesn't add the new flags to FloatSize (but instead plumbs them as arguments through the affected rendering codepaths).
zsun
Comment 15 2022-02-28 02:44:06 PST
Thanks very much Wenson for helping with this. Sorry that I didn't manage to find time last week to look into it. I think Wenson's patch pretty much wraps up what I initially intended to achieve but without increasing FloatSize. Thanks for the lovely solution.
Wenson Hsieh
Comment 16 2022-02-28 12:59:43 PST
Comment on attachment 453361 [details] Rebase the original fix (iOS WK2 failures seem unrelated)
Darin Adler
Comment 17 2022-02-28 14:59:48 PST
Comment on attachment 453361 [details] Rebase the original fix View in context: https://bugs.webkit.org/attachment.cgi?id=453361&action=review > Source/WebCore/rendering/RenderBox.h:615 > + virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* hasIntrinsicWidth */, bool& /* hasIntrinsicHeight */) const { } In future I think this needs to start returning a structure, not take 4 out arguments.
Wenson Hsieh
Comment 18 2022-02-28 16:15:23 PST
Comment on attachment 453361 [details] Rebase the original fix (In reply to Darin Adler from comment #17) > Comment on attachment 453361 [details] > Rebase the original fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=453361&action=review > > > Source/WebCore/rendering/RenderBox.h:615 > > + virtual void computeIntrinsicRatioInformation(FloatSize& /* intrinsicSize */, double& /* intrinsicRatio */, bool& /* hasIntrinsicWidth */, bool& /* hasIntrinsicHeight */) const { } > > In future I think this needs to start returning a structure, not take 4 out > arguments. Sounds good! Since this patch touches all of the method signatures anyways, I think we should just do it as a part of this change.
Ahmad Saleem
Comment 19 2023-08-07 15:46:16 PDT
Based on Comment 0, we only have now 'grid-item-no-aspect-ratio-stretch-6.html' and we are still failing this and other two as well: https://wpt.fyi/results/css/css-grid/alignment?label=master&label=experimental&aligned&q=grid-item-no-aspect-ratio-stretch- Adding 'WPTImpact' tag as well for tracking purposes.
Note You need to log in before you can comment on or make changes to this bug.