From aa08b619133f11e9af494bb9e524ff82006206b1 Mon Sep 17 00:00:00 2001 From: "masayuki%d-toybox.com" Date: Fri, 8 Feb 2008 17:58:10 +0000 Subject: [PATCH] Bug 415026 IME is always enabled in a page has contentEditable=true r+sr=roc, a1.9=mtschrep git-svn-id: svn://10.0.0.236/trunk@245235 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/public/nsIContent.h | 12 +++++++++++- mozilla/content/events/src/nsIMEStateManager.cpp | 16 ++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/mozilla/content/base/public/nsIContent.h b/mozilla/content/base/public/nsIContent.h index fa951c07d40..9d481d8123a 100644 --- a/mozilla/content/base/public/nsIContent.h +++ b/mozilla/content/base/public/nsIContent.h @@ -520,7 +520,17 @@ public: }; virtual PRUint32 GetDesiredIMEState() { - return IME_STATUS_DISABLE; + if (!HasFlag(NODE_IS_EDITABLE)) + return IME_STATUS_DISABLE; + nsIContent *editableAncestor = nsnull; + for (nsIContent* parent = GetParent(); + parent && parent->HasFlag(NODE_IS_EDITABLE); + parent = parent->GetParent()) + editableAncestor = parent; + // This is in another editable content, use the result of it. + if (editableAncestor) + return editableAncestor->GetDesiredIMEState(); + return IME_STATUS_ENABLE; } /** diff --git a/mozilla/content/events/src/nsIMEStateManager.cpp b/mozilla/content/events/src/nsIMEStateManager.cpp index ec861a1bf61..1a53604a00b 100755 --- a/mozilla/content/events/src/nsIMEStateManager.cpp +++ b/mozilla/content/events/src/nsIMEStateManager.cpp @@ -237,22 +237,10 @@ nsIMEStateManager::GetNewIMEState(nsPresContext* aPresContext, return nsIContent::IME_STATUS_DISABLE; } - if (sInstalledMenuKeyboardListener) + if (sInstalledMenuKeyboardListener || !aContent) return nsIContent::IME_STATUS_DISABLE; - PRBool isEditable = PR_FALSE; - nsCOMPtr container = aPresContext->GetContainer(); - nsCOMPtr editorDocShell(do_QueryInterface(container)); - if (editorDocShell) - editorDocShell->GetEditable(&isEditable); - - if (isEditable) - return nsIContent::IME_STATUS_ENABLE; - - if (aContent) - return aContent->GetDesiredIMEState(); - - return nsIContent::IME_STATUS_DISABLE; + return aContent->GetDesiredIMEState(); } void