Bug 178073

Summary: Don't use intrinsic width if our container's width is zero
Product: WebKit Reporter: Tim Horton <thorton>
Component: Layout and RenderingAssignee: Manuel Rego Casasnovas <rego>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, buildbot, commit-queue, darin, hyatt, jfernandez, rego, rniwa, simon.fraser, svillar, webkit-bug-importer, zalan
Priority: P2 Keywords: BlinkMergeCandidate, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.chromium.org/p/chromium/issues/detail?id=235189
Bug Depends on:    
Bug Blocks: 178337    
Attachments:
Description Flags
testcase
none
screenshot of safari (bad case)
none
Another example to reproduce the issue
none
Simplified test case
none
Patch
none
Archive of layout-test-results from ews107 for mac-elcapitan-wk2
none
Archive of layout-test-results from ews115 for mac-elcapitan
none
Archive of layout-test-results from ews121 for ios-simulator-wk2
none
Patch
none
Archive of layout-test-results from ews115 for mac-elcapitan
none
Patch for landing none

Description Tim Horton 2017-10-09 01:13:36 PDT
Steps to Reproduce:

1. Using the attached test case, resize your browser window to the minimum width.

Expected:

The SVG line should not be visible.

Actual:

The SVG line discontinuously jumps to overlap the text in the next grid column when the width reaches 0.

Notes:

Chrome and Firefox both behave more sensibly (though they do not agree about the correct behavior).
Comment 1 Tim Horton 2017-10-09 01:13:48 PDT
Created attachment 323160 [details]
testcase
Comment 2 Tim Horton 2017-10-09 01:14:23 PDT
Created attachment 323161 [details]
screenshot of safari (bad case)
Comment 3 Manuel Rego Casasnovas 2017-10-09 06:58:32 PDT
Created attachment 323172 [details]
Another example to reproduce the issue


The problem is easily reproducible with an image too.
Check the new attached example, the size of the image depends on the "1fr" column. When it's very close to 0, the image is size 100% of the column breadth, but when it goes to 0 then the image uses the intrisic size for width (100px in the example).
In Chromium and Firefox the image just disppears when the column size is 0px.
We need to investigate what's going on with that image, and why it's not using the 0px breadth of the column to resolve its 100% width.

The differences between Firefox and Chromium in the first example might be related to the intrinsic size of the SVG or something like that.
Comment 4 Manuel Rego Casasnovas 2017-10-09 07:03:20 PDT
Created attachment 323173 [details]
Simplified test case

This last example is even more simple, just a grid with a column of 0px.
Then the image has a 100% width and is inside a grid item on the first column.
The width of the image should be 0px but it's 100px.
Comment 5 Manuel Rego Casasnovas 2017-10-13 04:52:36 PDT
Ok so the issue is not related to Grid Layout but is a generic issue for replaced elements.

It has been fixed a while ago in Blink: https://codereview.chromium.org/253743008/
But it seems the patch was never imported into WebKit.

The patch is quite small so I guess we can easily import it.
Comment 6 Manuel Rego Casasnovas 2017-10-13 06:02:02 PDT
Created attachment 323664 [details]
Patch
Comment 7 Manuel Rego Casasnovas 2017-10-13 06:03:16 PDT
The patch is missing the Mac baselines for width100percent-image.html but I'll get them from the EWS.
Comment 8 Build Bot 2017-10-13 06:59:16 PDT
Comment on attachment 323664 [details]
Patch

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

New failing tests:
fast/replaced/width100percent-image.html
Comment 9 Build Bot 2017-10-13 06:59:17 PDT
Created attachment 323665 [details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 10 Build Bot 2017-10-13 07:11:58 PDT
Comment on attachment 323664 [details]
Patch

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

New failing tests:
fast/replaced/width100percent-image.html
Comment 11 Build Bot 2017-10-13 07:12:00 PDT
Created attachment 323666 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 12 Build Bot 2017-10-13 07:35:12 PDT
Comment on attachment 323664 [details]
Patch

Attachment 323664 [details] did not pass ios-sim-ews (ios-simulator-wk2):
Output: http://webkit-queues.webkit.org/results/4844561

New failing tests:
fast/replaced/width100percent-image.html
Comment 13 Build Bot 2017-10-13 07:35:13 PDT
Created attachment 323669 [details]
Archive of layout-test-results from ews121 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews121  Port: ios-simulator-wk2  Platform: Mac OS X 10.12.6
Comment 14 Manuel Rego Casasnovas 2017-10-13 09:21:14 PDT
Created attachment 323680 [details]
Patch
Comment 15 Build Bot 2017-10-13 10:52:12 PDT
Comment on attachment 323680 [details]
Patch

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

New failing tests:
http/tests/loading/basic-credentials-sent-automatically.html
Comment 16 Build Bot 2017-10-13 10:52:14 PDT
Created attachment 323702 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 17 Sergio Villar Senin 2017-10-16 03:38:02 PDT
Comment on attachment 323680 [details]
Patch

Makes sense. Bonus points for interoperability
Comment 18 Manuel Rego Casasnovas 2017-10-16 04:23:38 PDT
Created attachment 323889 [details]
Patch for landing
Comment 19 WebKit Commit Bot 2017-10-16 05:10:54 PDT
Comment on attachment 323889 [details]
Patch for landing

Clearing flags on attachment: 323889

Committed r223389: <https://trac.webkit.org/changeset/223389>
Comment 20 WebKit Commit Bot 2017-10-16 05:10:56 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Radar WebKit Bug Importer 2017-10-16 05:12:58 PDT
<rdar://problem/35005193>