author | Masayuki Nakano <masayuki@d-toybox.com> |
Tue, 25 Nov 2014 14:02:30 +0900 | |
changeset 241630 | 151c7c4b14c6f3b1b09cba293453e40a81376dde |
parent 241629 | ea97c9e5d12261a223137a6f284f7fc36a9fa5f6 |
child 241631 | 4783e19c5feb9e3cd0d4ed43d07e0d0866e6babf |
push id | 4311 |
push user | raliiev@mozilla.com |
push date | Mon, 12 Jan 2015 19:37:41 +0000 |
treeherder | mozilla-beta@150c9fed433b [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 1077345 |
milestone | 36.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/events/IMEStateManager.cpp +++ b/dom/events/IMEStateManager.cpp @@ -938,17 +938,17 @@ IMEStateManager::DispatchCompositionEven // following commit events in TextComposition::DispatchEvent(). // However, if commit or cancel for a request is performed synchronously // during not safe to dispatch events, PresShell must have discarded // compositionend event. Then, the synthesized compositionend event is // the last event for the composition. In this case, we need to // destroy the TextComposition with synthesized compositionend event. if ((!aIsSynthesized || composition->WasNativeCompositionEndEventDiscarded()) && - aCompositionEvent->message == NS_COMPOSITION_END) { + aCompositionEvent->CausesDOMCompositionEndEvent()) { TextCompositionArray::index_type i = sTextCompositions->IndexOf(aCompositionEvent->widget); if (i != TextCompositionArray::NoIndex) { PR_LOG(sISMLog, PR_LOG_DEBUG, ("ISM: IMEStateManager::DispatchCompositionEvent(), " "removing TextComposition from the array since NS_COMPOSTION_END " "was dispatched")); sTextCompositions->ElementAt(i)->Destroy();
--- a/dom/events/TextComposition.cpp +++ b/dom/events/TextComposition.cpp @@ -117,17 +117,17 @@ TextComposition::OnCompositionEventDisca MOZ_ASSERT(aCompositionEvent->mFlags.mIsTrusted, "Shouldn't be called with untrusted event"); // XXX If composition events are discarded, should we dispatch them with // runnable event? However, even if we do so, it might make native IME // confused due to async modification. Especially when native IME is // TSF. - if (aCompositionEvent->message != NS_COMPOSITION_END) { + if (!aCompositionEvent->CausesDOMCompositionEndEvent()) { return; } mWasNativeCompositionEndEventDiscarded = true; } void TextComposition::DispatchCompositionEvent( @@ -180,38 +180,38 @@ TextComposition::DispatchCompositionEven mLastData != IDEOGRAPHIC_SPACE) { committingData->Assign(mLastData); } else if (mIsRequestingCancel && !committingData->IsEmpty()) { committingData->Truncate(); } } } - if (aCompositionEvent->message == NS_COMPOSITION_CHANGE) { + if (aCompositionEvent->CausesDOMTextEvent()) { if (!MaybeDispatchCompositionUpdate(aCompositionEvent)) { return; } } EventDispatcher::Dispatch(mNode, mPresContext, aCompositionEvent, nullptr, aStatus, aCallBack); if (!IsValidStateForComposition(aCompositionEvent->widget)) { return; } // Emulate editor behavior of compositionchange event (DOM text event) handler // if no editor handles composition events. - if (aCompositionEvent->message == NS_COMPOSITION_CHANGE && !HasEditor()) { + if (aCompositionEvent->CausesDOMTextEvent() && !HasEditor()) { EditorWillHandleCompositionChangeEvent(aCompositionEvent); EditorDidHandleCompositionChangeEvent(); } #ifdef DEBUG - else if (aCompositionEvent->message == NS_COMPOSITION_END) { + else if (aCompositionEvent->CausesDOMCompositionEndEvent()) { MOZ_ASSERT(!mIsComposing, "Why is the editor still composing?"); MOZ_ASSERT(!HasEditor(), "Why does the editor still keep to hold this?"); } #endif // #ifdef DEBUG // Notify composition update to widget if possible NotityUpdateComposition(aCompositionEvent); } @@ -235,17 +235,17 @@ TextComposition::NotityUpdateComposition if (selectedTextEvent.mSucceeded) { mCompositionStartOffset = selectedTextEvent.mReply.mOffset; } else { // Unknown offset NS_WARNING("Cannot get start offset of IME composition"); mCompositionStartOffset = 0; } mCompositionTargetOffset = mCompositionStartOffset; - } else if (aCompositionEvent->message == NS_COMPOSITION_CHANGE) { + } else if (aCompositionEvent->CausesDOMTextEvent()) { mCompositionTargetOffset = mCompositionStartOffset + aCompositionEvent->TargetClauseOffset(); } else { return; } NotifyIME(NOTIFY_IME_OF_COMPOSITION_UPDATE); }
--- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -1633,21 +1633,21 @@ TabParent::HandleQueryContentEvent(Widge bool TabParent::SendCompositionEvent(WidgetCompositionEvent& event) { if (mIsDestroyed) { return false; } - if (event.message == NS_COMPOSITION_CHANGE) { + if (event.CausesDOMTextEvent()) { return SendCompositionChangeEvent(event); } - mIMEComposing = event.message != NS_COMPOSITION_END; + mIMEComposing = !event.CausesDOMCompositionEndEvent(); mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus); if (mIMECompositionEnding) return true; event.mSeqno = ++mIMESeqno; return PBrowserParent::SendCompositionEvent(event); } /** @@ -1668,16 +1668,17 @@ TabParent::SendCompositionChangeEvent(Wi // We must be able to simulate the selection because // we might not receive selection updates in time if (!mIMEComposing) { mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus); } mIMESelectionAnchor = mIMESelectionFocus = mIMECompositionStart + event.mData.Length(); + mIMEComposing = !event.CausesDOMCompositionEndEvent(); event.mSeqno = ++mIMESeqno; return PBrowserParent::SendCompositionEvent(event); } bool TabParent::SendSelectionEvent(WidgetSelectionEvent& event) {
--- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -326,17 +326,18 @@ PuppetWidget::DispatchEvent(WidgetGUIEve return NS_OK; } } if (mAttachedWidgetListener) { aStatus = mAttachedWidgetListener->HandleEvent(event, mUseAttachedEvents); } - if (event->message == NS_COMPOSITION_END) { + if (event->mClass == eCompositionEventClass && + event->AsCompositionEvent()->CausesDOMCompositionEndEvent()) { mIMEComposing = false; } return NS_OK; } NS_IMETHODIMP_(bool)
--- a/widget/TextEvents.h +++ b/widget/TextEvents.h @@ -337,16 +337,26 @@ public: { return mRanges ? mRanges->TargetClauseOffset() : 0; } uint32_t RangeCount() const { return mRanges ? mRanges->Length() : 0; } + + bool CausesDOMTextEvent() const + { + return message == NS_COMPOSITION_CHANGE; + } + + bool CausesDOMCompositionEndEvent() const + { + return message == NS_COMPOSITION_END; + } }; /****************************************************************************** * mozilla::WidgetQueryContentEvent ******************************************************************************/ class WidgetQueryContentEvent : public WidgetGUIEvent {