Bug 544779 part.2 Remove WM_USER_TSF_TEXTCHANGE from nsTextStore r=m_kato

This commit is contained in:
Masayuki Nakano 2014-01-23 17:01:16 +09:00
parent a65685009d
commit e84d2b30a2
2 changed files with 21 additions and 49 deletions

View File

@ -525,8 +525,6 @@ nsTextStore::nsTextStore()
mSinkMask = 0;
mLock = 0;
mLockQueued = 0;
mTextChange.acpStart = INT32_MAX;
mTextChange.acpOldEnd = mTextChange.acpNewEnd = 0;
mInputScopeDetected = false;
mInputScopeRequested = false;
mIsRecordingActionsWithoutLock = false;
@ -3067,11 +3065,9 @@ nsTextStore::OnTextChangeInternal(uint32_t aStart,
{
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
("TSF: 0x%p nsTextStore::OnTextChangeInternal(aStart=%lu, "
"aOldEnd=%lu, aNewEnd=%lu), mSink=0x%p, mSinkMask=%s, "
"mTextChange={ acpStart=%ld, acpOldEnd=%ld, acpNewEnd=%ld }",
"aOldEnd=%lu, aNewEnd=%lu), mSink=0x%p, mSinkMask=%s",
this, aStart, aOldEnd, aNewEnd, mSink.get(),
GetSinkMaskNameStr(mSinkMask).get(), mTextChange.acpStart,
mTextChange.acpOldEnd, mTextChange.acpNewEnd));
GetSinkMaskNameStr(mSinkMask).get()));
if (IsReadLocked()) {
return NS_OK;
@ -3081,39 +3077,29 @@ nsTextStore::OnTextChangeInternal(uint32_t aStart,
mSelection.MarkDirty();
if (mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE)) {
mTextChange.acpStart = std::min(mTextChange.acpStart, LONG(aStart));
mTextChange.acpOldEnd = std::max(mTextChange.acpOldEnd, LONG(aOldEnd));
mTextChange.acpNewEnd = std::max(mTextChange.acpNewEnd, LONG(aNewEnd));
::PostMessageW(mWidget->GetWindowHandle(),
WM_USER_TSF_TEXTCHANGE, 0, 0);
if (aStart >= INT32_MAX || aOldEnd >= INT32_MAX || aNewEnd >= INT32_MAX) {
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
("TSF: 0x%p nsTextStore::OnTextChangeInternal() FAILED due to "
"offset is too big for calling mSink->OnTextChange()...",
this));
return NS_OK;
}
TS_TEXTCHANGE textChange;
textChange.acpStart = static_cast<LONG>(aStart);
textChange.acpOldEnd = static_cast<LONG>(aOldEnd);
textChange.acpNewEnd = static_cast<LONG>(aNewEnd);
PR_LOG(sTextStoreLog, PR_LOG_ALWAYS,
("TSF: 0x%p nsTextStore::OnTextChangeInternal(), calling"
"mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, "
"acpNewEnd=%ld })...", this, textChange.acpStart,
textChange.acpOldEnd, textChange.acpNewEnd));
mSink->OnTextChange(0, &textChange);
}
return NS_OK;
}
void
nsTextStore::OnTextChangeMsg()
{
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
("TSF: 0x%p nsTextStore::OnTextChangeMsg(), "
"mSink=0x%p, mSinkMask=%s, mTextChange={ acpStart=%ld, "
"acpOldEnd=%ld, acpNewEnd=%ld }",
this, mSink.get(),
GetSinkMaskNameStr(mSinkMask).get(), mTextChange.acpStart,
mTextChange.acpOldEnd, mTextChange.acpNewEnd));
if (!mLock && mSink && 0 != (mSinkMask & TS_AS_TEXT_CHANGE) &&
INT32_MAX > mTextChange.acpStart) {
PR_LOG(sTextStoreLog, PR_LOG_ALWAYS,
("TSF: 0x%p nsTextStore::OnTextChangeMsg(), calling"
"mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, "
"acpNewEnd=%ld })...", this, mTextChange.acpStart,
mTextChange.acpOldEnd, mTextChange.acpNewEnd));
mSink->OnTextChange(0, &mTextChange);
mTextChange.acpStart = INT32_MAX;
mTextChange.acpOldEnd = mTextChange.acpNewEnd = 0;
}
}
nsresult
nsTextStore::OnSelectionChangeInternal(void)
{
@ -3599,12 +3585,6 @@ nsTextStore::ProcessMessage(nsWindowBase* aWindow, UINT aMessage,
"mIsIMM_IME=%s", aWindow, aWParam, aLParam,
GetBoolName(sTsfTextStore->mIsIMM_IME)));
break;
case WM_USER_TSF_TEXTCHANGE:
NS_ENSURE_TRUE_VOID(sTsfTextStore);
sTsfTextStore->OnTextChangeMsg();
aResult.mConsumed = true;
break;
}
}

View File

@ -44,11 +44,6 @@ struct MSGResult;
} // namespace widget
} // namespace mozilla
// It doesn't work well when we notify TSF of text change
// during a mutation observer call because things get broken.
// So we post a message and notify TSF when we get it later.
#define WM_USER_TSF_TEXTCHANGE (WM_USER + 0x100)
/*
* Text Services Framework text store
*/
@ -246,7 +241,6 @@ protected:
TS_TEXTCHANGE* aTextChange);
void CommitCompositionInternal(bool);
nsresult OnTextChangeInternal(uint32_t, uint32_t, uint32_t);
void OnTextChangeMsg();
nsresult OnSelectionChangeInternal(void);
HRESULT GetDisplayAttribute(ITfProperty* aProperty,
ITfRange* aRange,
@ -289,8 +283,6 @@ protected:
DWORD mLock;
// 0 if no lock is queued, otherwise TS_LF_* indicating the queue lock
DWORD mLockQueued;
// Cumulative text change offsets since the last notification
TS_TEXTCHANGE mTextChange;
class Composition MOZ_FINAL
{