[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   with a real space since ICU no longer treats   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.
Created attachment 12033 [details] Preserve non-breaking spaces when capitalizing Includes test and change log. No layout test regressions.
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 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.
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.
Committed revision 18453. Corrected expected results (the patch had old pixel results).