Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Issue 815833005: [css-grid] Handle min-content/max-content with orthogonal flows (Closed)

Created:
5 years, 11 months ago by jfernandez
Modified:
4 years, 6 months ago
CC:
blink-reviews, blink-reviews-rendering, Dominik Röttsches, eae+blinkwatch, jchaffraix+rendering, leviw+renderwatch, pdr+renderingwatchlist_chromium.org, Manuel Rego, svillar, zoltan1
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[css-grid] Handle min-content/max-content with orthogonal flows Currently there is no support for orthogonal flows in many aspects of the Grid Layout logic. The Grid sizing algorithm should be adapted to this scenario, hence this patch focus on the min-content and max-content functions, used to resolve content based track sizes. BUG=234194 Committed: https://crrev.com/fe619f7270786d15f9b2de8962835d47b1e7823b Cr-Commit-Position: refs/heads/master@{#401246}

Patch Set 1 #

Patch Set 2 : Solving positioning issues. #

Total comments: 4

Patch Set 3 : New approach: extra sizing algorithm iteration. #

Total comments: 6

Patch Set 4 : Utility functions for orthogonality. #

Total comments: 8

Patch Set 5 : Using physical position for determining overflow. #

Patch Set 6 : Patch rebased. #

Total comments: 11

Patch Set 7 : New approach (Step1) - Make sizing alg being orthogonality aware. #

Patch Set 8 : New approach (Step2) - Add orthogonal flow support in the sizing algorithm. #

Patch Set 9 : New approach (Step3) - Assumed row track's breadth for intrinsic size computation. #

Total comments: 19

Patch Set 10 : Patch rebased. Added an extra cycle for rows sizing. #

Patch Set 11 : Patch rebased. #

Patch Set 12 : Patch rebased and applied the suggested changes. #

Total comments: 19

Patch Set 13 : Patch rebased and applied the suggested changes. #

Total comments: 34

Patch Set 14 : Applied suggested changes. #

Total comments: 15

Patch Set 15 : Added TODO for a correct definition of indefinite size with orthogonal flows. #

Patch Set 16 : Rebaseline some tests with percentage cases. #

Patch Set 17 : Removed debug guards. #

Patch Set 18 : Avoid layouts during intrinsic size computation. #

Patch Set 19 : Avoid layout only when not in the middle of grid layout. #

Patch Set 20 : More layouts to avoid while computing intrinsic size. #

Patch Set 21 : Avoid layouts, at all, during intrinsic width computation. #

Patch Set 22 : Don't update container's width after track sizing. #

Total comments: 2

Patch Set 23 : Comments and assertions to make the code clearer. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+602 lines, -17 lines) Patch
A third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-positioning-with-orthogonal-flows.html View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +65 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-sizing-with-orthogonal-flows.html View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +51 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-item-spanning-and-orthogonal-flows.html View 1 2 3 4 5 6 7 8 9 10 11 12 21 1 chunk +91 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-orthogonal-flows.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +196 lines, -0 lines 0 comments Download
A third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +67 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBlock.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBlock.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutGrid.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutGrid.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 16 chunks +125 lines, -15 lines 0 comments Download

Messages

