Closed Bug 327003 Opened 20 years ago Closed 19 years ago

Don't commit the IME composition string when Mozilla is deactivated

Categories

(Core :: Internationalization, defect)

defect
Not set
major

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

(Keywords: inputmethod, intl, jp-critical)

Attachments

(1 file, 8 obsolete files)

Now, we commit the IME composition string at the editor lost focus. # In nsTextEditorFocusListener::Blur http://lxr.mozilla.org/mozilla/source/editor/libeditor/text/nsEditorEventListeners.cpp#1078 But this is not good for some WM of the Linux. Because on some WM, the IME candidate list window steals the focus from Mozilla. Therefore, we need to move the commiting code from editor to ESM. We should commit the IME only when the another Mozilla widget steals the focus.
Status: NEW → ASSIGNED
Attached patch Patch rv1.0 (obsolete) — Splinter Review
This patch has |nsIMEStateManager| that is separating the IME managed code from ESM for readability. roc: If you grant to this approach, I'll request additional review to timeless(editor) and Masaki Katakai-san(gtk2).
Attachment #216228 - Flags: superreview?(roc)
Attachment #216228 - Flags: review?(roc)
roc: > If you grant to this approach, "If you agree to this approach,"
This patch also fixes bug 278802.
(In reply to comment #1) > Created an attachment (id=216228) [edit] > Patch rv1.0 It reject by the following files. (bug330710) patching file content/events/public/Makefile.inpatching file content/events/public/nsIIMEStateManager.h patching file content/events/src/Makefile.in patching file content/events/src/nsEventStateManager.cpp patching file content/events/src/nsEventStateManager.h patching file content/events/src/nsIMEStateManager.cpp patching file content/events/src/nsIMEStateManager.h patching file editor/libeditor/base/nsEditor.cpp patching file editor/libeditor/text/nsEditorEventListeners.cpp Hunk #2 FAILED at 1088. 1 out of 2 hunks FAILED -- saving rejects to file editor/libeditor/text/nsEditorEventListeners.cpp.rej patching file widget/src/gtk2/nsWindow.cpp patching file widget/src/gtk2/nsWindow.h
Attached patch Patch rv1.1 (obsolete) — Splinter Review
updating.
Attachment #216228 - Attachment is obsolete: true
Attachment #216293 - Flags: superreview?(roc)
Attachment #216293 - Flags: review?(roc)
Attachment #216228 - Flags: superreview?(roc)
Attachment #216228 - Flags: review?(roc)
Attached patch Patch rv1.1 (obsolete) — Splinter Review
Sorry, new files dropped.
Attachment #216293 - Attachment is obsolete: true
Attachment #216295 - Flags: superreview?(roc)
Attachment #216295 - Flags: review?(roc)
Attachment #216293 - Flags: superreview?(roc)
Attachment #216293 - Flags: review?(roc)
Attached patch Patch rv1.2 (obsolete) — Splinter Review
maybe, this fixes the crash on soralis.
Attachment #216295 - Attachment is obsolete: true
Attachment #216315 - Flags: superreview?(roc)
Attachment #216315 - Flags: review?(roc)
Attachment #216295 - Flags: superreview?(roc)
Attachment #216295 - Flags: review?(roc)
Attached patch Patch rv1.3 (obsolete) — Splinter Review
Sorry, this is better.
Attachment #216315 - Attachment is obsolete: true
Attachment #216316 - Flags: superreview?(roc)
Attachment #216316 - Flags: review?(roc)
Attachment #216315 - Flags: superreview?(roc)
Attachment #216315 - Flags: review?(roc)
+ nsIViewManager* GetViewManager() { + return GetPresShell() ? GetPresShell()->GetViewManager() : nsnull; + } I'd prefer that you did not do this. I assume you were crashing during presshell/prescontext destruction. Can you find a way to get around the crash without making this change? + static nsIMEStateManager sISM; That's a cute trick but it's not really needed here. The static instance could be a regular static variable and it's probably slightly more efficient to make it one. I think we don't need nsIIMEStateManager. Just use nsIMEStateManager.h directly. Does that need to be in EXPORTS? It's not used outside content/events/src, is it? nsIMEStateManager doesn't need to have an IID or inherit from nsISupports.
roc: Thank you for your review. I'll recreate a new patch. But I have another problem that is nsPresContext of background tab in active window returns true on nsIMEStateManager::IsActive. This is not good. We need to check the focus controller's active flag. But the flag is not correct on activate/deactivate... If you have a good idea for this problem, please tell me.
You might get some help by QI'ing the presshell to nsIViewObserver and calling IsVisible(). This is set to false on background tabs.
Attached patch Patch rv2.0 (obsolete) — Splinter Review
Attachment #216316 - Attachment is obsolete: true
Attachment #217193 - Flags: superreview?(roc)
Attachment #217193 - Flags: review?(roc)
Attachment #216316 - Flags: superreview?(roc)
Attachment #216316 - Flags: review?(roc)
+ virtual ~nsIMEStateManager(); + + NS_IMETHOD OnDestroyPresContext(nsPresContext* aPresContext); + NS_IMETHOD OnRemoveContent(nsPresContext* aPresContext, nsIContent* aContent); + NS_IMETHOD OnChangeFocus(nsPresContext* aPresContext, nsIContent* aContent); + NS_IMETHOD OnActivate(nsPresContext* aPresContext); + NS_IMETHOD OnDeactivate(nsPresContext* aPresContext); These don't need to be virtual. In fact, they can be static, and the fields of this class can be static too. Then you don't need an instance of nsIMEStateManager at all, and you don't need constructors and destructors. + nsCOMPtr<nsPresContext> context = shell->GetPresContext(); This doesn't need to be a strong reference since we're already holding a strong ref to the presshell, and the presshell strongly references the prescontext.
Attached patch Patch rv3.0 (obsolete) — Splinter Review
changing to static.
Attachment #217193 - Attachment is obsolete: true
Attachment #217289 - Flags: superreview?(roc)
Attachment #217289 - Flags: review?(roc)
Attachment #217193 - Flags: superreview?(roc)
Attachment #217193 - Flags: review?(roc)
GetKBStateControl can just return a non-addrefed pointer directly. There is no need to return an addrefed pointer here; you're not doing anything that could destroy the widget, right? Return nsnull if there's an error. Why do we need nsEventStateManager to have the new NotifyDestroyPresContext method? Is it too late to do that stuff when SetPresContext(nsnull) gets called?
(In reply to comment #15) > Why do we need nsEventStateManager to have the new NotifyDestroyPresContext > method? Is it too late to do that stuff when SetPresContext(nsnull) gets > called? Maybe, 'Yes'. It's too late. Because the view manager of the presShell is released after here, but before SetPresContext(nsnull). Do you have better idea? I don't have better idea.(I don't like this approach too.)
Attached patch Patch rv3.1 (obsolete) — Splinter Review
And see previous my comment for |NotifyDestroyPresContext|.
Attachment #217289 - Attachment is obsolete: true
Attachment #217356 - Flags: superreview?(roc)
Attachment #217356 - Flags: review?(roc)
Attachment #217289 - Flags: superreview?(roc)
Attachment #217289 - Flags: review?(roc)
Attachment #217356 - Flags: superreview?(roc)
Attachment #217356 - Flags: superreview+
Attachment #217356 - Flags: review?(roc)
Attachment #217356 - Flags: review+
Comment on attachment 217356 [details] [diff] [review] Patch rv3.1 timeless: Would you review the editor code? I removed to call |ForceCompositionEnd()| from |nsEditor::PostCreate()| this is added by bug 17419. But I think that this code is not needed for the bug. But If it's needed for that bug, maybe it is wrong. We should find another way.
Attachment #217356 - Flags: review?(timeless)
Comment on attachment 217356 [details] [diff] [review] Patch rv3.1 Katakai-san: Would you review gtk2 widget code?
Attachment #217356 - Flags: review?(masaki.katakai)
Comment on attachment 217356 [details] [diff] [review] Patch rv3.1 > if (focusedIm && focusedIm == window->mIMEData->mContext) { > // Release current IME focus if IME is enabled. >- if (window->mIMEData->mEnabled) >+ if (window->mIMEData->mEnabled) { >+ focusedWin->ResetInputState(); > focusedWin->IMELoseFocus(); >+ } Hi Nakako-san, focusedWin->ResetInputState() was not in the patch for bug 321468, but it's newly added for this patch. Any reason?
(In reply to comment #20) > (From update of attachment 217356 [details] [diff] [review] [edit]) > > if (focusedIm && focusedIm == window->mIMEData->mContext) { > > // Release current IME focus if IME is enabled. > >- if (window->mIMEData->mEnabled) > >+ if (window->mIMEData->mEnabled) { > >+ focusedWin->ResetInputState(); > > focusedWin->IMELoseFocus(); > >+ } > > Hi Nakako-san, > > focusedWin->ResetInputState() was not in the patch for bug 321468, but it's > newly added for this patch. > Any reason? It was removed by your advice, because it commited at the window is activating. But it's necessary and this patch removes the problem.(at the window is activating, |SetIMEEnabled| is not called by this patch.)
> It was removed by your advice, because it commited at the window is activating. > But it's necessary and this patch removes the problem.(at the window is > activating, |SetIMEEnabled| is not called by this patch.) Which bug can be fixed by that line? I need a reason why this line is necessary, any bugid or example step?
(In reply to comment #22) > > It was removed by your advice, because it commited at the window is activating. > > But it's necessary and this patch removes the problem.(at the window is > > activating, |SetIMEEnabled| is not called by this patch.) > > Which bug can be fixed by that line? I need a reason why this line is > necessary, any bugid or example step? > There is no bug. But I think that we should ensure that there is not IM transaction while IM is disabled on the widget. If there is a IM transaction but the IM is disabled on the widget, user cannot commit the IM transaction, because the widget doesn't send key events to IM while IM is disabled.
Comment on attachment 217356 [details] [diff] [review] Patch rv3.1 Thank you Nakano-san for clarification. I understand now.
Attachment #217356 - Flags: review?(masaki.katakai) → review+
Comment on attachment 217356 [details] [diff] [review] Patch rv3.1 >Index: content/events/public/nsIEventStateManager.h > class nsIEventStateManager : public nsISupports { >+ NS_IMETHOD NotifyDestroyPresContext(nsPresContext* aPresContext) = 0; > NS_IMETHOD SetPresContext(nsPresContext* aPresContext) = 0; normally we add methods to the end, but since you're bumping the iid i suppose it doesn't matter. but that's not my part of the code area :). changes seem fine.
Attachment #217356 - Flags: review?(timeless) → review+
checked-in, thank you.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #217356 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: