From 596da0444815192a8f45154aa42903c6869ca741 Mon Sep 17 00:00:00 2001 From: "smontagu%smontagu.org" Date: Sat, 11 Sep 2004 07:48:29 +0000 Subject: [PATCH] Backout last checkin because of build bustage --- editor/idl/nsIEditorIMESupport.idl | 15 +- editor/libeditor/base/nsEditor.cpp | 132 +++--------------- editor/libeditor/base/nsEditor.h | 14 +- .../libeditor/text/nsEditorEventListeners.cpp | 8 +- modules/libpref/src/init/all.js | 3 - widget/public/nsIKBStateControl.h | 22 +-- widget/src/cocoa/nsChildView.h | 2 - widget/src/cocoa/nsChildView.mm | 10 -- widget/src/gtk/nsWindow.cpp | 8 -- widget/src/gtk/nsWindow.h | 2 - widget/src/mac/nsWindow.cpp | 8 -- widget/src/mac/nsWindow.h | 2 - widget/src/photon/nsWidget.cpp | 9 +- widget/src/photon/nsWidget.h | 3 +- widget/src/windows/nsWindow.cpp | 50 ------- widget/src/windows/nsWindow.h | 23 --- 16 files changed, 32 insertions(+), 279 deletions(-) diff --git a/editor/idl/nsIEditorIMESupport.idl b/editor/idl/nsIEditorIMESupport.idl index 3cbc3f40d0c3..9e39a00e68b4 100644 --- a/editor/idl/nsIEditorIMESupport.idl +++ b/editor/idl/nsIEditorIMESupport.idl @@ -49,7 +49,7 @@ struct nsReconversionEventReply; [ptr] native nsReconversionEventReplyPtr(nsReconversionEventReply); -[scriptable, uuid(fe489b4d-d2f6-4215-ab33-6afd66388416)] +[scriptable, uuid(4805e680-49b9-11d3-9ce4-ed60bd6cb5bc)] interface nsIEditorIMESupport : nsISupports { @@ -89,18 +89,5 @@ interface nsIEditorIMESupport : nsISupports * GetReconvertionString() Get the reconvertion string */ [noscript] void GetReconversionString(in nsReconversionEventReplyPtr aReply); - - /** - * Notify for IME when the editor got focus. - */ - - [noscript] void NotifyIMEOnFocus(); - - /** - * Notify for IME when the editor lost focus. - */ - - [noscript] void NotifyIMEOnBlur(); - }; diff --git a/editor/libeditor/base/nsEditor.cpp b/editor/libeditor/base/nsEditor.cpp index 6002e98af684..69d508fdf650 100644 --- a/editor/libeditor/base/nsEditor.cpp +++ b/editor/libeditor/base/nsEditor.cpp @@ -114,10 +114,6 @@ static PRBool gNoisy = PR_FALSE; PRInt32 nsEditor::gInstanceCount = 0; -// Value of "ime.password.onFocus.dontCare" -static PRBool gDontCareForIMEOnFocusPassword = PR_FALSE; -// Value of "ime.password.onBlur.dontCare" -static PRBool gDontCareForIMEOnBlurPassword = PR_FALSE; //--------------------------------------------------------------------------- // @@ -150,7 +146,6 @@ nsEditor::nsEditor() , mIMETextOffset(0) , mIMEBufferLength(0) , mIsIMEComposing(PR_FALSE) -, mNeedRecoverIMEOpenState(PR_FALSE) , mActionListeners(nsnull) , mEditorObservers(nsnull) , mDocDirtyState(-1) @@ -309,17 +304,6 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot NS_POSTCONDITION(mDocWeak && mPresShellWeak, "bad state"); - nsresult result; - nsCOMPtr prefBranch = - do_GetService(NS_PREFSERVICE_CONTRACTID, &result); - if (NS_SUCCEEDED(result) && prefBranch) { - PRBool val; - if (NS_SUCCEEDED(prefBranch->GetBoolPref("ime.password.onFocus.dontCare", &val))) - gDontCareForIMEOnFocusPassword = val; - if (NS_SUCCEEDED(prefBranch->GetBoolPref("ime.password.onBlur.dontCare", &val))) - gDontCareForIMEOnBlurPassword = val; - } - return NS_OK; } @@ -1928,12 +1912,6 @@ nsEditor::BeginComposition(nsTextEventReply* aReply) mInIMEMode = PR_TRUE; if (mPhonetic) mPhonetic->Truncate(0); - - // If user changes the IME open state, don't recover it. - // Because the user may not want to change the state. - if (mNeedRecoverIMEOpenState) - mNeedRecoverIMEOpenState = PR_FALSE; - return ret; } @@ -2037,35 +2015,6 @@ GetEditorContentWindow(nsIPresShell *aPresShell, nsIDOMElement *aRoot, nsIWidget return NS_OK; } -nsresult -nsEditor::GetKBStateControl(nsIKBStateControl **aKBSC) -{ - if (!aKBSC) - return NS_ERROR_NULL_POINTER; - *aKBSC = nsnull; - nsCOMPtr shell; - nsresult res = GetPresShell(getter_AddRefs(shell)); - - if (NS_FAILED(res)) - return res; - - if (!shell) - return NS_ERROR_FAILURE; - - nsCOMPtr widget; - res = GetEditorContentWindow(shell, mBodyElement, getter_AddRefs(widget)); - if (NS_FAILED(res)) - return res; - - nsCOMPtr kb = do_QueryInterface(widget); - if (!kb) - return NS_ERROR_NOT_INITIALIZED; - - NS_ADDREF(*aKBSC = kb); - - return NS_OK; -} - NS_IMETHODIMP nsEditor::ForceCompositionEnd() { @@ -2085,74 +2034,27 @@ nsEditor::ForceCompositionEnd() return NS_OK; #endif - nsCOMPtr kb; - nsresult res = GetKBStateControl(getter_AddRefs(kb)); + nsCOMPtr shell; + nsresult res = GetPresShell(getter_AddRefs(shell)); + if (NS_FAILED(res)) return res; - if (kb) { + if (!shell) + return NS_ERROR_FAILURE; + + nsCOMPtr widget; + + res = GetEditorContentWindow(shell, mBodyElement, getter_AddRefs(widget)); + + if (NS_FAILED(res)) + return res; + + nsCOMPtr kb = do_QueryInterface(widget); + + if (kb) res = kb->ResetInputState(); - if (NS_FAILED(res)) - return res; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsEditor::NotifyIMEOnFocus() -{ - mNeedRecoverIMEOpenState = PR_FALSE; - - if(gDontCareForIMEOnFocusPassword - || !(mFlags & nsIPlaintextEditor::eEditorPasswordMask)) - return NS_OK; - - nsCOMPtr kb; - nsresult res = GetKBStateControl(getter_AddRefs(kb)); - if (NS_FAILED(res)) - return res; - - if (kb) { - PRBool isOpen; - res = kb->GetIMEOpenState(&isOpen); - if (NS_FAILED(res)) - return res; - - if (isOpen) { - res = kb->SetIMEOpenState(PR_FALSE); - if (NS_FAILED(res)) - return res; - } - - mNeedRecoverIMEOpenState = isOpen; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsEditor::NotifyIMEOnBlur() -{ - if (!mNeedRecoverIMEOpenState) - return NS_OK; - mNeedRecoverIMEOpenState = PR_FALSE; - - if (gDontCareForIMEOnBlurPassword - || !(mFlags & nsIPlaintextEditor::eEditorPasswordMask)) - return NS_OK; - - nsCOMPtr kb; - nsresult res = GetKBStateControl(getter_AddRefs(kb)); - if (NS_FAILED(res)) - return res; - - if (kb) { - res = kb->SetIMEOpenState(PR_TRUE); - if (NS_FAILED(res)) - return res; - } - + return NS_OK; } diff --git a/editor/libeditor/base/nsEditor.h b/editor/libeditor/base/nsEditor.h index e432d316ac5d..1c39eccac3d5 100644 --- a/editor/libeditor/base/nsEditor.h +++ b/editor/libeditor/base/nsEditor.h @@ -45,7 +45,6 @@ #include "nsIEditor.h" #include "nsIEditorIMESupport.h" #include "nsIPhonetic.h" -#include "nsIKBStateControl.h" #include "nsIAtom.h" #include "nsIDOMDocument.h" @@ -144,7 +143,13 @@ public: /* ------------ nsIEditor methods -------------- */ NS_DECL_NSIEDITOR /* ------------ nsIEditorIMESupport methods -------------- */ - NS_DECL_NSIEDITORIMESUPPORT + + NS_IMETHOD BeginComposition(nsTextEventReply* aReply); + NS_IMETHOD QueryComposition(nsTextEventReply* aReply); + NS_IMETHOD SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply); + NS_IMETHOD EndComposition(void); + NS_IMETHOD ForceCompositionEnd(void); + NS_IMETHOD GetReconversionString(nsReconversionEventReply *aReply); // nsIPhonetic NS_DECL_NSIPHONETIC @@ -327,8 +332,6 @@ protected: nsCOMPtr *aResultNode, PRBool bNoBlockCrossing = PR_FALSE); - // Get nsIKBStateControl interface - nsresult GetKBStateControl(nsIKBStateControl **aKBSC); public: /** All editor operations which alter the doc should be prefaced @@ -581,9 +584,8 @@ protected: nsCOMPtr mIMETextNode; // current IME text node PRUint32 mIMETextOffset; // offset in text node where IME comp string begins PRUint32 mIMEBufferLength; // current length of IME comp string - PRPackedBool mIsIMEComposing; // is IME in composition state? + PRBool mIsIMEComposing; // is IME in composition state? // This is different from mInIMEMode. see Bug 98434. - PRPackedBool mNeedRecoverIMEOpenState; // Need IME open state change on blur. // various listeners nsVoidArray* mActionListeners; // listens to all low level actions on the doc diff --git a/editor/libeditor/text/nsEditorEventListeners.cpp b/editor/libeditor/text/nsEditorEventListeners.cpp index 3a081be4864a..b9473cd02894 100644 --- a/editor/libeditor/text/nsEditorEventListeners.cpp +++ b/editor/libeditor/text/nsEditorEventListeners.cpp @@ -1059,10 +1059,6 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent) } } } - - nsCOMPtr imeEditor = do_QueryInterface(mEditor); - if (imeEditor) - imeEditor->NotifyIMEOnFocus(); } return NS_OK; } @@ -1081,10 +1077,8 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent) // when imeEditor exists, call ForceCompositionEnd() to tell // the input focus is leaving first nsCOMPtr imeEditor = do_QueryInterface(mEditor); - if (imeEditor) { + if (imeEditor) imeEditor->ForceCompositionEnd(); - imeEditor->NotifyIMEOnBlur(); - } nsCOMPtreditor = do_QueryInterface(mEditor); if (editor) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 6195cc246735..2fab94bfa8ee 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -632,9 +632,6 @@ pref("network.enablePad", false); // Allow client to do proxy pref("converter.html2txt.structs", true); // Output structured phrases (strong, em, code, sub, sup, b, i, u) pref("converter.html2txt.header_strategy", 1); // 0 = no indention; 1 = indention, increased with header level; 2 = numbering and slight indention -pref("ime.password.onFocus.dontCare", false); -pref("ime.password.onBlur.dontCare", false); - pref("intl.accept_languages", "chrome://navigator/locale/navigator.properties"); pref("intl.accept_charsets", "iso-8859-1,*,utf-8"); pref("intl.collationOption", "chrome://navigator-platform/locale/navigator.properties"); diff --git a/widget/public/nsIKBStateControl.h b/widget/public/nsIKBStateControl.h index 7d95a8cb079f..ecb13c800a4d 100644 --- a/widget/public/nsIKBStateControl.h +++ b/widget/public/nsIKBStateControl.h @@ -62,29 +62,9 @@ class nsIKBStateControl : public nsISupports { NS_IMETHOD ResetInputState()=0; /* - * Following methods relates to IME 'Opened'/'Closed' state. - * 'Opened' means the user can input any character. I.e., users can input Japanese - * and other characters. The user can change the state to 'Closed'. - * 'Closed' means the user can input ASCII characters only. This is the same as a - * non-IME environment. The user can change the state to 'Opened'. - * For more information is here. - * http://bugzilla.mozilla.org/show_bug.cgi?id=16940#c48 + * This method is called in the init stage of a password field */ - /* - * Set the state to 'Opened' or 'Closed'. - * If aState is TRUE, IME open state is set to 'Opened'. - * If aState is FALSE, set to 'Closed'. - */ - NS_IMETHOD SetIMEOpenState(PRBool aState) = 0; - - /* - * Get IME is 'Opened' or 'Closed'. - * If IME is 'Opened', aState is set PR_TRUE. - * If IME is 'Closed', aState is set PR_FALSE. - */ - NS_IMETHOD GetIMEOpenState(PRBool* aState) = 0; - }; #endif // nsIKBStateControl_h__ diff --git a/widget/src/cocoa/nsChildView.h b/widget/src/cocoa/nsChildView.h index 420216dcf82f..1cb967fb4ebc 100644 --- a/widget/src/cocoa/nsChildView.h +++ b/widget/src/cocoa/nsChildView.h @@ -245,8 +245,6 @@ public: public: // nsIKBStateControl interface NS_IMETHOD ResetInputState(); - NS_IMETHOD SetIMEOpenState(PRBool aState); - NS_IMETHOD GetIMEOpenState(PRBool* aState); protected: diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 6b720445f0f0..a5101c47b16c 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -2036,16 +2036,6 @@ NS_IMETHODIMP nsChildView::ResetInputState() return NS_ERROR_ABORT; } -NS_IMETHODIMP nsChildView::SetIMEOpenState(PRBool aState) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP nsChildView::GetIMEOpenState(PRBool* aState) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - // // GetQuickDrawPort diff --git a/widget/src/gtk/nsWindow.cpp b/widget/src/gtk/nsWindow.cpp index 4680c768afc6..73c77168443d 100644 --- a/widget/src/gtk/nsWindow.cpp +++ b/widget/src/gtk/nsWindow.cpp @@ -4100,14 +4100,6 @@ NS_IMETHODIMP nsWindow::ResetInputState() return NS_OK; } -NS_IMETHODIMP SetIMEOpenState(PRBool aState) { - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP GetIMEOpenState(PRBool* aState) { - return NS_ERROR_NOT_IMPLEMENTED; -} - static void gdk_wmspec_change_state (gboolean add, GdkWindow *window, diff --git a/widget/src/gtk/nsWindow.h b/widget/src/gtk/nsWindow.h index d03a1e79cf49..597411bedb2c 100644 --- a/widget/src/gtk/nsWindow.h +++ b/widget/src/gtk/nsWindow.h @@ -130,8 +130,6 @@ public: // nsIKBStateControl NS_IMETHOD ResetInputState(); - NS_IMETHOD SetIMEOpenState(PRBool aState); - NS_IMETHOD GetIMEOpenState(PRBool* aState); void QueueDraw(); void UnqueueDraw(); diff --git a/widget/src/mac/nsWindow.cpp b/widget/src/mac/nsWindow.cpp index aae9edda4b8b..786f06169b25 100644 --- a/widget/src/mac/nsWindow.cpp +++ b/widget/src/mac/nsWindow.cpp @@ -2614,14 +2614,6 @@ NS_IMETHODIMP nsWindow::ResetInputState() return NS_ERROR_ABORT; } -NS_IMETHODIMP SetIMEOpenState(PRBool aState) { - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP GetIMEOpenState(PRBool* aState) { - return NS_ERROR_NOT_IMPLEMENTED; -} - #if !TARGET_CARBON diff --git a/widget/src/mac/nsWindow.h b/widget/src/mac/nsWindow.h index a2f8c6b38dd2..997878ea7c21 100644 --- a/widget/src/mac/nsWindow.h +++ b/widget/src/mac/nsWindow.h @@ -225,8 +225,6 @@ public: // nsIKBStateControl interface NS_IMETHOD ResetInputState(); - NS_IMETHOD SetIMEOpenState(PRBool aState); - NS_IMETHOD GetIMEOpenState(PRBool* aState); protected: diff --git a/widget/src/photon/nsWidget.cpp b/widget/src/photon/nsWidget.cpp index 1e06a2d57358..4644b9d542bf 100644 --- a/widget/src/photon/nsWidget.cpp +++ b/widget/src/photon/nsWidget.cpp @@ -225,12 +225,9 @@ NS_IMETHODIMP nsWidget::ResetInputState( ) { return NS_OK; } -NS_IMETHODIMP SetIMEOpenState(PRBool aState) { - return NS_ERROR_NOT_IMPLEMENTED; - } - -NS_IMETHODIMP GetIMEOpenState(PRBool* aState) { - return NS_ERROR_NOT_IMPLEMENTED; +// to be implemented +NS_IMETHODIMP nsWidget::PasswordFieldInit( ) { + return NS_OK; } //------------------------------------------------------------------------- diff --git a/widget/src/photon/nsWidget.h b/widget/src/photon/nsWidget.h index ad49a7de9b4d..46d2fd29d895 100644 --- a/widget/src/photon/nsWidget.h +++ b/widget/src/photon/nsWidget.h @@ -213,8 +213,7 @@ public: // nsIKBStateControl NS_IMETHOD ResetInputState(); - NS_IMETHOD SetIMEOpenState(PRBool aState); - NS_IMETHOD GetIMEOpenState(PRBool* aState); + NS_IMETHOD PasswordFieldInit(); inline void InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint = nsnull) { diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index ebcd75aedd8a..c2fd1fa94b92 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -410,26 +410,6 @@ static PRBool is_vk_down(int vk) } \ } -#define NS_IMM_GETOPENSTATUS(hIMC, bRtn) \ -{ \ - if (nsToolkit::gAIMMApp) \ - bRtn = nsToolkit::gAIMMApp->GetOpenStatus(hIMC); \ - else { \ - nsIMM& theIMM = nsIMM::LoadModule(); \ - bRtn = theIMM.GetOpenStatus(hIMC); \ - } \ -} - -#define NS_IMM_SETOPENSTATUS(hIMC, bOpen) \ -{ \ - if (nsToolkit::gAIMMApp) \ - nsToolkit::gAIMMApp->SetOpenStatus(hIMC, bOpen); \ - else { \ - nsIMM& theIMM = nsIMM::LoadModule(); \ - theIMM.SetOpenStatus(hIMC, bOpen); \ - } \ -} - // // Macro for Input Method A/W conversion. // @@ -6563,36 +6543,6 @@ NS_IMETHODIMP nsWindow::ResetInputState() return NS_OK; } -//========================================================================== -NS_IMETHODIMP nsWindow::SetIMEOpenState(PRBool aState) -{ -#ifdef DEBUG_KBSTATE - printf("SetImeOpenState %s\n", (aState ? "Open" : "Close")); -#endif - HIMC hIMC; - NS_IMM_GETCONTEXT(mWnd, hIMC); - if (hIMC) { - NS_IMM_SETOPENSTATUS(hIMC, aState ? TRUE : FALSE); - NS_IMM_RELEASECONTEXT(mWnd, hIMC); - } - return NS_OK; -} - -//========================================================================== -NS_IMETHODIMP nsWindow::GetIMEOpenState(PRBool* aState) -{ - HIMC hIMC; - NS_IMM_GETCONTEXT(mWnd, hIMC); - if (hIMC) { - BOOL isOpen; - NS_IMM_GETOPENSTATUS(hIMC, isOpen); - *aState = isOpen ? PR_TRUE : PR_FALSE; - NS_IMM_RELEASECONTEXT(mWnd, hIMC); - } else - *aState = PR_FALSE; - return NS_OK; -} - #define PT_IN_RECT(pt, rc) ((pt).x>(rc).left && (pt).x <(rc).right && (pt).y>(rc).top && (pt).y<(rc).bottom) diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 18c115abb7f3..8af2877765a2 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -24,7 +24,6 @@ * Dean Tessman * Makoto Kato * Dainis Jonitis - * Masayuki Nakano * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or @@ -108,8 +107,6 @@ class nsIMM typedef LONG (CALLBACK *GetCompWindowPtr)(HIMC, LPCOMPOSITIONFORM); typedef LONG (CALLBACK *GetPropertyPtr) (HKL, DWORD); typedef LONG (CALLBACK *GetDefaultIMEWndPtr) (HWND); - typedef BOOL (CALLBACK *GetOpenStatusPtr) (HIMC); - typedef BOOL (CALLBACK *SetOpenStatusPtr) (HIMC, BOOL); public: static nsIMM& LoadModule() { @@ -150,12 +147,6 @@ public: mGetDefaultIMEWnd=(mInstance) ? (GetDefaultIMEWndPtr)GetProcAddress(mInstance, "ImmGetDefaultIMEWnd") : 0; NS_ASSERTION(mGetDefaultIMEWnd!=NULL, "nsIMM.ImmGetDefaultIMEWnd failed."); - - mGetOpenStatus=(mInstance) ? (GetOpenStatusPtr)GetProcAddress(mInstance,"ImmGetOpenStatus") : 0; - NS_ASSERTION(mGetOpenStatus!=NULL, "nsIMM.ImmGetOpenStatus failed."); - - mSetOpenStatus=(mInstance) ? (SetOpenStatusPtr)GetProcAddress(mInstance,"ImmSetOpenStatus") : 0; - NS_ASSERTION(mSetOpenStatus!=NULL, "nsIMM.ImmSetOpenStatus failed."); } ~nsIMM() { @@ -172,8 +163,6 @@ public: mSetCompositionWindow=0; mGetProperty=0; mGetDefaultIMEWnd=0; - mGetOpenStatus=0; - mSetOpenStatus=0; } LONG GetCompositionStringA(HIMC h, DWORD d1, LPVOID v, DWORD d2) { @@ -216,14 +205,6 @@ public: return (mGetDefaultIMEWnd) ? mGetDefaultIMEWnd(hWnd) : 0L; } - BOOL GetOpenStatus(HIMC h) { - return (mGetOpenStatus) ? mGetOpenStatus(h) : FALSE; - } - - BOOL SetOpenStatus(HIMC h, BOOL b) { - return (mSetOpenStatus) ? mSetOpenStatus(h,b) : FALSE; - } - private: HINSTANCE mInstance; @@ -237,8 +218,6 @@ private: GetCompWindowPtr mGetCompositionWindow; GetPropertyPtr mGetProperty; GetDefaultIMEWndPtr mGetDefaultIMEWnd; - GetOpenStatusPtr mGetOpenStatus; - SetOpenStatusPtr mSetOpenStatus; }; /** @@ -360,8 +339,6 @@ public: // nsIKBStateControl interface NS_IMETHOD ResetInputState(); - NS_IMETHOD SetIMEOpenState(PRBool aState); - NS_IMETHOD GetIMEOpenState(PRBool* aState); PRBool IMEMouseHandling(PRUint32 aEventType, PRInt32 aAction, LPARAM lParam); PRBool IMECompositionHitTest(PRUint32 aEventType, POINT * ptPos);