Total messages: 68 (19 generated)
jfernandez
5 years, 11 months ago (2015-01-09 16:37:25 UTC) #2
svillar
https://codereview.chromium.org/815833005/diff/20001/Source/core/rendering/RenderGrid.cpp File Source/core/rendering/RenderGrid.cpp (right): https://codereview.chromium.org/815833005/diff/20001/Source/core/rendering/RenderGrid.cpp#newcode654 Source/core/rendering/RenderGrid.cpp:654: direction = direction == ForColumns ? ForRows : ForColumns; ...
5 years, 11 months ago (2015-01-12 08:27:51 UTC) #3
Julien - ping for review
https://codereview.chromium.org/815833005/diff/20001/Source/core/rendering/RenderGrid.cpp File Source/core/rendering/RenderGrid.cpp (right): https://codereview.chromium.org/815833005/diff/20001/Source/core/rendering/RenderGrid.cpp#newcode1131 Source/core/rendering/RenderGrid.cpp:1131: bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHorizontalWritingMode(); Why do we ...
5 years, 11 months ago (2015-01-21 09:32:10 UTC) #4
jfernandez
New patch follows a new approach based on what the specs state for handling orthogonal ...
5 years, 11 months ago (2015-01-26 14:25:34 UTC) #6
Julien - ping for review
https://codereview.chromium.org/815833005/diff/60001/Source/core/rendering/RenderGrid.cpp File Source/core/rendering/RenderGrid.cpp (right): https://codereview.chromium.org/815833005/diff/60001/Source/core/rendering/RenderGrid.cpp#newcode624 Source/core/rendering/RenderGrid.cpp:624: } I don't think we should fork this function ...
5 years, 10 months ago (2015-01-29 13:43:48 UTC) #7
jfernandez
New patch added with the suggested changes. https://codereview.chromium.org/815833005/diff/60001/Source/core/rendering/RenderGrid.cpp File Source/core/rendering/RenderGrid.cpp (right): https://codereview.chromium.org/815833005/diff/60001/Source/core/rendering/RenderGrid.cpp#newcode624 Source/core/rendering/RenderGrid.cpp:624: } On ...
5 years, 10 months ago (2015-02-06 22:59:58 UTC) #8
Julien - ping for review
More comments but it's looking much better. https://codereview.chromium.org/815833005/diff/80001/Source/core/rendering/RenderGrid.cpp File Source/core/rendering/RenderGrid.cpp (right): https://codereview.chromium.org/815833005/diff/80001/Source/core/rendering/RenderGrid.cpp#newcode634 Source/core/rendering/RenderGrid.cpp:634: child.setOverrideContainingBlockContentLogicalHeight(-1); We ...
5 years, 10 months ago (2015-02-18 23:00:07 UTC) #9
jfernandez
Added a new patch with some of the suggested change. However, I've got questions regarding ...
5 years, 10 months ago (2015-02-23 18:51:59 UTC) #10
leviw_travelin_and_unemployed
5 years, 1 month ago (2015-10-28 22:19:02 UTC) #12
esprehn
I think this looks right, this patch is so huge it's a little hard for ...
5 years, 1 month ago (2015-10-30 23:21:31 UTC) #13
cbiesinger
looks good to me modulo Elliott's comments https://codereview.chromium.org/815833005/diff/120001/third_party/WebKit/LayoutTests/fast/css-grid-layout/resources/grid.css File third_party/WebKit/LayoutTests/fast/css-grid-layout/resources/grid.css (right): https://codereview.chromium.org/815833005/diff/120001/third_party/WebKit/LayoutTests/fast/css-grid-layout/resources/grid.css#newcode283 third_party/WebKit/LayoutTests/fast/css-grid-layout/resources/grid.css:283: -webkit-writing-mode: horizontal-tb; ...
5 years, 1 month ago (2015-11-13 03:25:48 UTC) #14
jfernandez
Added Patch Set 7 - 9 with a completely new approach. Functionality it's basically the ...
5 years ago (2015-11-25 19:29:59 UTC) #16
cbiesinger
Looks good except for the questions below. https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode498 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:498: tracks.grow(gridRowCount()); why ...
5 years ago (2015-11-26 02:26:17 UTC) #17
jfernandez
https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode498 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:498: tracks.grow(gridRowCount()); On 2015/11/26 02:26:16, cbiesinger wrote: > why is ...
5 years ago (2015-11-26 08:58:27 UTC) #18
cbiesinger
lgtm
5 years ago (2015-12-01 00:20:40 UTC) #19
svillar
Reviewed the code part. Let's leave the tests for a follow up revision. https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File ...
5 years ago (2015-12-01 12:43:14 UTC) #20
jfernandez
Thanks for the review. See my replies and comments inline. https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/180001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode402 ...
5 years ago (2015-12-01 15:13:39 UTC) #21
jfernandez
On 2015/12/01 15:13:39, jfernandez wrote: > Thanks for the review. See my replies and comments ...
4 years, 9 months ago (2016-02-29 23:21:34 UTC) #22
svillar
Looking pretty good although we need to change some stuff. BTW the patch is IMO ...
4 years, 9 months ago (2016-03-23 11:02:01 UTC) #23
jfernandez
Ill proceed with the patch simplification, but see my replies to the particular issues below. ...
4 years, 8 months ago (2016-04-01 16:39:56 UTC) #24
svillar
https://codereview.chromium.org/815833005/diff/240001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/240001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode235 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:235: , rowTracks(0) On 2016/04/01 16:39:56, jfernandez wrote: > On ...
4 years, 8 months ago (2016-04-04 07:58:28 UTC) #25
jfernandez
4 years, 8 months ago (2016-04-13 14:14:10 UTC) #26
svillar
We still need some more work, but we're indeed almost there. https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutBlock.cpp File third_party/WebKit/Source/core/layout/LayoutBlock.cpp (right): ...
4 years, 8 months ago (2016-04-14 08:58:42 UTC) #27
jfernandez
Wow, thanks @svillar for such an awesome review. You have spotted several issues, which will ...
4 years, 8 months ago (2016-04-14 14:10:26 UTC) #28
cbiesinger
https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutBlock.cpp File third_party/WebKit/Source/core/layout/LayoutBlock.cpp (right): https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutBlock.cpp#newcode1128 third_party/WebKit/Source/core/layout/LayoutBlock.cpp:1128: LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild(const LayoutBox& child) const On 2016/04/14 08:58:41, svillar ...
4 years, 8 months ago (2016-04-14 16:31:18 UTC) #29
svillar
https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutBlock.cpp File third_party/WebKit/Source/core/layout/LayoutBlock.cpp (right): https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutBlock.cpp#newcode1128 third_party/WebKit/Source/core/layout/LayoutBlock.cpp:1128: LayoutUnit LayoutBlock::marginIntrinsicLogicalWidthForChild(const LayoutBox& child) const On 2016/04/14 16:31:18, cbiesinger ...
4 years, 8 months ago (2016-04-15 12:51:01 UTC) #30
jfernandez
I'm preparing a patch with most of the changes you have suggested, but before submitting ...
4 years, 7 months ago (2016-05-18 10:31:41 UTC) #31
svillar
Thanks for your patience. Hope my comments are useful. https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1704 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1704: ...
4 years, 7 months ago (2016-05-26 08:49:03 UTC) #33
jfernandez
https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/260001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1704 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1704: return length.isContentSized() || length.isFlex() || !hasDefiniteLogicalSize(direction); On 2016/05/26 08:49:02, ...
4 years, 6 months ago (2016-05-27 09:41:22 UTC) #34
svillar
We're almost there. I like how the patch has evolved. https://codereview.chromium.org/815833005/diff/280001/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html File third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html (right): https://codereview.chromium.org/815833005/diff/280001/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-track-sizing-with-percentages-and-orthogonal-flows.html#newcode23 ...
4 years, 6 months ago (2016-06-02 14:39:40 UTC) #35
jfernandez
I'll provide a new patch with some small changes suggested in the last review. However, ...
4 years, 6 months ago (2016-06-02 21:39:25 UTC) #36
svillar
lgtm https://codereview.chromium.org/815833005/diff/280001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/280001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1836 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1836: if (maxTrackSize.isContentSized() || maxTrackSize.isFlex()) On 2016/06/02 21:39:25, jfernandez ...
4 years, 6 months ago (2016-06-10 08:08:35 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/815833005/320001
4 years, 6 months ago (2016-06-13 10:20:56 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: chromeos_amd64-generic_chromium_compile_only_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromeos_amd64-generic_chromium_compile_only_ng/builds/151913)
4 years, 6 months ago (2016-06-13 10:36:29 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/815833005/340001
4 years, 6 months ago (2016-06-13 16:03:55 UTC) #45
commit-bot: I haz the power
Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/243410)
4 years, 6 months ago (2016-06-13 18:00:03 UTC) #47
jfernandez
On 2016/06/13 18:00:03, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 6 months ago (2016-06-14 10:17:33 UTC) #48
cbiesinger
On 2016/06/14 10:17:33, jfernandez wrote: > On 2016/06/13 18:00:03, commit-bot: I haz the power wrote: ...
4 years, 6 months ago (2016-06-14 10:46:23 UTC) #49
jfernandez
On 2016/06/14 10:46:23, cbiesinger wrote: > On 2016/06/14 10:17:33, jfernandez wrote: > > On 2016/06/13 ...
4 years, 6 months ago (2016-06-14 11:05:04 UTC) #50
cbiesinger
> So, if I understand correctly, we should avoid this layout during intrinsic size > ...
4 years, 6 months ago (2016-06-14 11:25:44 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/815833005/440001
4 years, 6 months ago (2016-06-21 13:03:09 UTC) #54
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/242423)
4 years, 6 months ago (2016-06-21 14:31:46 UTC) #56
cbiesinger
https://codereview.chromium.org/815833005/diff/440001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/440001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode934 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:934: return child.logicalHeight() + child.marginLogicalHeight(); I may be misreading this ...
4 years, 6 months ago (2016-06-21 14:45:46 UTC) #57
jfernandez
https://codereview.chromium.org/815833005/diff/280001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp File third_party/WebKit/Source/core/layout/LayoutGrid.cpp (right): https://codereview.chromium.org/815833005/diff/280001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode1853 third_party/WebKit/Source/core/layout/LayoutGrid.cpp:1853: return assumedRowsSizeForOrthogonalChild(child); On 2016/06/10 08:08:35, svillar wrote: > On ...
4 years, 6 months ago (2016-06-21 21:50:03 UTC) #58
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/815833005/460001
4 years, 6 months ago (2016-06-22 09:04:54 UTC) #62
commit-bot: I haz the power
Committed patchset #23 (id:460001)
4 years, 6 months ago (2016-06-22 10:26:55 UTC) #64
commit-bot: I haz the power
Patchset 23 (id:??) landed as https://crrev.com/fe619f7270786d15f9b2de8962835d47b1e7823b Cr-Commit-Position: refs/heads/master@{#401246}
4 years, 6 months ago (2016-06-22 10:28:16 UTC) #66
cbiesinger
On 2016/06/21 21:50:03, jfernandez wrote: > https://codereview.chromium.org/815833005/diff/440001/third_party/WebKit/Source/core/layout/LayoutGrid.cpp#newcode934 > third_party/WebKit/Source/core/layout/LayoutGrid.cpp:934: return > child.logicalHeight() + child.marginLogicalHeight(); > ...
4 years, 6 months ago (2016-06-22 18:33:01 UTC) #67
jfernandez
4 years, 6 months ago (2016-06-22 18:42:17 UTC) #68
Message was sent while issue was closed.
On 2016/06/22 18:33:01, cbiesinger wrote:
> On 2016/06/21 21:50:03, jfernandez wrote:
> >
>
https://codereview.chromium.org/815833005/diff/440001/third_party/WebKit/Sour...
> > third_party/WebKit/Source/core/layout/LayoutGrid.cpp:934: return
> > child.logicalHeight() + child.marginLogicalHeight();
> > On 2016/06/21 14:45:46, cbiesinger wrote:
> > > I may be misreading this code, but I think this will return outdated
layout
> > > information of the child. That's not good -- it means that what this
> function
> > > returns depends on which previous layouts may have happened, which means
> that
> > > the end size depends on the previous state as well. I think you may want
> this
> > > function:
> > >
> >
>
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/layout/La...
> > 
> > This is a good point, but I'm not sure it's what we need here. First, since
we
> > have already laid out all the orthogonal grid items (FrameView) I think that
> > during the intrinsic size computation those boxed don't need to be laid out
> > again, hence we can use the previously computed logicalHeight. 
> > 
> > In case we are not computing the intrinsic width, we will perform a layout
on
> > any grid item if its container (the grid area) size has changed; obviously
if
> it
> > needs a layout too. Hence, I think that using the computed logicalHeight is
> > correct for this case.
> > 
> > Additionally, if I understand it correctly,
computeLogicalHeightWithoutLayout
> > returns just the border and padding size if box's height is not explicitly
> set.
> > We will have incorrect results for intrinsic and auto sized grid items. 
> > 
> > If nobody objects, I'll land the patch as it is and will revisit this issue
> when
> > we find out some case incorrectly rendered because of this logica.
> 
> Fair point. I might still switch to using computeChildPreferredLogicalWidths
for
> this case (it uses logicalHeight if no layout is pending and
> computeLogicalHeightWithoutLayout otherwise) just to be on the safe side, if
> used while we're inside of computePreferredLogicalWidths

Yes, I think we definitively want to use computeChildPreferredLogicalWidths 
somehow. The issue is that I didn't figure out how to do it without changing 
too much of our laoyut logic for doing so. I'll discuss it with @svillar as 
soon as possible.

Powered by Google App Engine
This is Rietveld 408576698