Bug 165796 - text-align: justify and word-spacing combine to overflow column
Summary: text-align: justify and word-spacing combine to overflow column
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
: 165873 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-13 06:02 PST by Brad West
Modified: 2017-09-27 02:35 PDT (History)
8 users (show)

See Also:


Attachments
HTML with inline CSS demonstrating problem (4.10 KB, text/html)
2016-12-13 06:02 PST, Brad West
no flags Details
Text overflows bounds of p when justify and word-spacing both used (144.48 KB, image/png)
2016-12-13 06:04 PST, Brad West
no flags Details
Text behaves as expected when only justify is used (111.88 KB, image/png)
2016-12-13 06:05 PST, Brad West
no flags Details
Text also behaves if only word-spacing is used (130.21 KB, image/png)
2016-12-13 06:05 PST, Brad West
no flags Details
Workaround with padding-right, successful except for "post-ironic" line (139.70 KB, image/png)
2016-12-13 06:07 PST, Brad West
no flags Details
Patch (90.29 KB, patch)
2016-12-14 21:56 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (90.36 KB, patch)
2016-12-14 22:05 PST, zalan
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews125 for ios-simulator-wk2 (18.11 MB, application/zip)
2016-12-15 01:08 PST, Build Bot
no flags Details
Patch (93.37 KB, patch)
2016-12-15 08:13 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (93.34 KB, patch)
2016-12-15 19:55 PST, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brad West 2016-12-13 06:02:04 PST
Created attachment 297005 [details]
HTML with inline CSS demonstrating problem

When text-align: justify is used in combination with word-spacing, the text will almost always overflows a column (horizontally). In attached HTML, an exaggerated value of 20px is used for word-spacing, but the problem also occurs with smaller, more reasonable values. 

Of note is the fifth line (ending in "post-ironic.") that, for whatever reason, does not overflow.

Curiously, the amount that it overflows seems to be the exact value used for word-spacing. Hopefully that suggests something about the nature of the bug. 

It also means that for most lines, one could work around the issue by specifying a padding-right value with the same value as word-spacing. Unfortunately, though, the lines that work above ("post-ironic") become too far inset.
Comment 1 Brad West 2016-12-13 06:04:32 PST
Created attachment 297006 [details]
Text overflows bounds of p when justify and word-spacing both used
Comment 2 Brad West 2016-12-13 06:05:11 PST
Created attachment 297007 [details]
Text behaves as expected when only justify is used
Comment 3 Brad West 2016-12-13 06:05:42 PST
Created attachment 297008 [details]
Text also behaves if only word-spacing is used
Comment 4 Brad West 2016-12-13 06:07:41 PST
Created attachment 297009 [details]
Workaround with padding-right, successful except for "post-ironic" line
Comment 5 zalan 2016-12-14 16:16:43 PST
*** Bug 165873 has been marked as a duplicate of this bug. ***
Comment 6 zalan 2016-12-14 16:28:10 PST
rdar://problem/29672168
Comment 7 zalan 2016-12-14 21:56:23 PST
Created attachment 297165 [details]
Patch
Comment 8 zalan 2016-12-14 22:05:00 PST
Created attachment 297166 [details]
Patch
Comment 9 Build Bot 2016-12-15 01:08:25 PST
Comment on attachment 297166 [details]
Patch

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

New failing tests:
fast/text/whitespace/span-in-word-space-causes-overflow.html
css1/text_properties/word_spacing.html
Comment 10 Build Bot 2016-12-15 01:08:29 PST
Created attachment 297184 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

The attached test failures were seen while running run-webkit-tests on the ios-sim-ews.
Bot: ews125  Port: ios-simulator-wk2  Platform: Mac OS X 10.11.6
Comment 11 zalan 2016-12-15 08:13:54 PST
Created attachment 297192 [details]
Patch
Comment 12 zalan 2016-12-15 08:14:23 PST
Comment on attachment 297184 [details]
Archive of layout-test-results from ews125 for ios-simulator-wk2

Some iOS rebaseline.
Comment 13 Myles C. Maxfield 2016-12-15 18:19:59 PST
Comment on attachment 297192 [details]
Patch

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

> LayoutTests/fast/css/word-spacing-with-normal-layout.html:18
> +if (window.internals)
> +	internals.settings.setSimpleLineLayoutDebugBordersEnabled(false);

Why is this here?
Comment 14 zalan 2016-12-15 19:54:30 PST
(In reply to comment #13)
> Comment on attachment 297192 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=297192&action=review
> 
> > LayoutTests/fast/css/word-spacing-with-normal-layout.html:18
> > +if (window.internals)
> > +	internals.settings.setSimpleLineLayoutDebugBordersEnabled(false);
> 
> Why is this here?
lol, good catch. It was meant to read setSimpleLineLayoutEnabled.
Comment 15 zalan 2016-12-15 19:55:36 PST
Created attachment 297291 [details]
Patch
Comment 16 WebKit Commit Bot 2016-12-15 22:33:13 PST
Comment on attachment 297291 [details]
Patch

Clearing flags on attachment: 297291

Committed r209910: <http://trac.webkit.org/changeset/209910>
Comment 17 WebKit Commit Bot 2016-12-15 22:33:18 PST
All reviewed patches have been landed.  Closing bug.