-
Notifications
You must be signed in to change notification settings - Fork 708
[css-grid] Percentage tracks and indefinite sizes #1921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The Working Group just discussed
The full IRC log of that discussion<frremy> Topic: Percentage tracks<fantasai> Github: https://github.com//issues/1921 <Rossen> github:https://github.com//issues/1921 <frremy> lajava: To keep things symmetric, we tried to add cases to resolve percentages for height of rows <frremy> lajava: But we don't have min-content phase in the block direction, like we do for width <frremy> lajava: So we would need to duplicate a second pass to make this work <frremy> lajava: So 1st we would like this recorded clearly in the spec if that is required <frremy> lajava: And all browsers would have to change their implementation <frremy> florian: and why not just follow what browsers already have implemented? <frremy> Rossen: the change would be relatively straighforward, it's no big deal <frremy> florian: but we would possibly break content, right? <frremy> Rossen: everything we do ends up breaking someone's content, I don't think this would be an issue here <frremy> lajava: well, we are still unsure about what would happen in more complex cases like in orthogonal flows <frremy> lajava: but at the very least it would require a second pass, once you know the intrinsic height <frremy> Rossen: any opinion from Mozilla? <frremy> Rossen: there is still time to fix, but window is closing <frremy> dholbert: I don't have a strong opinion, and Matt hasn't commented on the issue <frremy> dholbert: I don't like adding new layout steps usually <frremy> Rossen: but it's easy to know if you need to do it before hand <frremy> Rossen: only do it if you have percentage-sized row tracks <frremy> dholbert: but if it is an orthogonal flow, you have to relayout entirely right? <frremy> lajava: yes, but this already happens anyway <dholbert> s/Matt/Mats/ <frremy> Rossen: any objection? <frremy> RESOLVED: percentage tracks sized as percentage resolve the same way for columns and rows, which involves a second layout pass in some cases |
To clarify, the spec is currently written in conformance with the above resolution (see https://drafts.csswg.org/css-grid-1/#valdef-grid-template-columns-length-percentage and https://drafts.csswg.org/css-grid-1/#intrinsic-sizes). But overall what's happening doesn't seem to be very clearly described. Afaict, we could describe what is happening as the following (which is then implemented differently in UAs in order to optimize the number of passes):
Does this seem correct, or are there shortcuts under #1 that aren't reflected here? |
Yes, probably that would be fine, despite Blink/WebKit implementation don't do that. So for us it'll imply an extra pass as described in #1 but probably that's just an implementation detail that shouldn't be considered in the spec. Regarding this change, I've been checking it again and all browsers (Chromium, Firefox, Edge and Safari) have the old behavior (percentage rows are treated as |
CSSWG resolved back in January 2017 about how percentage rows in a grid container with indefinite height work, to make them symmetric to what happens for columns. Which has been ratified in the last F2F meeting at TPAC 2017. All this has been discussed in the following issue: w3c/csswg-drafts#1921 No browser is doing that right now, so it'd be nice to gather some data about the usage of this before changing the implementation. For that reason this patch adds a new use counter to check when this change will have impact on real websites. Change-Id: I61b82957d2bfe53912fd3e53a6bd41a6491a67be Reviewed-on: https://chromium-review.googlesource.com/796855 Reviewed-by: Christian Biesinger <cbiesinger@chromium.org> Commit-Queue: Manuel Rego Casasnovas <rego@igalia.com> Cr-Commit-Position: refs/heads/master@{#520213}
The Working Group just discussed The full IRC log of that discussion<dael> Topic: [css-grid] Percentage tracks and indefinite sizes<dael> github: https://github.com//issues/1921#issuecomment-347993853 <dael> astearns: We decided on a change, but it was pointed out impl have interop. <dael> fantasai: We discussed that at tpac. We re-resolved to do the thing impl don't do. THis is the are you sure you meant the thing. <dael> florian: We took impl into account when we decided, yes? <dael> fantasai: We did. <dael> TabAtkins: We just want to be able to mark WG is cool with this. <dael> astearns: I'm looking at tpac discussion and I see Rossen_ said this is fine, not a big deal. <dael> TabAtkins: He jsut didn't want to do it alone b/c it's a breaking change. <dael> Rossen_: That's true. That's still my point. I'm still okay as long as others do the change as well. <dael> Rossen_: We're still cool. Others? <dael> astearns: webkit or gecko? <dael> dbaron: It's a question for Mats or dholbert <dael> astearns: dholbert deferred to Mats <dael> astearns: Given we have two impl willing to make the change and no obj from the others, shall we reaffirm we want this change? <dael> astearns: Objections? <dael> dbaron: Who will change first? <dael> dbaron: If no one will do that we shouldn't do it. <dael> fantasai: Rossen_ it looks like webkit and blink will follow if you lead. <fantasai> mrego said “We're not planing to change Blink/WebKit implementations until other browsers do it” <dael> Rossen_: I won't do it the same way we tried with control characters. I will allow the market leader to lead and we will happily follow. The change is straight forward, but I don't want to introduce interop change. <dael> Rossen_: For technical decision I'm fine. For scheduling and who when, we won't be first. <dael> fantasai: Rego said they won't change until other broswers do it. Igalia folks are good about following up so I don't think it'll get lost. But it will require MS to go first or at least say it's impla ndwill release on a date as long as WB and blink will also trigger. <dael> Rossen_: How about we table scheduling discussion. If it's as easy for Rego and Igalia as it is for us, let's stop the discussion and we'll discuss timing. As far as spec decision is concerned we'll ship first as long as there are assurances others will follow. <dael> rego: We checked how many chases will go through this. We first want to gather data on how many websites will break with this change. <dael> Rossen_: You want us to change to see breakage? <dael> rego: No, we added a use counter in chromium to gather data. So we want to wait to gather some data before doing anything. <dael> Rossen_: Sounds good. Let us know that data and what it shows. <dael> rego: Sure. <dael> astearns: So anything more on this issue? <dael> Rossen_: Is take away everyone is still okay pending some data collection from Igalia folks? <rego> astearns, good summary :-) <dael> astearns: Yes, pending data collection, impl complexity, and timing of all engines getting change done. |
About the use counter, it should start to appear in the following link once the initial data gets gathered: https://www.chromestatus.com/metrics/feature/timeline/popularity/2248 |
Okay, the number looks like it's below our informal threshold, but is rising steadily - at this rate, it'll cross the .03% in two or three months. This is probably just rising with Grid usage in general. |
Note that Grid Layout usage is still quite low ~0.50%: https://www.chromestatus.com/metrics/feature/timeline/popularity/1693 |
…ack sizes for auto-sized grid containers. r=dholbert Per CSSWG resolution in: w3c/csswg-drafts#1921 (comment)
…ack sizes for auto-sized grid containers. r=dholbert Per CSSWG resolution in: w3c/csswg-drafts#1921 (comment)
I'm slightly in favor of the proposal for two reasons:
I'd like to note though that it's a performance issue since we have to re-run the grid sizing algo (both axes) with the intrinsic size as a definite block size if there is a percentage row track size. (The usage counter above indicates that's likely rare though...) |
Given that we sometimes should do two passes of grid sizing, where the first pass is akin to an "intrinsic sizing pass", I think the spec should say explicitly that both passes are supposed to run the algo under "no constraint". And that the grid container's block-axis size is definite and final after the first pass (so that it works similar to the inline-axis). |
In the past we added a use counter to check the usage of percentage rows on grid containers with indefinite height. The name of the use counter is kGridRowTrackPercentIndefiniteHeight, however it was also counting the cases of percentage columns on grid containers with indefinite width. This patch removes the last case from the use counter, as it was wrong. In addition, the patch adds a new unit test for the use counter to verify that is only triggered for percentage rows. JFTR this use counter is related to issue: w3c/csswg-drafts#1921 Change-Id: I2ab2cc28195e0b5e4f51ea37fff4c838e553cb8a Reviewed-on: https://chromium-review.googlesource.com/1124840 Reviewed-by: Javier Fernandez <jfernandez@igalia.com> Commit-Queue: Manuel Rego Casasnovas <rego@igalia.com> Cr-Commit-Position: refs/heads/master@{#572332}
The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height, but then they'll be resolved against that height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348
The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height, but then they'll be resolved against that height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348
The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height, but then they'll be resolved against that height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348
The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348
The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348
Since Firefox implemented the change for gutters (#509) for Firefox 62 we decided to implement this change for row tracks together with the change for row gutters in Chromium. And we have plans to do it in WebKit too. We analized the sites hitting the use counter, only a few (8 out of 178) were broken due to this change, and the workaround to keep the old behavior was as simple as using It'd be nice if Firefox and Edge implement this too, there are tests in WPT checking this changes. |
JFYI, we have implemented the changes in WebKit too. |
https://bugs.webkit.org/show_bug.cgi?id=188403 Reviewed by Sergio Villar Senin. LayoutTests/imported/w3c: Import tests from WPT related to this issue. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001-expected.txt: Added. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html: Added. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002-expected.txt: Added. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html: Added. * web-platform-tests/css/css-grid/alignment/w3c-import.log: * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001-expected.txt: Added. * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html: Added. * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002-expected.txt: Added. * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html: Added. * web-platform-tests/css/css-grid/grid-definition/w3c-import.log: * web-platform-tests/css/css-grid/grid-layout-properties.html: Update test to reflect the new behavior. Source/WebCore: The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: - w3c/csswg-drafts#1921 - w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. Tests: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::gridTrackSize const): (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes): (WebCore::GridTrackSizingAlgorithm::setup): (WebCore::GridTrackSizingAlgorithm::reset): * rendering/GridTrackSizingAlgorithm.h: * rendering/RenderGrid.cpp: (WebCore::RenderGrid::availableSpaceForGutters const): (WebCore::RenderGrid::repeatTracksSizingIfNeeded): (WebCore::RenderGrid::layoutBlock): LayoutTests: Update tests as needed according to the new behavior. * TestExpectations: Two grid gutters tests from WPT css-align suite are passing now. * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt: * fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt: * fast/css-grid-layout/grid-columns-rows-get-set-multiple.html: * fast/css-grid-layout/grid-columns-rows-get-set.html: * fast/css-grid-layout/grid-gutters-as-percentage-expected.txt: * fast/css-grid-layout/grid-gutters-as-percentage.html: * fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows-expected.txt: * fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html: * fast/css-grid-layout/named-grid-line-get-set-expected.txt: * fast/css-grid-layout/named-grid-line-get-set.html: * fast/css-grid-layout/nested-grid-expected.html: * fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: * fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js: * fast/css-grid-layout/resources/grid-columns-rows-get-set.js: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@234687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1481876 to cover this change for tracks (i.e. percent-sized grid rows) in Firefox. (Not sure about the timeline of when we'll get to it, though.) |
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <rego@igalia.com> Reviewed-by: Sergio Villar <svillar@igalia.com> Cr-Commit-Position: refs/heads/master@{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <rego@igalia.com> Reviewed-by: Sergio Villar <svillar@igalia.com> Cr-Commit-Position: refs/heads/master@{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <rego@igalia.com> Reviewed-by: Sergio Villar <svillar@igalia.com> Cr-Commit-Position: refs/heads/master@{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <rego@igalia.com> Reviewed-by: Sergio Villar <svillar@igalia.com> Cr-Commit-Position: refs/heads/master@{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089
Filed #3418 on the clarifications suggested in #1921 (comment) so I can close out this issue. |
…ack sizes for auto-sized grid containers. r=dholbert Per CSSWG resolution in: w3c/csswg-drafts#1921 (comment) UltraBlame original commit: be1b4c0421705b9752a9550d3e8f8c9d326c3462
…ack sizes for auto-sized grid containers. r=dholbert Per CSSWG resolution in: w3c/csswg-drafts#1921 (comment) UltraBlame original commit: be1b4c0421705b9752a9550d3e8f8c9d326c3462
…ack sizes for auto-sized grid containers. r=dholbert Per CSSWG resolution in: w3c/csswg-drafts#1921 (comment) UltraBlame original commit: be1b4c0421705b9752a9550d3e8f8c9d326c3462
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <regoigalia.com> Reviewed-by: Sergio Villar <svillarigalia.com> Cr-Commit-Position: refs/heads/master{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089 UltraBlame original commit: 04e49a49f1ea217f43dffddd666d01ccc5dcec3d
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <regoigalia.com> Reviewed-by: Sergio Villar <svillarigalia.com> Cr-Commit-Position: refs/heads/master{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089 UltraBlame original commit: b695a1526020329c5dbe56bea9a367db5178a5cb
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <regoigalia.com> Reviewed-by: Sergio Villar <svillarigalia.com> Cr-Commit-Position: refs/heads/master{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089 UltraBlame original commit: 04e49a49f1ea217f43dffddd666d01ccc5dcec3d
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <regoigalia.com> Reviewed-by: Sergio Villar <svillarigalia.com> Cr-Commit-Position: refs/heads/master{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089 UltraBlame original commit: b695a1526020329c5dbe56bea9a367db5178a5cb
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <regoigalia.com> Reviewed-by: Sergio Villar <svillarigalia.com> Cr-Commit-Position: refs/heads/master{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089 UltraBlame original commit: 04e49a49f1ea217f43dffddd666d01ccc5dcec3d
…cks and gaps are resolved, a=testonly Automatic update from web-platform-tests[css-grid] Change how percentage row tracks and gaps are resolved The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: * w3c/csswg-drafts#1921 * w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. We are adding two new tests for this new behavior on top of updating several tests that were using percentages. We also add a test for content alignment and the second pass when the row size changes, the last case fails due to crbug.com/871230. JFTR, intent to implement and ship thread: https://groups.google.com/a/chromium.org/d/msg/blink-dev/CJgcT4hR7Rk/58WfZNbWBQAJ BUG=846187 TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html TEST=css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html TEST=css/css-grid/alignment/grid-content-alignment-second-pass-002.html Change-Id: I2a1959af6c95e0c47d294580599fdbf9bc432348 Reviewed-on: https://chromium-review.googlesource.com/1142409 Commit-Queue: Manuel Rego <regoigalia.com> Reviewed-by: Sergio Villar <svillarigalia.com> Cr-Commit-Position: refs/heads/master{#581185} -- wpt-commits: 244c6baf38953eac29840e2fbcb8a42dd8bafe88 wpt-pr: 12089 UltraBlame original commit: b695a1526020329c5dbe56bea9a367db5178a5cb
https://bugs.webkit.org/show_bug.cgi?id=188403 Reviewed by Sergio Villar Senin. LayoutTests/imported/w3c: Import tests from WPT related to this issue. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001-expected.txt: Added. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html: Added. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002-expected.txt: Added. * web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html: Added. * web-platform-tests/css/css-grid/alignment/w3c-import.log: * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001-expected.txt: Added. * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html: Added. * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002-expected.txt: Added. * web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html: Added. * web-platform-tests/css/css-grid/grid-definition/w3c-import.log: * web-platform-tests/css/css-grid/grid-layout-properties.html: Update test to reflect the new behavior. Source/WebCore: The CSSWG decided to change how percentage row tracks and gutters in a grid container with indefinite height are resolved. The CSSWG issues are: - w3c/csswg-drafts#1921 - w3c/csswg-drafts#509 So far they were resolved as "auto", like it happens with percentage heights in regular blocks. But now they're going to behave similar to what happens in the columns axis, they would be ignored to compute the intrinsic height. This causes that we need to repeat the track sizing algorithm when we have a grid container with indefinite height that has some percentage rows using the intrinsic height calculated on the first pass. Then the percentages will be resolved against the intrinsic height. Tests: imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-001.html imported/w3c/web-platform-tests/css/css-grid/alignment/grid-content-alignment-second-pass-002.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-001.html imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-percentage-rows-indefinite-height-002.html * rendering/GridTrackSizingAlgorithm.cpp: (WebCore::GridTrackSizingAlgorithm::gridTrackSize const): (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes): (WebCore::GridTrackSizingAlgorithm::setup): (WebCore::GridTrackSizingAlgorithm::reset): * rendering/GridTrackSizingAlgorithm.h: * rendering/RenderGrid.cpp: (WebCore::RenderGrid::availableSpaceForGutters const): (WebCore::RenderGrid::repeatTracksSizingIfNeeded): (WebCore::RenderGrid::layoutBlock): LayoutTests: Update tests as needed according to the new behavior. * TestExpectations: Two grid gutters tests from WPT css-align suite are passing now. * fast/css-grid-layout/grid-columns-rows-get-set-expected.txt: * fast/css-grid-layout/grid-columns-rows-get-set-multiple-expected.txt: * fast/css-grid-layout/grid-columns-rows-get-set-multiple.html: * fast/css-grid-layout/grid-columns-rows-get-set.html: * fast/css-grid-layout/grid-gutters-as-percentage-expected.txt: * fast/css-grid-layout/grid-gutters-as-percentage.html: * fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows-expected.txt: * fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html: * fast/css-grid-layout/named-grid-line-get-set-expected.txt: * fast/css-grid-layout/named-grid-line-get-set.html: * fast/css-grid-layout/nested-grid-expected.html: * fast/css-grid-layout/percent-track-breadths-regarding-container-size.html: * fast/css-grid-layout/resources/grid-columns-rows-get-set-multiple.js: * fast/css-grid-layout/resources/grid-columns-rows-get-set.js: Canonical link: https://commits.webkit.org/203510@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
This is an issue extracted from #509 (so we can leave #509 only for percentage gaps/gutters).
The behavior of percentage rows has been modified back in September to reflect a resolution from Seatle F2F meeting on January.
The new text of the spec says:
All the implementations have shipped the previous behavior (percentage rows are treated as
auto
and never resolved) and are interoperable regarding this. In addition, AFAIK nobody has updated them to follow the new behavior described in the spec.At the same time we believe that implementing the new behavior might not be that easy, mainly because of the height is usually an output of the width, and you cannot do the same operations in both axis.
I've wrote a codepen trying to explain one of the issues which is the fact that we might need an extra pass of the track sizing algorithm to properly follow this resolution.
The problem is a combination of spanning items with percentage tracks.
Columns


grid-template-columns: auto 10% auto
We don't find issues here, during the intrinsic width computation the percentage is treated as
auto
. In the example the columns have84px 324px 84px
, so the intrinsic width is492px
.Then during the layout phase we resolve the percentage column against the intrinsic width, 10% of
492px
which would be49px
, and the 1st and 3rd column are stillauto
so they grow as needed to fit the spanning item (final sizes are221.5px 49px 221.5px
).Rows



grid-template-rows: auto 10% auto
This is the tricky part as there isn't a phase to compute the intrinsic height.
So during layout we initially treat the percentage row as
auto
. In the example the rows are20px 100px 20px
.Then if we decide to use that as intrinsic height (
140px
) the 2nd row should be resolved as 10% of140px
which is14px
. At this point we'll have the following rows20px 14px 20px
, if we don't do an extra pass we'll have overflow withauto
rows which doesn't make sense.To get a good result we'd need to do an extra pass of the track sizing algorithm considering a fixed size for the percentage row, something like
grid-template-rows: auto 14px auto
. In that case theauto
tracks will grow as needed to accommodate the sapping item (the final sizes are63px 14px 63px
).The purposes of this issue are 2:
Thanks for your time and sorry for the neverending story. 😇
The text was updated successfully, but these errors were encountered: