Bug 84448 - combining text-align: justify with white-space: pre-wrap does not justify the text
Summary: combining text-align: justify with white-space: pre-wrap does not justify the...
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2012-04-20 06:53 PDT by Jelte Liebrand
Modified: 2022-10-02 12:47 PDT (History)
14 users (show)

See Also:


Attachments
Test html file (3.98 KB, text/html)
2012-04-20 06:53 PDT, Jelte Liebrand
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jelte Liebrand 2012-04-20 06:53:32 PDT
Created attachment 138086 [details]
Test html file

At the moment, webkit does not justify text if the text also has white-space: pre-wrap set.  I've attached a small sample test html page to show this problem. 

According to the CSS3 specification however, the UA could choose to indeed justify the text in these cases, as long as tab stop positions are adhered to.  Here's the relevant text from the spec:

In the case of ‘justify’, the UA may stretch or shrink any inline
boxes by adjusting their text in addition to shifting their positions.
(See also ‘text-justify’, ‘letter-spacing’, and ‘word-spacing’.) If an
element's white space is set to be non-collapsible, then the UA is not
required to adjust its text for the purpose of justification and may
instead treat the text as having no expansion opportunities. If the UA
chooses to adjust the text, then it must ensure that tab stops
continue to line up as required by the white space processing rules.


It would be very useful to add this ability, so that we can represent more word processing like features where end users tend to use multiple white spaces to layout their text, whilst also being able to justify align their paragraphs.
Comment 1 Tab Atkins 2012-04-20 08:18:45 PDT
In particular, the layout strategy we'd like here (matching Word and other similar apps) is to justify the section of the line after the last tab stop on the line.
Comment 2 Bence Meszaros 2021-04-05 10:35:54 PDT
Hi Everyone,

I stumbled upon this "bug" too and I could not find a viable workaround. Either I need to forget about justifying text or let the browser strip away necessary white space characters, both of which are unacceptable for a decent web based text editor.

Is there a chance that this might be implemented in the near future?

Thank you!
Comment 3 shaulgo 2021-05-23 12:36:06 PDT
Hey, what's the chance of prioritizing this? 
It make for a very bad cross browser experience. And makes very hard to develop text editor with justification capabilities.

Thanks
Comment 4 Radar WebKit Bug Importer 2021-05-24 09:52:55 PDT
<rdar://problem/78405178>
Comment 5 zalan 2022-10-02 12:47:01 PDT
The attached test case works fine. It's an IFC progression.