Bug 145604 - [CSS Grid Layout] Setting height on a grid item doesn't have any effect
Summary: [CSS Grid Layout] Setting height on a grid item doesn't have any effect
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Javier Fernandez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-03 07:37 PDT by Javier Fernandez
Modified: 2015-06-08 13:26 PDT (History)
9 users (show)

See Also:


Attachments
Example to reproduce the issue. (783 bytes, text/html)
2015-06-03 07:37 PDT, Javier Fernandez
no flags Details
Example to reproduce the issue. (871 bytes, text/html)
2015-06-03 09:40 PDT, Javier Fernandez
no flags Details
Patch (8.08 KB, patch)
2015-06-08 03:19 PDT, Javier Fernandez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Javier Fernandez 2015-06-03 07:37:34 PDT
Created attachment 254173 [details]
Example to reproduce the issue.

If you render a grid and then you modify the height of a grid item (which previously had "height: auto;" and was stretched), the item is not resized as expected.
If align-items is "start" you cannot reproduce the issue.

Attached example to reproduce the issue, when you click on the button the "A" item should be resized to 100x100. Only width is resized.
Comment 1 Javier Fernandez 2015-06-03 09:40:50 PDT
Created attachment 254181 [details]
Example to reproduce the issue.
Comment 2 Javier Fernandez 2015-06-08 03:19:48 PDT
Created attachment 254483 [details]
Patch
Comment 3 Sergio Villar Senin 2015-06-08 08:16:06 PDT
Comment on attachment 254483 [details]
Patch

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

Nice catch!

> Source/WebCore/rendering/RenderGrid.cpp:1300
> +        child.clearOverrideLogicalContentHeight();

Don't we need to mark the child as needs layout in these cases?
Comment 4 Javier Fernandez 2015-06-08 12:35:07 PDT
(In reply to comment #3)
> Comment on attachment 254483 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=254483&action=review
> 
> Nice catch!
> 
> > Source/WebCore/rendering/RenderGrid.cpp:1300
> > +        child.clearOverrideLogicalContentHeight();
> 
> Don't we need to mark the child as needs layout in these cases?

No, we don't. The overrideHeight is something we use to indicate, during layout, that instead of computing block's logical height a specific value must be used instead. Since grid layout uses this to set the stretched height, we need to clear it whenever stretching becomes not allowed. Whether block's logical height or not depends on many factors, what changed (width, margin, parent's height, ...) and that is not grid's layout responsibility; a block layout is forced only when its height is changed because of the stretching operation itself.
Comment 5 WebKit Commit Bot 2015-06-08 13:26:33 PDT
Comment on attachment 254483 [details]
Patch

Clearing flags on attachment: 254483

Committed r185327: <http://trac.webkit.org/changeset/185327>
Comment 6 WebKit Commit Bot 2015-06-08 13:26:37 PDT
All reviewed patches have been landed.  Closing bug.