зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1275906 part.1 Rename NOTIFY_IME_OF_COMPOSITION_UPDATE to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED r=m_kato
It's not clear to me what NOTIFY_IME_OF_COMPOSITION_UPDATE means only from the name. For making the name clearer, this patch renames it to NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED and add some explanation to the definition. MozReview-Commit-ID: 8ySYCNJ1Ytz --HG-- extra : rebase_source : 3331b8f48e8b460c7f9b088064dcda9488f3403c
This commit is contained in:
Родитель
704cee440f
Коммит
e67330e0b4
|
@ -48,35 +48,6 @@ ToChar(bool aBool)
|
|||
return aBool ? "true" : "false";
|
||||
}
|
||||
|
||||
static const char*
|
||||
ToChar(IMEMessage aIMEMessage)
|
||||
{
|
||||
switch (aIMEMessage) {
|
||||
case NOTIFY_IME_OF_NOTHING:
|
||||
return "NOTIFY_IME_OF_NOTHING";
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return "NOTIFY_IME_OF_FOCUS";
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return "NOTIFY_IME_OF_BLUR";
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
return "NOTIFY_IME_OF_SELECTION_CHANGE";
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
return "NOTIFY_IME_OF_TEXT_CHANGE";
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
return "NOTIFY_IME_OF_POSITION_CHANGE";
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
return "REQUEST_TO_COMMIT_COMPOSITION";
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
return "REQUEST_TO_CANCEL_COMPOSITION";
|
||||
default:
|
||||
return "Unexpected value";
|
||||
}
|
||||
}
|
||||
|
||||
class WritingModeToString final : public nsAutoCString
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -135,33 +135,6 @@ GetIMEStateSetOpenName(IMEState::Open aOpen)
|
|||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetNotifyIMEMessageName(IMEMessage aMessage)
|
||||
{
|
||||
switch (aMessage) {
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return "NOTIFY_IME_OF_FOCUS";
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return "NOTIFY_IME_OF_BLUR";
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
return "NOTIFY_IME_OF_SELECTION_CHANGE";
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
return "NOTIFY_IME_OF_TEXT_CHANGE";
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
return "NOTIFY_IME_OF_POSITION_CHANGE";
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
return "REQUEST_TO_COMMIT_COMPOSITION";
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
return "REQUEST_TO_CANCEL_COMPOSITION";
|
||||
default:
|
||||
return "unacceptable IME notification message";
|
||||
}
|
||||
}
|
||||
|
||||
StaticRefPtr<nsIContent> IMEStateManager::sContent;
|
||||
nsPresContext* IMEStateManager::sPresContext = nullptr;
|
||||
nsIWidget* IMEStateManager::sFocusedIMEWidget = nullptr;
|
||||
|
@ -1353,7 +1326,7 @@ IMEStateManager::NotifyIME(const IMENotification& aNotification,
|
|||
("ISM: IMEStateManager::NotifyIME(aNotification={ mMessage=%s }, "
|
||||
"aWidget=0x%p, aOriginIsRemote=%s), sFocusedIMEWidget=0x%p, "
|
||||
"sRemoteHasFocus=%s",
|
||||
GetNotifyIMEMessageName(aNotification.mMessage), aWidget,
|
||||
ToChar(aNotification.mMessage), aWidget,
|
||||
GetBoolName(aOriginIsRemote), sFocusedIMEWidget,
|
||||
GetBoolName(sRemoteHasFocus)));
|
||||
|
||||
|
@ -1477,7 +1450,7 @@ IMEStateManager::NotifyIME(const IMENotification& aNotification,
|
|||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
return composition ?
|
||||
composition->RequestToCommit(aWidget, true) : NS_OK;
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
if (!aOriginIsRemote && (!composition || isSynthesizedForTests)) {
|
||||
MOZ_LOG(sISMLog, LogLevel::Info,
|
||||
("ISM: IMEStateManager::NotifyIME(), FAILED, received content "
|
||||
|
@ -1508,8 +1481,7 @@ IMEStateManager::NotifyIME(IMEMessage aMessage,
|
|||
MOZ_LOG(sISMLog, LogLevel::Info,
|
||||
("ISM: IMEStateManager::NotifyIME(aMessage=%s, aPresContext=0x%p, "
|
||||
"aOriginIsRemote=%s)",
|
||||
GetNotifyIMEMessageName(aMessage), aPresContext,
|
||||
GetBoolName(aOriginIsRemote)));
|
||||
ToChar(aMessage), aPresContext, GetBoolName(aOriginIsRemote)));
|
||||
|
||||
NS_ENSURE_TRUE(aPresContext, NS_ERROR_INVALID_ARG);
|
||||
|
||||
|
|
|
@ -456,7 +456,7 @@ TextComposition::NotityUpdateComposition(
|
|||
return;
|
||||
}
|
||||
|
||||
NotifyIME(NOTIFY_IME_OF_COMPOSITION_UPDATE);
|
||||
NotifyIME(NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -29,28 +29,7 @@ GetNotificationName(const IMENotification* aNotification)
|
|||
if (!aNotification) {
|
||||
return "Not notification";
|
||||
}
|
||||
switch (aNotification->mMessage) {
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return "NOTIFY_IME_OF_FOCUS";
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return "NOTIFY_IME_OF_BLUR";
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
return "NOTIFY_IME_OF_SELECTION_CHANGE";
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
return "NOTIFY_IME_OF_TEXT_CHANGE";
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
return "NOTIFY_IME_OF_COMPOSITION_UPDATE";
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
return "NOTIFY_IME_OF_POSITION_CHANGE";
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
return "REQUEST_TO_COMMIT_COMPOSITION";
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
return "REQUEST_TO_CANCEL_COMPOSITION";
|
||||
default:
|
||||
return "Unsupported notification";
|
||||
}
|
||||
return ToChar(aNotification->mMessage);
|
||||
}
|
||||
|
||||
class GetRectText : public nsAutoCString
|
||||
|
@ -991,7 +970,7 @@ ContentCacheInParent::MaybeNotifyIME(nsIWidget* aWidget,
|
|||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
mPendingLayoutChange.MergeWith(aNotification);
|
||||
break;
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
mPendingCompositionUpdate.MergeWith(aNotification);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -441,8 +441,13 @@ enum IMEMessage : IMEMessageType
|
|||
NOTIFY_IME_OF_SELECTION_CHANGE,
|
||||
// Text in the focused editable content is changed
|
||||
NOTIFY_IME_OF_TEXT_CHANGE,
|
||||
// Composition string has been updated
|
||||
NOTIFY_IME_OF_COMPOSITION_UPDATE,
|
||||
// Notified when a dispatched composition event is handled by the
|
||||
// contents. This must be notified after the other notifications.
|
||||
// Note that if a remote process has focus, this is notified only once when
|
||||
// all dispatched events are handled completely. So, the receiver shouldn't
|
||||
// count number of received this notification for comparing with the number
|
||||
// of dispatched events.
|
||||
NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED,
|
||||
// Position or size of focused element may be changed.
|
||||
NOTIFY_IME_OF_POSITION_CHANGE,
|
||||
// Mouse button event is fired on a character in focused editor
|
||||
|
@ -455,6 +460,9 @@ enum IMEMessage : IMEMessageType
|
|||
REQUEST_TO_CANCEL_COMPOSITION
|
||||
};
|
||||
|
||||
// FYI: Implemented in nsBaseWidget.cpp
|
||||
const char* ToChar(IMEMessage aIMEMessage);
|
||||
|
||||
struct IMENotification final
|
||||
{
|
||||
IMENotification()
|
||||
|
@ -560,7 +568,7 @@ struct IMENotification final
|
|||
mTextChangeData += aNotification.mTextChangeData;
|
||||
break;
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
MOZ_ASSERT(aNotification.mMessage == mMessage);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -641,7 +641,7 @@ PuppetWidget::NotifyIMEInternal(const IMENotification& aIMENotification)
|
|||
return NotifyIMEOfSelectionChange(aIMENotification);
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
return NotifyIMEOfTextChange(aIMENotification);
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
return NotifyIMEOfCompositionUpdate(aIMENotification);
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
return NotifyIMEOfMouseButtonEvent(aIMENotification);
|
||||
|
|
|
@ -301,7 +301,7 @@ IMContextWrapper::NotifyIME(TextEventDispatcher* aTextEventDispatcher,
|
|||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
OnLayoutChange();
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
OnUpdateComposition();
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE: {
|
||||
|
@ -989,7 +989,8 @@ IMContextWrapper::OnSelectionChange(nsWindow* aCaller,
|
|||
|
||||
if (!IsComposing()) {
|
||||
// Now we have no composition (mostly situation on calling this method)
|
||||
// If we have it, it will set by NOTIFY_IME_OF_COMPOSITION_UPDATE.
|
||||
// If we have it, it will set by
|
||||
// NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.
|
||||
mSetCursorPositionOnKeyEvent = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -2146,6 +2146,35 @@ nsIWidget::OnWindowedPluginKeyEvent(const NativeEventData& aKeyEventData,
|
|||
namespace mozilla {
|
||||
namespace widget {
|
||||
|
||||
const char*
|
||||
ToChar(IMEMessage aIMEMessage)
|
||||
{
|
||||
switch (aIMEMessage) {
|
||||
case NOTIFY_IME_OF_NOTHING:
|
||||
return "NOTIFY_IME_OF_NOTHING";
|
||||
case NOTIFY_IME_OF_FOCUS:
|
||||
return "NOTIFY_IME_OF_FOCUS";
|
||||
case NOTIFY_IME_OF_BLUR:
|
||||
return "NOTIFY_IME_OF_BLUR";
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
return "NOTIFY_IME_OF_SELECTION_CHANGE";
|
||||
case NOTIFY_IME_OF_TEXT_CHANGE:
|
||||
return "NOTIFY_IME_OF_TEXT_CHANGE";
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
return "NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED";
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
return "NOTIFY_IME_OF_POSITION_CHANGE";
|
||||
case NOTIFY_IME_OF_MOUSE_BUTTON_EVENT:
|
||||
return "NOTIFY_IME_OF_MOUSE_BUTTON_EVENT";
|
||||
case REQUEST_TO_COMMIT_COMPOSITION:
|
||||
return "REQUEST_TO_COMMIT_COMPOSITION";
|
||||
case REQUEST_TO_CANCEL_COMPOSITION:
|
||||
return "REQUEST_TO_CANCEL_COMPOSITION";
|
||||
default:
|
||||
return "Unexpected value";
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
NativeIMEContext::Init(nsIWidget* aWidget)
|
||||
{
|
||||
|
|
|
@ -1972,8 +1972,8 @@ IMMHandler::DispatchCompositionChangeEvent(nsWindow* aWindow,
|
|||
|
||||
// NOTE: Calling SetIMERelatedWindowsPos() from this method will be failure
|
||||
// in e10s mode. compositionchange event will notify this of
|
||||
// NOTIFY_IME_OF_COMPOSITION_UPDATE, then SetIMERelatedWindowsPos()
|
||||
// will be called.
|
||||
// NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED, then
|
||||
// SetIMERelatedWindowsPos() will be called.
|
||||
|
||||
// XXX Sogou (Simplified Chinese IME) returns contradictory values:
|
||||
// The cursor position is actual cursor position. However, other values
|
||||
|
|
|
@ -1621,9 +1621,9 @@ TSFTextStore::FlushPendingActions()
|
|||
}
|
||||
}
|
||||
|
||||
// eCompositionStart always causes NOTIFY_IME_OF_COMPOSITION_UPDATE.
|
||||
// Therefore, we should wait to clear the locked content until it's
|
||||
// notified.
|
||||
// eCompositionStart always causes
|
||||
// NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED. Therefore, we should
|
||||
// wait to clear the locked content until it's notified.
|
||||
mDeferClearingLockedContent = true;
|
||||
|
||||
MOZ_LOG(sTextStoreLog, LogLevel::Debug,
|
||||
|
@ -1652,9 +1652,9 @@ TSFTextStore::FlushPendingActions()
|
|||
action.mRanges ? action.mRanges->Length() : 0));
|
||||
|
||||
// eCompositionChange causes a DOM text event, the IME will be notified
|
||||
// of NOTIFY_IME_OF_COMPOSITION_UPDATE. In this case, we should not
|
||||
// clear the locked content until we notify the IME of the composition
|
||||
// update.
|
||||
// of NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED. In this case, we
|
||||
// should not clear the locked content until we notify the IME of the
|
||||
// composition update.
|
||||
mDeferClearingLockedContent = true;
|
||||
|
||||
rv = mDispatcher->SetPendingComposition(action.mData,
|
||||
|
@ -1688,8 +1688,8 @@ TSFTextStore::FlushPendingActions()
|
|||
this, NS_ConvertUTF16toUTF8(action.mData).get()));
|
||||
|
||||
// Dispatching eCompositionCommit causes a DOM text event, then,
|
||||
// the IME will be notified of NOTIFY_IME_OF_COMPOSITION_UPDATE. In
|
||||
// this case, we should not clear the locked content until we notify
|
||||
// the IME will be notified of NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED.
|
||||
// In this case, we should not clear the locked content until we notify
|
||||
// the IME of the composition update.
|
||||
mDeferClearingLockedContent = true;
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
|
|||
IMMHandler::OnSelectionChange(aWindow, aIMENotification, isIMMActive);
|
||||
return rv;
|
||||
}
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
// If IMM IME is active, we need to notify IMMHandler of updating
|
||||
// composition change. It will adjust candidate window position or
|
||||
// composition window position.
|
||||
|
@ -302,7 +302,7 @@ IMEHandler::NotifyIME(nsWindow* aWindow,
|
|||
IMMHandler::CancelComposition(aWindow);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_POSITION_CHANGE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_UPDATE:
|
||||
case NOTIFY_IME_OF_COMPOSITION_EVENT_HANDLED:
|
||||
IMMHandler::OnUpdateComposition(aWindow);
|
||||
return NS_OK;
|
||||
case NOTIFY_IME_OF_SELECTION_CHANGE:
|
||||
|
|
Загрузка…
Ссылка в новой задаче