[Webkit-unassigned] [Bug 222376] [css-grid] Replace the use of -1 with WTF::nullopt

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Mar 8 12:00:47 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=222376

--- Comment #9 from zsun at igalia.com ---
(In reply to Sergio Villar Senin from comment #7)
> Comment on attachment 422559 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422559&action=review
> 
> Definitely a step in the right direction. There are some changes that need
> to be done though
> 
> > Source/WebCore/ChangeLog:6
> > +        This change replaces -1 with nullopt in grid to indicate indefinte for funtions that
> 
> nit: indefinite
> 
Corrected.

> > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:912
> > +        overrideSize = WTF::nullopt;
> 
> Instead of doing this, change estimatedGridAreaBreadthForChild() so that it
> returns an Optional<LayoutUnit> and make it return nullopt instead of -1_lu
> 
I tried this approach. The main issue is that LayoutUnit GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild(const RenderBox& child, GridTrackSizingDirection direction) is called by LayoutSize GridTrackSizingAlgorithm::estimatedGridAreaBreadthForChild(const RenderBox& child) const. LayoutSize doesn't like Optional<LayoutUnit>, especially when it's WTF::nullopt. I'm not sure how feasible this approach is. Any suggestions?

> > Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:1064
> > +            overridingSize = WTF::nullopt;
> 
> You can do it with a ternary operator:
> auto overridingSize = direction() == childInlineDirection ?
> makeOptional(0_lu) : WTF::nullopt;
> 
> In that case maybe you don't even need the overridingSize variable and pass
> the value directly as argument to setOverriding...
> 
Updated. Thanks very much for the suggestion!

> > Source/WebCore/rendering/RenderGrid.cpp:928
> >  }
> 
> If we change estimatedGridAreaBreadthForChild() as I suggested above then we
> don't need this change.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210308/546468bc/attachment.htm>


More information about the webkit-unassigned mailing list