Bug 11671

Summary: REGRESSION (r13702): text-transform: capitalize changes non-breaking spaces to spaces
Product: WebKit Reporter: mitz
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, bdakin
Priority: P1 Keywords: HasReduction, Regression
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
URL: http://abadacapoeira.de
Attachments:
Description Flags
Preserve non-breaking spaces when capitalizing
none
Preserve non-breaking spaces when capitalizing ap: review+

Description mitz 2006-11-21 14:18:12 PST
[Split off from bug 11630, where this was not the main issue]

The testcase (attachment 11590 [details]) demonstrates that text-transform:capitalize changes non-breaking spaces to normal spaces. In shipping Safari, Firefox and Opera, there is a gap between the two 100x100 squares due to the text, which includes non-breaking spaces. This is also the case in TOT if text-transform: capitalize is not specified.

From StringImpl::capitalize:
        // Replace &nbsp with a real space since ICU no longer treats &nbsp as
a word separator.

This was added in r13702 to address <rdar://problem/4502311>
text-transform:capitalize needs to 
treat nbsp as a regular space when ICU changes.

I think the solution might be as simple as copying from m_data[i - 1] instead
of stringWithPrevious[i] in the loop that copies the non-capitalized
characters.
Comment 1 mitz 2006-12-26 08:58:33 PST
Created attachment 12033 [details]
Preserve non-breaking spaces when capitalizing

Includes test and change log. No layout test regressions.
Comment 2 mitz 2006-12-26 13:00:47 PST
Created attachment 12044 [details]
Preserve non-breaking spaces when capitalizing

This version also improves the fix for <rdar://problem/4502311> from r13702 by applying it to 'previous'. A test for the case that the previous character is a non-breaking space is included, although with current ICU, this patch does not affect this case.
Comment 3 Alexey Proskuryakov 2006-12-26 13:14:43 PST
Comment on attachment 12044 [details]
Preserve non-breaking spaces when capitalizing

r=me

As discussed on IRC, it would be nice to know more about what happened to nbsp in the new Unicode standard (I don't understand why it stops being a word separator), but that's outside the scope of this bug.
Comment 4 Alexey Proskuryakov 2006-12-26 13:49:32 PST
I'm not sure if the whole hack with replacing nbsps is necessary anymore, given that Unicode 5 has restored their behavior of word separators. This fix seems good to land anyway.
Comment 5 Alexey Proskuryakov 2006-12-28 10:33:52 PST
Committed revision 18453. Corrected expected results (the patch had old pixel results).