-
rniwa@webkit.org authored
Reviewed by Ojan Vafai. Inserting multiple whitespace using text composition (IME) should insert interleaved nbsp and whitespace. https://bugs.webkit.org/show_bug.cgi?id=52781 The test was rebaselined to have interleaved space and non-breaking space. * editing/inserting/insert-composition-whitespace-expected.txt: * editing/inserting/insert-composition-whitespace.html: 2011-01-24 Ryosuke Niwa <rniwa@webkit.org> Reviewed by Ojan Vafai. Inserting multiple whitespace using text composition (IME) should insert interleaved nbsp and whitespace. https://bugs.webkit.org/show_bug.cgi?id=52781 The bug was caused by stringWithRebalancedWhitespace's replacing the space at the beginning of a paragraph and the end of a paragraph by a non-breaking space after it replaced two consecutive spaces by a space and non-breaking space pattern, thereby replacing more spaces by non-breaking spaces than needed. Rewrote the function using Vector<UChar> to fix the bug. New function no longer calls String::replace multiple times but instead it traverses through the string and replaces a space that immediately follows another space or appears at the beginning of a paragraph or at the end of a paragraph by a non-break space. * editing/CompositeEditCommand.cpp: * editing/htmlediting.cpp: (WebCore::stringWithRebalancedWhitespace): Written. * editing/htmlediting.h: (WebCore::isWhitespace): Removed from CompositeEditCommand.cpp git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
920c61a5