Bug 221337 - Fix replaced element definiteness as a grid-item
Summary: Fix replaced element definiteness as a grid-item
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-03 09:15 PST by zsun
Modified: 2021-03-08 13:13 PST (History)
12 users (show)

See Also:


Attachments
Patch (5.91 KB, patch)
2021-02-05 07:56 PST, zsun
no flags Details | Formatted Diff | Diff
Patch (11.66 KB, patch)
2021-02-16 06:20 PST, zsun
no flags Details | Formatted Diff | Diff
Patch (12.52 KB, patch)
2021-02-23 08:05 PST, zsun
no flags Details | Formatted Diff | Diff
Patch (11.67 KB, patch)
2021-02-25 06:12 PST, zsun
no flags Details | Formatted Diff | Diff
Patch (11.63 KB, patch)
2021-02-26 07:21 PST, zsun
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zsun 2021-02-03 09:15:39 PST
percentage-size-indefinite-replaced.html in WPT fails for Safari
Comment 1 zsun 2021-02-05 07:56:15 PST
Created attachment 419408 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2021-02-10 09:16:13 PST
<rdar://problem/74191286>
Comment 3 Javier Fernandez 2021-02-15 13:52:10 PST
Comment on attachment 419408 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        has an indefinite containing-block override logical-height.

I think it'd be useful to know why we need to return false for replaced grid items. Perhaps an excerpt of the spec and a link to the section where it's stated.

> Source/WebCore/rendering/RenderBoxModelObject.cpp:285
> +        return thisBox->overridingContainingBlockContentLogicalHeight() == WTF::nullopt;

I don't understand why this change affects only to replaced grid items. Could you please elaborate on this ?
Comment 4 zsun 2021-02-16 06:20:54 PST
Created attachment 420464 [details]
Patch
Comment 5 zsun 2021-02-16 06:53:23 PST
(In reply to Javier Fernandez from comment #3)
> Comment on attachment 419408 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=419408&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        has an indefinite containing-block override logical-height.
> 
> I think it'd be useful to know why we need to return false for replaced grid
> items. Perhaps an excerpt of the spec and a link to the section where it's
> stated.
> 

Updated. 
> > Source/WebCore/rendering/RenderBoxModelObject.cpp:285
> > +        return thisBox->overridingContainingBlockContentLogicalHeight() == WTF::nullopt;
> 
> I don't understand why this change affects only to replaced grid items.
> Could you please elaborate on this ?

I think function hasAutoHeightOrContainingBlockWithAutoHeight() is only called by replaced handlers, right? I'm not sure why it's only for grid items though.
Comment 6 Javier Fernandez 2021-02-22 06:58:29 PST
Comment on attachment 419408 [details]
Patch

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

>>> Source/WebCore/rendering/RenderBoxModelObject.cpp:285
>>> +        return thisBox->overridingContainingBlockContentLogicalHeight() == WTF::nullopt;
>> 
>> I don't understand why this change affects only to replaced grid items. Could you please elaborate on this ?
> 
> I think function hasAutoHeightOrContainingBlockWithAutoHeight() is only called by replaced handlers, right? I'm not sure why it's only for grid items though.

I missed that one of the clauses checks that this is indeed a grid item. However, I still have doubts about this change. 

I believe we indeed use in the GridTrackSizingAlgorithm logic a nullopt value for setting an indefinite size to the grid area (the grid item's override size). However, I've found some places where we still use -1 for that purpose (eg. RenderGrid::placeItemsOnGrid). I think nullopt is the correct choice, but I'd be more comfortable if we double check and correct the lines where we still use -1. I'd like to have layout tests to ensure the changes are verified.

Another idea to consider is that if this is a grid item, it shouldn't be valid that hasOverridingContainingBlockContentLogicalHeight(), since we initialize of the values, if I'm not wrong. We could add change this conditional clause for an assert.
Comment 7 zsun 2021-02-23 08:05:15 PST
Created attachment 421312 [details]
Patch
Comment 8 Sergio Villar Senin 2021-02-23 08:14:54 PST
Haven't checked the patch in detail but note that Rob is removing the usage of -1 in grid here https://bugs.webkit.org/show_bug.cgi?id=221439. We should use nullopt in those cases.
Comment 9 Javier Fernandez 2021-02-23 12:50:02 PST
(In reply to Sergio Villar Senin from comment #8)
> Haven't checked the patch in detail but note that Rob is removing the usage
> of -1 in grid here https://bugs.webkit.org/show_bug.cgi?id=221439. We should
> use nullopt in those cases.

Good to know. We should definitively wait for that patch to land before considering this. 

I don't have permissions for editing bug 221439, but probably it'd be a good idea to mark it as blocker for this.
Comment 10 zsun 2021-02-25 06:12:41 PST
Created attachment 421519 [details]
Patch
Comment 11 zsun 2021-02-26 07:21:39 PST
Created attachment 421642 [details]
Patch
Comment 12 Javier Fernandez 2021-02-26 09:23:20 PST
Comment on attachment 421642 [details]
Patch

r=me 

Lets wait for the EWS bots, though, but it looks good.
Comment 13 EWS 2021-03-08 13:12:59 PST
Committed r274099: <https://commits.webkit.org/r274099>

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