From 897479abe237eeb1c55f04af5e167bdf70147338 Mon Sep 17 00:00:00 2001 From: "masayuki%d-toybox.com" Date: Wed, 20 Feb 2008 07:18:53 +0000 Subject: [PATCH] Bug 417315 Cannot use IME menus during IME transaction #2 r=peterv+enndeakin, sr=peterv, a1.9=beltzner --- editor/idl/nsIEditorIMESupport.idl | 7 ++++++- editor/libeditor/base/nsEditor.cpp | 8 ++++++++ toolkit/content/widgets/textbox.xml | 11 +++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/editor/idl/nsIEditorIMESupport.idl b/editor/idl/nsIEditorIMESupport.idl index 8ed62b936f8..6d2680bd0ed 100644 --- a/editor/idl/nsIEditorIMESupport.idl +++ b/editor/idl/nsIEditorIMESupport.idl @@ -52,7 +52,7 @@ struct nsQueryCaretRectEventReply; [ptr] native nsQueryCaretRectEventReplyPtr(nsQueryCaretRectEventReply); -[scriptable, uuid(228a76d3-5462-4322-a63c-5f94f7f5d4ed)] +[scriptable, uuid(ce1c0424-c3c0-44b0-97d6-df12deb19d45)] interface nsIEditorIMESupport : nsISupports { @@ -118,5 +118,10 @@ interface nsIEditorIMESupport : nsISupports */ [noscript] void getPreferredIMEState(out unsigned long aState); + + /** + * whether this editor has active IME transaction + */ + readonly attribute boolean composing; }; diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index cd0214b70f3..961690518c3 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -2245,6 +2245,14 @@ nsEditor::GetPreferredIMEState(PRUint32 *aState) return NS_OK; } +NS_IMETHODIMP +nsEditor::GetComposing(PRBool* aResult) +{ + NS_ENSURE_ARG_POINTER(aResult); + *aResult = IsIMEComposing(); + return NS_OK; +} + NS_IMETHODIMP nsEditor::GetReconversionString(nsReconversionEventReply* aReply) { diff --git a/toolkit/content/widgets/textbox.xml b/toolkit/content/widgets/textbox.xml index c3c7f8f7938..c012368c356 100644 --- a/toolkit/content/widgets/textbox.xml +++ b/toolkit/content/widgets/textbox.xml @@ -232,8 +232,15 @@ return; // Allow other children (e.g. URL bar buttons) to get focus else if (this.mIgnoreFocus) this.mIgnoreFocus = false; - else if (this.clickSelectsAll) - this.editor.selectAll(); + else if (this.clickSelectsAll) { + try { + const nsIEditorIMESupport = + Components.interfaces.nsIEditorIMESupport; + var imeEditor = this.editor.QueryInterface(nsIEditorIMESupport); + if (!imeEditor || !imeEditor.composing) + this.editor.selectAll(); + } catch (e) {} + } this.setAttribute("focused", "true"); }