Bug 805357 part.2 Get rid of NS_SUCCESS_IME_NO_UPDATES since OnIMEFocusChange(false) is always called r=roc

This commit is contained in:
Masayuki Nakano 2012-10-31 08:22:23 +09:00
Родитель adc6bfb320
Коммит 7025df1d0e
5 изменённых файлов: 6 добавлений и 28 удалений

Просмотреть файл

@ -60,8 +60,7 @@ public:
nsresult Init(nsIWidget* aWidget, nsresult Init(nsIWidget* aWidget,
nsPresContext* aPresContext, nsPresContext* aPresContext,
nsINode* aNode, nsINode* aNode);
bool aWantUpdates);
void Destroy(void); void Destroy(void);
bool IsManaging(nsPresContext* aPresContext, nsIContent* aContent); bool IsManaging(nsPresContext* aPresContext, nsIContent* aContent);
@ -675,15 +674,10 @@ nsTextStateManager::nsTextStateManager()
nsresult nsresult
nsTextStateManager::Init(nsIWidget* aWidget, nsTextStateManager::Init(nsIWidget* aWidget,
nsPresContext* aPresContext, nsPresContext* aPresContext,
nsINode* aNode, nsINode* aNode)
bool aWantUpdates)
{ {
mWidget = aWidget; mWidget = aWidget;
MOZ_ASSERT(mWidget); MOZ_ASSERT(mWidget);
if (!aWantUpdates) {
mEditableNode = aNode;
return NS_OK;
}
nsIPresShell* presShell = aPresContext->PresShell(); nsIPresShell* presShell = aPresContext->PresShell();
@ -1012,8 +1006,6 @@ nsIMEStateManager::CreateTextStateManager()
return; return;
NS_ENSURE_SUCCESS_VOID(rv); NS_ENSURE_SUCCESS_VOID(rv);
bool wantUpdates = rv != NS_SUCCESS_IME_NO_UPDATES;
// OnIMEFocusChange may cause focus and sTextStateObserver to change // OnIMEFocusChange may cause focus and sTextStateObserver to change
// In that case return and keep the current sTextStateObserver // In that case return and keep the current sTextStateObserver
NS_ENSURE_TRUE_VOID(!sTextStateObserver); NS_ENSURE_TRUE_VOID(!sTextStateObserver);
@ -1021,8 +1013,7 @@ nsIMEStateManager::CreateTextStateManager()
sTextStateObserver = new nsTextStateManager(); sTextStateObserver = new nsTextStateManager();
NS_ENSURE_TRUE_VOID(sTextStateObserver); NS_ENSURE_TRUE_VOID(sTextStateObserver);
NS_ADDREF(sTextStateObserver); NS_ADDREF(sTextStateObserver);
rv = sTextStateObserver->Init(widget, sPresContext, rv = sTextStateObserver->Init(widget, sPresContext, editableNode);
editableNode, wantUpdates);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
return; return;
} }

Просмотреть файл

@ -525,7 +525,7 @@ TabParent::RecvNotifyIMEFocus(const bool& aFocus,
nsresult rv = widget->OnIMEFocusChange(aFocus); nsresult rv = widget->OnIMEFocusChange(aFocus);
if (aFocus) { if (aFocus) {
if (NS_SUCCEEDED(rv) && rv != NS_SUCCESS_IME_NO_UPDATES) { if (NS_SUCCEEDED(rv)) {
*aPreference = widget->GetIMEUpdatePreference(); *aPreference = widget->GetIMEUpdatePreference();
} else { } else {
aPreference->mWantUpdates = false; aPreference->mWantUpdates = false;

Просмотреть файл

@ -1494,10 +1494,7 @@ class nsIWidget : public nsISupports {
* aFocus is false if node is giving up focus (blur) * aFocus is false if node is giving up focus (blur)
* *
* If this returns NS_ERROR_*, OnIMETextChange and OnIMESelectionChange * If this returns NS_ERROR_*, OnIMETextChange and OnIMESelectionChange
* and OnIMEFocusChange(false) will be never called. * will be never called.
*
* If this returns NS_SUCCESS_IME_NO_UPDATES, OnIMEFocusChange(false)
* will be called but OnIMETextChange and OnIMESelectionChange will NOT.
*/ */
NS_IMETHOD OnIMEFocusChange(bool aFocus) = 0; NS_IMETHOD OnIMEFocusChange(bool aFocus) = 0;

Просмотреть файл

@ -422,7 +422,7 @@ PuppetWidget::OnIMEFocusChange(bool aFocus)
if (aFocus) { if (aFocus) {
if (!mIMEPreference.mWantUpdates && !mIMEPreference.mWantHints) if (!mIMEPreference.mWantUpdates && !mIMEPreference.mWantHints)
// call OnIMEFocusChange on blur but no other updates // call OnIMEFocusChange on blur but no other updates
return NS_SUCCESS_IME_NO_UPDATES; return NS_ERROR_NOT_IMPLEMENTED;
OnIMESelectionChange(); // Update selection OnIMESelectionChange(); // Update selection
} else { } else {
mIMELastBlurSeqno = chromeSeqno; mIMELastBlurSeqno = chromeSeqno;

Просмотреть файл

@ -164,16 +164,6 @@
#undef MODULE #undef MODULE
/* ======================================================================= */
/* 4: NS_ERROR_MODULE_WIDGET */
/* ======================================================================= */
#define MODULE NS_ERROR_MODULE_WIDGET
/* nsIWidget::OnIMEFocusChange should be called during blur, but other
* OnIME*Change methods should not be called */
ERROR(NS_SUCCESS_IME_NO_UPDATES, SUCCESS(1)),
#undef MODULE
/* ======================================================================= */ /* ======================================================================= */
/* 6: NS_ERROR_MODULE_NETWORK */ /* 6: NS_ERROR_MODULE_NETWORK */
/* ======================================================================= */ /* ======================================================================= */