Bug 178973 - [css-grid] Display issues with grid item using 'auto' margins
Summary: [css-grid] Display issues with grid item using 'auto' margins
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: Safari 11
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Javier Fernandez
URL:
Keywords: InRadar
: 179985 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-10-27 20:25 PDT by Matt James
Modified: 2017-11-27 01:30 PST (History)
9 users (show)

See Also:


Attachments
Safari 11 Grid Bug (1.26 MB, video/mp4)
2017-11-01 05:42 PDT, Matt James
no flags Details
Safari layout (49.55 KB, image/png)
2017-11-01 05:43 PDT, Matt James
no flags Details
Exepected layout (45.71 KB, image/png)
2017-11-01 05:43 PDT, Matt James
no flags Details
Reduced test case (784 bytes, text/html)
2017-11-02 05:50 PDT, Manuel Rego Casasnovas
no flags Details
Patch (7.44 KB, patch)
2017-11-24 17:36 PST, Javier Fernandez
no flags Details | Formatted Diff | Diff
Patch (7.44 KB, patch)
2017-11-24 17:54 PST, Javier Fernandez
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews103 for mac-elcapitan (2.17 MB, application/zip)
2017-11-24 18:34 PST, EWS Watchlist
no flags Details
Patch (7.48 KB, patch)
2017-11-24 18:34 PST, 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 Matt James 2017-10-27 20:25:04 PDT
Child element in Grid container has 'max-width' property set in an min-width media query. Once Safari 11 update was implemented, the overall grid layout for the container broke upon initital view. Toggling 'max-width' off and back on in developer tools fixes the issue, but is unrealistic for the majority of users.  Toggle 'max-width' off and on on the link in the attached pen: https://codepen.io/mattfrankjames/pen/e85f82981725d1f65604b0fb23069479
Comment 1 Manuel Rego Casasnovas 2017-10-31 08:56:37 PDT
Hi Matt, thanks for reporting the issue.

Could yo provide a reduced test case?
Or send us screenshots/screencast of the expected behavior in your example?

Also does it work fine in other browsers like Chrome or Firefox?
Comment 2 Matt James 2017-11-01 05:42:13 PDT
Created attachment 325562 [details]
Safari 11 Grid Bug

Demonstrates layout bug that resolves when toggling max-width property off and back on in developer tools.
Comment 3 Matt James 2017-11-01 05:43:13 PDT
Created attachment 325563 [details]
Safari layout
Comment 4 Matt James 2017-11-01 05:43:30 PDT
Created attachment 325564 [details]
Exepected layout
Comment 5 Manuel Rego Casasnovas 2017-11-02 05:50:16 PDT
Created attachment 325713 [details]
Reduced test case

Thanks for the information, now I've managed to understand the problem and reproduce it.
As a workaround you can center the element with "justify-self: center;" instead of the auto margins.

The issue is reproducible without max-width, I'm attaching a reduced test case.
If you remove the "margin-top" in my example it works as expected (also if you don't center the item with "auto" margins).
We need to investigate what's going on to get such a weird results.
Comment 6 Javier Fernandez 2017-11-24 17:36:31 PST
Created attachment 327563 [details]
Patch
Comment 7 Javier Fernandez 2017-11-24 17:37:13 PST
*** Bug 179985 has been marked as a duplicate of this bug. ***
Comment 8 Javier Fernandez 2017-11-24 17:54:32 PST
Created attachment 327564 [details]
Patch
Comment 9 EWS Watchlist 2017-11-24 18:34:27 PST
Comment on attachment 327564 [details]
Patch

Attachment 327564 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/5353561

New failing tests:
imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-rl-006.html
imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-006.html
imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-rl-014.html
imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-lr-014.html
imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-014.html
imported/w3c/web-platform-tests/css/css-grid-1/alignment/grid-self-alignment-stretch-vertical-lr-006.html
Comment 10 EWS Watchlist 2017-11-24 18:34:28 PST
Created attachment 327566 [details]
Archive of layout-test-results from ews103 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews103  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 11 Javier Fernandez 2017-11-24 18:34:55 PST
Created attachment 327567 [details]
Patch

Fixed tests failures.
Comment 12 WebKit Commit Bot 2017-11-27 01:29:11 PST
Comment on attachment 327567 [details]
Patch

Clearing flags on attachment: 327567

Committed r225163: <https://trac.webkit.org/changeset/225163>
Comment 13 WebKit Commit Bot 2017-11-27 01:29:13 PST
All reviewed patches have been landed.  Closing bug.
Comment 14 Radar WebKit Bug Importer 2017-11-27 01:30:40 PST
<rdar://problem/35694463>