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

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

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

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

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

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

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

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

@ -164,16 +164,6 @@
#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 */
/* ======================================================================= */