WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
191358
[css-grid] Refactoring to make more explicit the orthogonal items' pre-layout logic
https://bugs.webkit.org/show_bug.cgi?id=191358
Summary
[css-grid] Refactoring to make more explicit the orthogonal items' pre-layout...
Javier Fernandez
Reported
2018-11-07 06:17:22 PST
We need to adapt the code to integrate later the new Baseline Alignment logic, which in latest spec it was included as part of the Track Sizing algorithm. Orthogonal items must be laid out using a properly estimated grid area, since the result of this pre-layout may affect during the baseline offsets computation.
Attachments
Patch
(29.63 KB, patch)
2018-11-07 06:25 PST
,
Javier Fernandez
no flags
Details
Formatted Diff
Diff
Patch
(29.52 KB, patch)
2018-11-11 16:11 PST
,
Javier Fernandez
no flags
Details
Formatted Diff
Diff
Patch
(29.46 KB, patch)
2018-11-12 02:15 PST
,
Javier Fernandez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Javier Fernandez
Comment 1
2018-11-07 06:25:37 PST
Created
attachment 354085
[details]
Patch
Manuel Rego Casasnovas
Comment 2
2018-11-09 01:53:28 PST
Comment on
attachment 354085
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=354085&action=review
LGTM, but I added some minor comments inline.
> Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:602 > +bool GridTrackSizingAlgorithm::isRelativeSizedTrackAsAuto(const GridTrackSize& trackSize, GridTrackSizingDirection direction) const
This method is only used in one place, do we really need it? We call it and later we recheck the percentages things, I'm not sure if it's really adding any value.
> Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:626 > + if (isRelativeSizedTrackAsAuto(trackSize, direction)) {
I'd just modify this to something like: if (!availableSpace(direction)) { if (minTrackBreadth.isPercentage()) minTrackBreadth = Length(Auto); if (maxTrackBreadth.isPercentage()) maxTrackBreadth = Length(Auto); }
> Source/WebCore/rendering/GridTrackSizingAlgorithm.h:172 > + // Data
Is this comment really useful? If you want to keep it add a "." at the end. :-)
> Source/WebCore/rendering/RenderGrid.cpp:205 > + // Grid's layout logic controls the grid item's override height, hence > + // we need to clear any override height set previously, so it doesn't > + // interfere in current layout execution. > + // Grid never uses the override width, that's why we don't need to clear > + // it.
Nit: You don't need to line wrap so hard :-)
> Source/WebCore/rendering/RenderGrid.cpp:209 > + // We may need to repeat the track sizing in case of any grid item was > + // orthogonal.
Ditto about line wrapping.
> Source/WebCore/rendering/RenderGrid.cpp:648 > + // FIXME(jfernandez): We need a way when we are calling this during intrinsic size compuation before performing
Mmm, it seems some word is missing in this sentence. Nit: Don't remember if this FIXME(jfernandez) is common in WebKit, or just a simple FIXME.
> Source/WebCore/rendering/RenderGrid.cpp:890 > + // Because the grid area cannot be styled, we don't need to adjust > + // the grid breadth to account for 'box-sizing'.
Nit: More line wrapping.
Javier Fernandez
Comment 3
2018-11-11 16:09:09 PST
Comment on
attachment 354085
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=354085&action=review
>> Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:602 >> +bool GridTrackSizingAlgorithm::isRelativeSizedTrackAsAuto(const GridTrackSize& trackSize, GridTrackSizingDirection direction) const > > This method is only used in one place, do we really need it? We call it and later we recheck the percentages things, I'm not sure if it's really adding any value.
Well, this patch is just a refactoring needed to a follow-up patch to implement the new Baseline Alignment logic. In the next patches, I'll use this function again. I think it's useful to have this function, which is auto-explained and avoid the need of additional code comments.
>> Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:626 >> + if (isRelativeSizedTrackAsAuto(trackSize, direction)) { > > I'd just modify this to something like: > if (!availableSpace(direction)) { > if (minTrackBreadth.isPercentage()) > minTrackBreadth = Length(Auto); > if (maxTrackBreadth.isPercentage()) > maxTrackBreadth = Length(Auto); > }
I don't think this code improves current logic; also, as I commented above, I'd rather keep using the new function.
>> Source/WebCore/rendering/GridTrackSizingAlgorithm.h:172 >> + // Data > > Is this comment really useful? If you want to keep it add a "." at the end. :-)
Well, we have similar comments all over this header file, so I think is, at least, consistent with current codebase.
>> Source/WebCore/rendering/RenderGrid.cpp:205 >> + // it. > > Nit: You don't need to line wrap so hard :-)
ok
>> Source/WebCore/rendering/RenderGrid.cpp:648 >> + // FIXME(jfernandez): We need a way when we are calling this during intrinsic size compuation before performing > > Mmm, it seems some word is missing in this sentence. > Nit: Don't remember if this FIXME(jfernandez) is common in WebKit, or just a simple FIXME.
OK
>> Source/WebCore/rendering/RenderGrid.cpp:890 >> + // the grid breadth to account for 'box-sizing'. > > Nit: More line wrapping.
OK
Javier Fernandez
Comment 4
2018-11-11 16:11:57 PST
Created
attachment 354514
[details]
Patch
Manuel Rego Casasnovas
Comment 5
2018-11-12 00:29:20 PST
Comment on
attachment 354514
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=354514&action=review
> Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:605 > + return isRelativeGridLengthAsAuto(trackSize.minTrackBreadth(), direction);
I'm still not fully convinced of this. We know it's a percentage but we still check it again in isRelativeGridLengthAsAuto(), do we really need to do it twice?
Javier Fernandez
Comment 6
2018-11-12 02:15:40 PST
Created
attachment 354539
[details]
Patch
WebKit Commit Bot
Comment 7
2018-11-12 16:31:58 PST
Comment on
attachment 354539
[details]
Patch Clearing flags on attachment: 354539 Committed
r238114
: <
https://trac.webkit.org/changeset/238114
>
WebKit Commit Bot
Comment 8
2018-11-12 16:31:59 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9
2018-11-12 16:34:22 PST
<
rdar://problem/46009086
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug