Bug 65381

Summary: WebKit should support a defined word-wrap limit to prevent widows
Product: WebKit Reporter: Theresa O'Connor <eoconnor>
Component: TextAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: mail, mitz, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   

Description Theresa O'Connor 2011-07-29 10:53:27 PDT
Webkit should support a defined word-wrap limit to give content authors control over widowed words. This is especially useful in cases where authors currently rely on forced breaks and creative spans for word spacing.

For example, the following would result in two or more words per line to prevent an widowed word.

p { -webkit-word-wrap-limit: 2; }

<rdar://problem/9861318>
Comment 1 Matt Wilcox 2012-01-06 11:26:20 PST
"widows" in this context are usually referred to as Orphans, there is a discussion going on at www-style with regard to how this should be implemented. Please see: http://lists.w3.org/Archives/Public/www-style/2012Jan/0087.html for the beginning of the conversation. There are additional considerations, for example in typography it is usually the case that the entire paragraph will be re-flowed to avoid poor line lengths. That behaviour should be duplicated in CSS. e.g.,

NO ORPHAN CONTROL:
This is a paragraph of text that I'm going to
use to demonstrate a problem with orphan
control. The next word is supercalefragalistic
long.

BASIC ORPHAN CONTROL:
This is a paragraph of text that I'm going to
use to demonstrate a problem with orphan
control. The next word is
supercalefragalistic long.

TRADITIONAL MEDIA ORPHAN CONTROL:
This is a paragraph of text that I'm
going to use to demonstrate a problem
with orphan control. The next word is
supercalefragalistic long.

In existing traditional media the problem of poor line lengths after orphan control is tackled by the type layout application re-flowing the entire paragraph, adjusting letter-spacing, word-spacing and dropping problem words onto new lines. The particular method used is controllable in software to give different looks. Hyphenation is not usually used.