Bug 159253 - [css-grid] Inline size is never indefinite during layout
Summary: [css-grid] Inline size is never indefinite during layout
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Manuel Rego Casasnovas
URL:
Keywords: BlinkMergeCandidate
Depends on:
Blocks: 60731
  Show dependency treegraph
 
Reported: 2016-06-29 00:32 PDT by Manuel Rego Casasnovas
Modified: 2016-07-08 03:11 PDT (History)
8 users (show)

See Also:


Attachments
Patch (41.11 KB, patch)
2016-06-29 00:37 PDT, Manuel Rego Casasnovas
no flags Details | Formatted Diff | Diff
Patch (48.68 KB, patch)
2016-07-06 07:29 PDT, Manuel Rego Casasnovas
no flags Details | Formatted Diff | Diff
Patch for landing (48.68 KB, patch)
2016-07-08 02:41 PDT, Manuel Rego Casasnovas
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Rego Casasnovas 2016-06-29 00:32:03 PDT
This bug is related with the following text on the spec [1]:
"If the inline or block size of the grid container is indefinite, 
 <percentage> values relative to that size are treated as auto."

The thing is that the inline size is only indefinite while
we're computing the intrinsic sizes of the grid container.
However during layout the inline size is always definite,
so we can resolve the percentage tracks against it.

See a more detailed explanation on the CSS WG mailing list:
https://lists.w3.org/Archives/Public/www-style/2016Jun/0007.html

And also on the Firefox bugzilla discussion:
https://bugzilla.mozilla.org/show_bug.cgi?id=1264607

This has been already fixed in Blink:
https://codereview.chromium.org/2033033002

[1] https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-percentage
Comment 1 Manuel Rego Casasnovas 2016-06-29 00:37:24 PDT
Created attachment 282330 [details]
Patch
Comment 2 Sergio Villar Senin 2016-07-06 02:59:03 PDT
Comment on attachment 282330 [details]
Patch

There are many more gridTrackSize() calls in the code, are you completely sure that all the other ones are only called during the TrackSizing phase?
Comment 3 Manuel Rego Casasnovas 2016-07-06 07:29:42 PDT
Created attachment 282892 [details]
Patch
Comment 4 Manuel Rego Casasnovas 2016-07-06 07:31:17 PDT
(In reply to comment #2)
> Comment on attachment 282330 [details]
> Patch
> 
> There are many more gridTrackSize() calls in the code, are you completely
> sure that all the other ones are only called during the TrackSizing phase?

Yep you're right, I just make the SizingOperation a mandatory argument for gridTrackSize().
So we're sure we're passing the right one in every call.

Otherwise, it was hard to tell if all of them were called during the TrackSizing phase only.
Comment 5 Sergio Villar Senin 2016-07-08 01:44:02 PDT
Comment on attachment 282892 [details]
Patch

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

> Source/WebCore/ChangeLog:12
> +        This makes Grid Layout compatible with regular blocks regarding

Put everything in the same paragraph.

> Source/WebCore/rendering/RenderGrid.cpp:763
> +        // For the inline axis this only happens when we're computing the intrinsic sizes (AvailableSpaceIndefinite).

Better use IntrinsicSizeComputation which is what we're checking bellow.

> LayoutTests/fast/css-grid-layout/percent-track-breadths-regarding-container-size.html:122
> +    <!-- The height of the row is wrong calculated in the following 2 examples because of a bug in

FIXME needed?
Comment 6 Manuel Rego Casasnovas 2016-07-08 02:41:51 PDT
Created attachment 283131 [details]
Patch for landing

Thanks for the review. Applied suggested changes.
Comment 7 WebKit Commit Bot 2016-07-08 03:11:49 PDT
Comment on attachment 283131 [details]
Patch for landing

Clearing flags on attachment: 283131

Committed r202974: <http://trac.webkit.org/changeset/202974>
Comment 8 WebKit Commit Bot 2016-07-08 03:11:54 PDT
All reviewed patches have been landed.  Closing bug.