Bug 58049

Summary: [Mac] Editor::setComposition() should not trigger correction panel timer.
Product: WebKit Reporter: Jia Pu <jiapu.mail>
Component: HTML EditingAssignee: Jia Pu <jiapu.mail>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, ddavidso, morrita
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.6   
Attachments:
Description Flags
Patch (v1)
none
Patch (v2)
none
Path (v3) none

Jia Pu
Reported 2011-04-07 09:22:45 PDT
When using Japanese or Chinese input method on Mac OS X that supports autocorrection panel, Editor::setComposition() shouldn't not trigger the correction panel timer. <rdar://problem/9226305>
Attachments
Patch (v1) (15.26 KB, patch)
2011-04-07 10:12 PDT, Jia Pu
no flags
Patch (v2) (19.57 KB, patch)
2011-04-07 13:51 PDT, Jia Pu
no flags
Path (v3) (19.76 KB, patch)
2011-04-07 14:02 PDT, Jia Pu
no flags
Jia Pu
Comment 1 2011-04-07 10:12:23 PDT
Created attachment 88656 [details] Patch (v1)
Darin Adler
Comment 2 2011-04-07 11:11:22 PDT
Comment on attachment 88656 [details] Patch (v1) View in context: https://bugs.webkit.org/attachment.cgi?id=88656&action=review This looks good. Is there any way to add some kind of test coverage? > Source/WebCore/editing/TypingCommand.cpp:139 > RefPtr<TypingCommand> typingCommand = TypingCommand::create(document, ForwardDeleteKey, "", options, granularity); > - typingCommand->setSmartDelete(smartDelete); > typingCommand->apply(); I don’t think you need a local variable here any more. You can just create and apply the command all on one line. > Source/WebCore/editing/TypingCommand.h:58 > enum TypingCommandOption { > SelectInsertedText = 1 << 0, > KillRing = 1 << 1, > - RetainAutocorrectionIndicator = 1 << 2 > + RetainAutocorrectionIndicator = 1 << 2, > + PreventSpellChecking = 1 << 3, > + SmartDelete = 1 << 4 > }; > typedef unsigned TypingCommandOptions; It’s annoying that these have such long names. They should be named just Option and Options since they are class members already. > Source/WebCore/editing/TypingCommand.h:62 > - static void deleteSelection(Document*, bool smartDelete = false); > - static void deleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity, bool killRing = false); > - static void forwardDeleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity, bool killRing = false); > + static void deleteSelection(Document*, TypingCommandOptions); > + static void deleteKeyPressed(Document*, TypingCommandOptions, TextGranularity = CharacterGranularity); > + static void forwardDeleteKeyPressed(Document*, TypingCommandOptions, TextGranularity = CharacterGranularity); Since the options had default values before, I think TypingCommandOptions should still have a default of 0 after.
Jia Pu
Comment 3 2011-04-07 11:17:20 PDT
(In reply to comment #2) > (From update of attachment 88656 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88656&action=review > > This looks good. Is there any way to add some kind of test coverage? > Automated test is difficult since this involves the timer. We have yet to identify a particular input sequence that triggers the recursive call. The patch is based on analyzing one available backtrace. I will try a little bit to see if I can find a deterministically reproducible case.
Hajime Morrita
Comment 4 2011-04-07 11:37:10 PDT
Comment on attachment 88656 [details] Patch (v1) View in context: https://bugs.webkit.org/attachment.cgi?id=88656&action=review > Source/WebCore/editing/Editor.cpp:1706 > + TypingCommand::deleteSelection(m_frame->document(), TypingCommand::PreventSpellChecking); Do we really need these #if s? I think we don't need spellchecking during the spell-checking anyway and I want to have as small number of #if as possible. In addition, this looks to change the behavior even if the panel is disabled at the runtime. What do you think?
Jia Pu
Comment 5 2011-04-07 11:49:50 PDT
(In reply to comment #4) > (From update of attachment 88656 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88656&action=review > > > Source/WebCore/editing/Editor.cpp:1706 > > + TypingCommand::deleteSelection(m_frame->document(), TypingCommand::PreventSpellChecking); > > Do we really need these #if s? I agree that we probably should prevent spell checking here across the board. I was playing safe. > I think we don't need spellchecking during the spell-checking anyway > and I want to have as small number of #if as possible. > In addition, this looks to change the behavior even if the panel is disabled at the runtime. > What do you think? If we decide to always use PreventSpellChecking here, then I suppose the last pony is irrelevant.
Hajime Morrita
Comment 6 2011-04-07 12:58:44 PDT
(In reply to comment #5) > > If we decide to always use PreventSpellChecking here, then I suppose the last pony is irrelevant. Yes, always using PreventSpellChecking sounds good to me.
Jia Pu
Comment 7 2011-04-07 13:51:57 PDT
Created attachment 88688 [details] Patch (v2)
Darin Adler
Comment 8 2011-04-07 13:53:38 PDT
Comment on attachment 88688 [details] Patch (v2) View in context: https://bugs.webkit.org/attachment.cgi?id=88688&action=review > Source/WebCore/ChangeLog:14 > + No new tests. (OOPS!) Can’t land a patch with this line in it. Please replace with an explanation of why there are no new tests.
Jia Pu
Comment 9 2011-04-07 14:02:48 PDT
Created attachment 88692 [details] Path (v3)
WebKit Commit Bot
Comment 10 2011-04-07 20:59:52 PDT
Comment on attachment 88692 [details] Path (v3) Clearing flags on attachment: 88692 Committed r83245: <http://trac.webkit.org/changeset/83245>
WebKit Commit Bot
Comment 11 2011-04-07 20:59:58 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.