[Webkit-unassigned] [Bug 51918] contentEditable cannot handle multiple whitespace which is set as a composition text.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Jan 10 14:48:22 PST 2011
https://bugs.webkit.org/show_bug.cgi?id=51918
--- Comment #3 from Ryosuke Niwa <rniwa at webkit.org> 2011-01-10 14:48:22 PST ---
(From update of attachment 78211)
View in context: https://bugs.webkit.org/attachment.cgi?id=78211&action=review
> LayoutTests/ChangeLog:7
> +
You probably want to explain what kind of test you're adding.
> WebCore/editing/CompositeEditCommand.cpp:433
> +String CompositeEditCommand::stringWithBalancedWhitespaceAt(const Position& position, const String& text)
Nit: the original function name "rebalanceWhitespaceAt" is better IMO.
> WebCore/editing/CompositeEditCommand.cpp:438
> + String ret;
Nit: please don't use abbreviation.
> WebCore/editing/CompositeEditCommand.cpp:469
> + for (unsigned i = 0; i < text.length(); ++i) {
> + bool isWhitespace = text[i] == ' ';
> + if (isWhitespace) {
> + whiteCount++;
> +
> + if (i + 1 < text.length())
> + continue;
> + // Preserves trailing whitespace, which will be balanced by rebalanceWhitespaceAt()
> + ret.append(text.characters() + text.length() - whiteCount, whiteCount);
> + break;
> + }
> +
> + // Preseves leading whitespace, which will be balanced by rebalanceWhitespaceAt()
> + if (whiteCount == i)
> + ret.append(text.characters(), whiteCount);
> + else {
> + // Interleaves nbsp and whitespace to preserve
> + // space characters and line-breakability.
> + if (1 == whiteCount)
> + ret.append(' ');
> + else {
> + for (unsigned whiteIndex = 0; whiteIndex < whiteCount; ++whiteIndex)
> + ret.append(static_cast<UChar>(whiteIndex%2 ? noBreakSpace : ' '));
> + }
> + }
> +
> + ret.append(text.characters()[i]);
> + whiteCount = 0;
> + }
Why aren't we calling stringWithRebalancedWhitespace in htmlediting.cpp?
> WebCore/editing/Editor.cpp:1604
> + // Some IME pass sequence of whitespace ' ' instead of nbsp even they expect
> + // multiple whitespaces inserted into the redering result.
> + // So we mix some nbsp characters for preserving the whitespace.
Nit: I don't think this comment is necessary. Anyone who knows about whitespace rebalancing would understand what this code does.
> WebCore/editing/Editor.cpp:1696
> + // Some IME pass sequence of whitespace ' ' instead of nbsp even they expect
> + // multiple whitespaces inserted into the redering result.
> + // So we mix some nbsp characters for preserving the whitespace.
Ditto.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list