WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 5241
51918
contentEditable cannot handle multiple whitespace which is set as a composition text.
https://bugs.webkit.org/show_bug.cgi?id=51918
Summary
contentEditable cannot handle multiple whitespace which is set as a compositi...
Hajime Morrita
Reported
2011-01-04 23:27:30 PST
How to reproduce: 1. Open attached repro URL (it is a plain contentEditable div) 2. Place caret between "[" and "]" 3. Enable IME 4. input "AB" (by typing Shift-A, Shift-B) 5. move caret between A and B (by typing left-arrow) 6. input whitespace multiple times (by typing whitespace) What is expected: The string "A", followed by multiple whitespace, followed by "B" should be appeared as a composition text. What happens instead: The string "A", followed by single whitespace, followed by "B" is appeared. Other browsers: - Firefox accepts multiple whitespace characters - On Windows, composition text is typically rendered by IME itself, (thus multiple whitespace is accepted) Note: You can use Google Japanese Input (
http://www.google.com/intl/ja/ime/index-mac.html
) to reproduce this problem. You can input multiple whitespace between compositing text. Kotoeri doesn't allow users to input such type of sequence.
Attachments
Patch
(14.37 KB, patch)
2011-01-06 22:34 PST
,
Hajime Morrita
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2011-01-05 07:14:41 PST
I'm not too familiar with how IME works on Mac but in other places in editing, we use interleaving sp and nbsp to render line-breakable multiple whitespace.
Hajime Morrita
Comment 2
2011-01-06 22:34:57 PST
Created
attachment 78211
[details]
Patch
Ryosuke Niwa
Comment 3
2011-01-10 14:48:22 PST
Comment on
attachment 78211
[details]
Patch 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.
Alexey Proskuryakov
Comment 4
2011-01-10 15:00:57 PST
Duplicate of
bug 5241
?
Ryosuke Niwa
Comment 5
2011-01-10 15:04:18 PST
(In reply to
comment #4
)
> Duplicate of
bug 5241
?
So it seems.
Hajime Morrita
Comment 6
2011-01-11 00:42:49 PST
> > Duplicate of
bug 5241
? > > So it seems.
Thanks to pointing this out. I'm closing this to mark as duplicated. Update patch will come shortly to
Bug 5241
. *** This bug has been marked as a duplicate of
bug 5241
***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug