Bug 11671 - REGRESSION (r13702): text-transform: capitalize changes non-breaking spaces to spaces
Summary: REGRESSION (r13702): text-transform: capitalize changes non-breaking spaces t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P1 Normal
Assignee: Nobody
URL: http://abadacapoeira.de
Keywords: HasReduction, Regression
Depends on:
Blocks:
 
Reported: 2006-11-21 14:18 PST by mitz
Modified: 2006-12-28 10:33 PST (History)
2 users (show)

See Also:


Attachments
Preserve non-breaking spaces when capitalizing (36.35 KB, patch)
2006-12-26 08:58 PST, mitz
no flags Details | Formatted Diff | Diff
Preserve non-breaking spaces when capitalizing (38.78 KB, patch)
2006-12-26 13:00 PST, mitz
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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).