mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 920377 part.22 Get rid of nsCompositionEvent r=roc
This commit is contained in:
parent
3e4559711b
commit
b809719e9d
@ -51,7 +51,7 @@ TextComposition::DispatchEvent(nsGUIEvent* aEvent,
|
||||
nsDispatchingCallback* aCallBack)
|
||||
{
|
||||
if (aEvent->message == NS_COMPOSITION_UPDATE) {
|
||||
mLastData = static_cast<nsCompositionEvent*>(aEvent)->data;
|
||||
mLastData = static_cast<WidgetCompositionEvent*>(aEvent)->data;
|
||||
}
|
||||
|
||||
nsEventDispatcher::Dispatch(mNode, mPresContext,
|
||||
@ -114,7 +114,7 @@ TextComposition::CompositionEventDispatcher::Run()
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
switch (mEventMessage) {
|
||||
case NS_COMPOSITION_START: {
|
||||
nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
|
||||
WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
|
||||
nsQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT, mWidget);
|
||||
nsContentEventHandler handler(mPresContext);
|
||||
handler.OnQuerySelectedText(&selectedText);
|
||||
@ -126,7 +126,7 @@ TextComposition::CompositionEventDispatcher::Run()
|
||||
}
|
||||
case NS_COMPOSITION_UPDATE:
|
||||
case NS_COMPOSITION_END: {
|
||||
nsCompositionEvent compEvent(true, mEventMessage, mWidget);
|
||||
WidgetCompositionEvent compEvent(true, mEventMessage, mWidget);
|
||||
compEvent.data = mData;
|
||||
nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
|
||||
&compEvent, &status, nullptr);
|
||||
|
@ -8,11 +8,13 @@
|
||||
#include "prtime.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
nsCompositionEvent* aEvent)
|
||||
WidgetCompositionEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new nsCompositionEvent(false, 0, nullptr))
|
||||
new WidgetCompositionEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
|
||||
"event type mismatch");
|
||||
@ -29,14 +31,14 @@ nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
mEvent->mFlags.mCancelable = false;
|
||||
}
|
||||
|
||||
mData = static_cast<nsCompositionEvent*>(mEvent)->data;
|
||||
mData = static_cast<WidgetCompositionEvent*>(mEvent)->data;
|
||||
// TODO: Native event should have locale information.
|
||||
}
|
||||
|
||||
nsDOMCompositionEvent::~nsDOMCompositionEvent()
|
||||
{
|
||||
if (mEventIsInternal) {
|
||||
delete static_cast<nsCompositionEvent*>(mEvent);
|
||||
delete static_cast<WidgetCompositionEvent*>(mEvent);
|
||||
mEvent = nullptr;
|
||||
}
|
||||
}
|
||||
@ -83,7 +85,7 @@ nsresult
|
||||
NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
nsCompositionEvent *aEvent)
|
||||
WidgetCompositionEvent* aEvent)
|
||||
{
|
||||
nsDOMCompositionEvent* event =
|
||||
new nsDOMCompositionEvent(aOwner, aPresContext, aEvent);
|
||||
|
@ -18,7 +18,7 @@ class nsDOMCompositionEvent : public nsDOMUIEvent,
|
||||
public:
|
||||
nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
nsCompositionEvent* aEvent);
|
||||
mozilla::WidgetCompositionEvent* aEvent);
|
||||
virtual ~nsDOMCompositionEvent();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -594,10 +594,10 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_COMPOSITION_EVENT:
|
||||
{
|
||||
nsCompositionEvent* compositionEvent =
|
||||
new nsCompositionEvent(false, msg, nullptr);
|
||||
nsCompositionEvent* oldCompositionEvent =
|
||||
static_cast<nsCompositionEvent*>(mEvent);
|
||||
WidgetCompositionEvent* compositionEvent =
|
||||
new WidgetCompositionEvent(false, msg, nullptr);
|
||||
WidgetCompositionEvent* oldCompositionEvent =
|
||||
static_cast<WidgetCompositionEvent*>(mEvent);
|
||||
compositionEvent->AssignCompositionEventData(*oldCompositionEvent, true);
|
||||
newEvent = compositionEvent;
|
||||
break;
|
||||
|
@ -707,7 +707,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
case NS_COMPOSITION_EVENT:
|
||||
return NS_NewDOMCompositionEvent(
|
||||
aDOMEvent, aOwner,
|
||||
aPresContext, static_cast<nsCompositionEvent*>(aEvent));
|
||||
aPresContext, static_cast<WidgetCompositionEvent*>(aEvent));
|
||||
case NS_MOUSE_EVENT:
|
||||
return NS_NewDOMMouseEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<nsInputEvent*>(aEvent));
|
||||
|
@ -1098,8 +1098,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (aEvent->mFlags.mIsTrusted) {
|
||||
// If the event is trusted event, set the selected text to data of
|
||||
// composition event.
|
||||
nsCompositionEvent *compositionEvent =
|
||||
static_cast<nsCompositionEvent*>(aEvent);
|
||||
WidgetCompositionEvent *compositionEvent =
|
||||
static_cast<WidgetCompositionEvent*>(aEvent);
|
||||
nsQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
|
||||
compositionEvent->widget);
|
||||
DoQuerySelectedText(&selectedText);
|
||||
@ -1110,8 +1110,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
case NS_COMPOSITION_UPDATE:
|
||||
case NS_COMPOSITION_END:
|
||||
{
|
||||
nsCompositionEvent *compositionEvent =
|
||||
static_cast<nsCompositionEvent*>(aEvent);
|
||||
WidgetCompositionEvent *compositionEvent =
|
||||
static_cast<WidgetCompositionEvent*>(aEvent);
|
||||
if (IsTargetCrossProcess(compositionEvent)) {
|
||||
// Will not be handled locally, remote the event
|
||||
if (GetCrossProcessTarget()->SendCompositionEvent(*compositionEvent)) {
|
||||
|
@ -609,7 +609,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
||||
}
|
||||
|
||||
status = nsEventStatus_eIgnore;
|
||||
nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
|
||||
WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
|
||||
endEvent.data = backup.GetLastData();
|
||||
endEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&endEvent, status);
|
||||
@ -622,7 +622,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
if (!backup.GetLastData().IsEmpty()) {
|
||||
nsCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
|
||||
WidgetCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
|
||||
updateEvent.data = backup.GetLastData();
|
||||
updateEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&updateEvent, status);
|
||||
@ -641,7 +641,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
|
||||
}
|
||||
|
||||
status = nsEventStatus_eIgnore;
|
||||
nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
|
||||
WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
|
||||
endEvent.data = backup.GetLastData();
|
||||
endEvent.mFlags.mIsSynthesizedForTests = true;
|
||||
widget->DispatchEvent(&endEvent, status);
|
||||
|
@ -1824,7 +1824,7 @@ nsDOMWindowUtils::SendCompositionEvent(const nsAString& aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCompositionEvent compositionEvent(true, msg, widget);
|
||||
WidgetCompositionEvent compositionEvent(true, msg, widget);
|
||||
InitEvent(compositionEvent);
|
||||
if (msg != NS_COMPOSITION_START) {
|
||||
compositionEvent.data = aData;
|
||||
|
@ -278,7 +278,7 @@ nsresult
|
||||
NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
nsCompositionEvent* aEvent);
|
||||
mozilla::WidgetCompositionEvent* aEvent);
|
||||
nsresult
|
||||
NS_NewDOMMutationEvent(nsIDOMEvent** aResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
|
@ -36,7 +36,7 @@ using mozilla::layout::ScrollingBehavior;
|
||||
using mozilla::void_t;
|
||||
using mozilla::WindowsHandle;
|
||||
using nscolor;
|
||||
using nsCompositionEvent;
|
||||
using mozilla::WidgetCompositionEvent;
|
||||
using nsIMEUpdatePreference;
|
||||
using nsIntPoint;
|
||||
using nsIntRect;
|
||||
@ -381,7 +381,7 @@ child:
|
||||
int32_t aModifiers,
|
||||
bool aPreventDefault);
|
||||
|
||||
CompositionEvent(nsCompositionEvent event);
|
||||
CompositionEvent(WidgetCompositionEvent event);
|
||||
|
||||
TextEvent(WidgetTextEvent event);
|
||||
|
||||
|
@ -1882,9 +1882,9 @@ TabChild::RecvKeyEvent(const nsString& aType,
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvCompositionEvent(const nsCompositionEvent& event)
|
||||
TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
|
||||
{
|
||||
nsCompositionEvent localEvent(event);
|
||||
WidgetCompositionEvent localEvent(event);
|
||||
DispatchWidgetEvent(localEvent);
|
||||
return true;
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ public:
|
||||
const int32_t& aCharCode,
|
||||
const int32_t& aModifiers,
|
||||
const bool& aPreventDefault);
|
||||
virtual bool RecvCompositionEvent(const nsCompositionEvent& event);
|
||||
virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event);
|
||||
virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event);
|
||||
virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
|
||||
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
|
||||
|
@ -985,7 +985,7 @@ TabParent::HandleQueryContentEvent(nsQueryContentEvent& aEvent)
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::SendCompositionEvent(nsCompositionEvent& event)
|
||||
TabParent::SendCompositionEvent(WidgetCompositionEvent& event)
|
||||
{
|
||||
if (mIsDestroyed) {
|
||||
return false;
|
||||
|
@ -225,7 +225,7 @@ public:
|
||||
|
||||
static TabParent *GetIMETabParent() { return mIMETabParent; }
|
||||
bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
|
||||
bool SendCompositionEvent(nsCompositionEvent& event);
|
||||
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& event);
|
||||
bool SendTextEvent(mozilla::WidgetTextEvent& event);
|
||||
bool SendSelectionEvent(nsSelectionEvent& event);
|
||||
|
||||
|
@ -107,7 +107,6 @@ typedef mozilla::WidgetEvent nsEvent;
|
||||
typedef mozilla::WidgetGUIEvent nsGUIEvent;
|
||||
typedef mozilla::WidgetInputEvent nsInputEvent;
|
||||
typedef mozilla::InternalUIEvent nsUIEvent;
|
||||
typedef mozilla::WidgetCompositionEvent nsCompositionEvent;
|
||||
typedef mozilla::WidgetQueryContentEvent nsQueryContentEvent;
|
||||
typedef mozilla::WidgetSelectionEvent nsSelectionEvent;
|
||||
typedef mozilla::WidgetMouseEventBase nsMouseEvent_base;
|
||||
|
@ -534,7 +534,6 @@ public:
|
||||
} // namespace mozilla
|
||||
|
||||
// TODO: Remove following typedefs
|
||||
typedef mozilla::WidgetCompositionEvent nsCompositionEvent;
|
||||
typedef mozilla::WidgetQueryContentEvent nsQueryContentEvent;
|
||||
typedef mozilla::WidgetSelectionEvent nsSelectionEvent;
|
||||
|
||||
|
@ -1822,7 +1822,7 @@ nsWindow::RemoveIMEComposition()
|
||||
textEvent.theText = mIMEComposingText;
|
||||
DispatchEvent(&textEvent);
|
||||
|
||||
nsCompositionEvent event(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent event(true, NS_COMPOSITION_END, this);
|
||||
InitEvent(event, nullptr);
|
||||
DispatchEvent(&event);
|
||||
}
|
||||
@ -1923,7 +1923,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
}
|
||||
|
||||
{
|
||||
nsCompositionEvent event(true, NS_COMPOSITION_START, this);
|
||||
WidgetCompositionEvent event(true, NS_COMPOSITION_START, this);
|
||||
InitEvent(event, nullptr);
|
||||
DispatchEvent(&event);
|
||||
}
|
||||
@ -1934,7 +1934,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
DispatchEvent(&event);
|
||||
}
|
||||
{
|
||||
nsCompositionEvent event(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent event(true, NS_COMPOSITION_END, this);
|
||||
InitEvent(event, nullptr);
|
||||
event.data = ae->Characters();
|
||||
DispatchEvent(&event);
|
||||
@ -2036,16 +2036,16 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
|
||||
event.theText = queryEvent.mReply.mString;
|
||||
}
|
||||
{
|
||||
nsCompositionEvent event(true, NS_COMPOSITION_START, this);
|
||||
WidgetCompositionEvent event(true, NS_COMPOSITION_START, this);
|
||||
InitEvent(event, nullptr);
|
||||
DispatchEvent(&event);
|
||||
}
|
||||
|
||||
if (mIMEComposing &&
|
||||
event.theText != mIMEComposingText) {
|
||||
nsCompositionEvent compositionUpdate(true,
|
||||
NS_COMPOSITION_UPDATE,
|
||||
this);
|
||||
WidgetCompositionEvent compositionUpdate(true,
|
||||
NS_COMPOSITION_UPDATE,
|
||||
this);
|
||||
InitEvent(compositionUpdate, nullptr);
|
||||
compositionUpdate.data = event.theText;
|
||||
DispatchEvent(&compositionUpdate);
|
||||
@ -2131,7 +2131,8 @@ nsWindow::NotifyIME(NotificationToIME aNotification)
|
||||
InitEvent(textEvent, nullptr);
|
||||
DispatchEvent(&textEvent);
|
||||
|
||||
nsCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent compEvent(true, NS_COMPOSITION_END,
|
||||
this);
|
||||
InitEvent(compEvent, nullptr);
|
||||
DispatchEvent(&compEvent);
|
||||
}
|
||||
|
@ -1081,7 +1081,7 @@ private:
|
||||
* @param aCompositionEvent A composition event which you want to
|
||||
* initialize.
|
||||
*/
|
||||
void InitCompositionEvent(nsCompositionEvent& aCompositionEvent);
|
||||
void InitCompositionEvent(WidgetCompositionEvent& aCompositionEvent);
|
||||
|
||||
/**
|
||||
* When a composition starts, OnStartIMEComposition() is called.
|
||||
|
@ -2640,8 +2640,8 @@ IMEInputHandler::DispatchTextEvent(const nsString& aText,
|
||||
textEvent.rangeCount = textRanges.Length();
|
||||
|
||||
if (textEvent.theText != mLastDispatchedCompositionString) {
|
||||
nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mWidget);
|
||||
WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mWidget);
|
||||
compositionUpdate.time = textEvent.time;
|
||||
compositionUpdate.data = textEvent.theText;
|
||||
mLastDispatchedCompositionString = textEvent.theText;
|
||||
@ -2661,7 +2661,7 @@ IMEInputHandler::DispatchTextEvent(const nsString& aText,
|
||||
}
|
||||
|
||||
void
|
||||
IMEInputHandler::InitCompositionEvent(nsCompositionEvent& aCompositionEvent)
|
||||
IMEInputHandler::InitCompositionEvent(WidgetCompositionEvent& aCompositionEvent)
|
||||
{
|
||||
aCompositionEvent.time = PR_IntervalNow();
|
||||
}
|
||||
@ -2727,7 +2727,7 @@ IMEInputHandler::InsertTextAsCommittingComposition(
|
||||
|
||||
// XXXmnakano Probably, we shouldn't emulate composition in this case.
|
||||
// I think that we should just fire DOM3 textInput event if we implement it.
|
||||
nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
|
||||
WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
|
||||
InitCompositionEvent(compStart);
|
||||
|
||||
DispatchEvent(compStart);
|
||||
@ -2752,7 +2752,7 @@ IMEInputHandler::InsertTextAsCommittingComposition(
|
||||
|
||||
OnUpdateIMEComposition([aAttrString string]);
|
||||
|
||||
nsCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
|
||||
WidgetCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
|
||||
InitCompositionEvent(compEnd);
|
||||
compEnd.data = mLastDispatchedCompositionString;
|
||||
DispatchEvent(compEnd);
|
||||
@ -2834,7 +2834,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString,
|
||||
|
||||
mMarkedRange.location = SelectedRange().location;
|
||||
|
||||
nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
|
||||
WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
|
||||
InitCompositionEvent(compStart);
|
||||
|
||||
DispatchEvent(compStart);
|
||||
@ -2861,7 +2861,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString,
|
||||
}
|
||||
|
||||
if (doCommit) {
|
||||
nsCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
|
||||
WidgetCompositionEvent compEnd(true, NS_COMPOSITION_END, mWidget);
|
||||
InitCompositionEvent(compEnd);
|
||||
compEnd.data = mLastDispatchedCompositionString;
|
||||
DispatchEvent(compEnd);
|
||||
|
@ -974,8 +974,8 @@ nsGtkIMModule::DispatchCompositionStart()
|
||||
PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
|
||||
(" mCompositionStart=%u", mCompositionStart));
|
||||
mCompositionState = eCompositionState_CompositionStartDispatched;
|
||||
nsCompositionEvent compEvent(true, NS_COMPOSITION_START,
|
||||
mLastFocusedWindow);
|
||||
WidgetCompositionEvent compEvent(true, NS_COMPOSITION_START,
|
||||
mLastFocusedWindow);
|
||||
InitEvent(compEvent);
|
||||
nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
|
||||
mLastFocusedWindow->DispatchEvent(&compEvent, status);
|
||||
@ -1010,8 +1010,8 @@ nsGtkIMModule::DispatchCompositionEnd()
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCompositionEvent compEvent(true, NS_COMPOSITION_END,
|
||||
mLastFocusedWindow);
|
||||
WidgetCompositionEvent compEvent(true, NS_COMPOSITION_END,
|
||||
mLastFocusedWindow);
|
||||
InitEvent(compEvent);
|
||||
compEvent.data = mDispatchedCompositionString;
|
||||
nsEventStatus status;
|
||||
@ -1057,8 +1057,8 @@ nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
|
||||
nsRefPtr<nsWindow> lastFocusedWindow = mLastFocusedWindow;
|
||||
|
||||
if (aCompositionString != mDispatchedCompositionString) {
|
||||
nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mLastFocusedWindow);
|
||||
WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mLastFocusedWindow);
|
||||
InitEvent(compositionUpdate);
|
||||
compositionUpdate.data = aCompositionString;
|
||||
mDispatchedCompositionString = aCompositionString;
|
||||
|
@ -386,9 +386,9 @@ struct ParamTraits<mozilla::WidgetTextEvent>
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<nsCompositionEvent>
|
||||
struct ParamTraits<mozilla::WidgetCompositionEvent>
|
||||
{
|
||||
typedef nsCompositionEvent paramType;
|
||||
typedef mozilla::WidgetCompositionEvent paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
|
@ -2478,7 +2478,7 @@ bool nsWindow::ImeResultString(HIMI himi)
|
||||
}
|
||||
if (!mIsComposing) {
|
||||
mLastDispatchedCompositionString.Truncate();
|
||||
nsCompositionEvent start(true, NS_COMPOSITION_START, this);
|
||||
WidgetCompositionEvent start(true, NS_COMPOSITION_START, this);
|
||||
InitEvent(start);
|
||||
DispatchWindowEvent(&start);
|
||||
mIsComposing = true;
|
||||
@ -2489,7 +2489,7 @@ bool nsWindow::ImeResultString(HIMI himi)
|
||||
outBuf, outBufLen);
|
||||
nsAutoString compositionString(outBuf.Elements());
|
||||
if (mLastDispatchedCompositionString != compositionString) {
|
||||
nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
|
||||
WidgetCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
|
||||
InitEvent(update);
|
||||
update.data = compositionString;
|
||||
mLastDispatchedCompositionString = compositionString;
|
||||
@ -2501,7 +2501,7 @@ bool nsWindow::ImeResultString(HIMI himi)
|
||||
text.theText = compositionString;
|
||||
DispatchWindowEvent(&text);
|
||||
|
||||
nsCompositionEvent end(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent end(true, NS_COMPOSITION_END, this);
|
||||
InitEvent(end);
|
||||
end.data = compositionString;
|
||||
DispatchWindowEvent(&end);
|
||||
@ -2549,7 +2549,7 @@ bool nsWindow::ImeConversionString(HIMI himi)
|
||||
}
|
||||
if (!mIsComposing) {
|
||||
mLastDispatchedCompositionString.Truncate();
|
||||
nsCompositionEvent start(true, NS_COMPOSITION_START, this);
|
||||
WidgetCompositionEvent start(true, NS_COMPOSITION_START, this);
|
||||
InitEvent(start);
|
||||
DispatchWindowEvent(&start);
|
||||
mIsComposing = true;
|
||||
@ -2561,7 +2561,7 @@ bool nsWindow::ImeConversionString(HIMI himi)
|
||||
nsAutoString compositionString(outBuf.Elements());
|
||||
// Is a conversion string changed ?
|
||||
if (mLastDispatchedCompositionString != compositionString) {
|
||||
nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
|
||||
WidgetCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
|
||||
InitEvent(update);
|
||||
update.data = compositionString;
|
||||
mLastDispatchedCompositionString = compositionString;
|
||||
@ -2672,7 +2672,7 @@ bool nsWindow::ImeConversionString(HIMI himi)
|
||||
DispatchWindowEvent(&text);
|
||||
|
||||
if (compositionString.IsEmpty()) { // IME conversion was canceled ?
|
||||
nsCompositionEvent end(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent end(true, NS_COMPOSITION_END, this);
|
||||
InitEvent(end);
|
||||
end.data = compositionString;
|
||||
DispatchWindowEvent(&end);
|
||||
|
@ -294,7 +294,8 @@ void MozQWidget::sendPressReleaseKeyEvent(int key,
|
||||
|
||||
if (letter) {
|
||||
// Handle as TextEvent
|
||||
nsCompositionEvent start(true, NS_COMPOSITION_START, mReceiver);
|
||||
mozilla::WidgetCompositionEvent start(true, NS_COMPOSITION_START,
|
||||
mReceiver);
|
||||
mReceiver->DispatchEvent(&start);
|
||||
|
||||
mozilla::WidgetTextEvent text(true, NS_TEXT_TEXT, mReceiver);
|
||||
@ -302,7 +303,8 @@ void MozQWidget::sendPressReleaseKeyEvent(int key,
|
||||
text.theText.Assign(commitString.utf16());
|
||||
mReceiver->DispatchEvent(&text);
|
||||
|
||||
nsCompositionEvent end(true, NS_COMPOSITION_END, mReceiver);
|
||||
mozilla::WidgetCompositionEvent end(true, NS_COMPOSITION_END,
|
||||
mReceiver);
|
||||
mReceiver->DispatchEvent(&end);
|
||||
return;
|
||||
}
|
||||
|
@ -2763,13 +2763,13 @@ nsWindow::imComposeEvent(QInputMethodEvent *event, bool &handled)
|
||||
// XXX Needs to check whether this widget has been destroyed or not after
|
||||
// each DispatchEvent().
|
||||
|
||||
nsCompositionEvent start(true, NS_COMPOSITION_START, this);
|
||||
WidgetCompositionEvent start(true, NS_COMPOSITION_START, this);
|
||||
DispatchEvent(&start);
|
||||
|
||||
nsAutoString compositionStr(event->commitString().utf16());
|
||||
|
||||
if (!compositionStr.IsEmpty()) {
|
||||
nsCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
|
||||
WidgetCompositionEvent update(true, NS_COMPOSITION_UPDATE, this);
|
||||
update.data = compositionStr;
|
||||
DispatchEvent(&update);
|
||||
}
|
||||
@ -2778,7 +2778,7 @@ nsWindow::imComposeEvent(QInputMethodEvent *event, bool &handled)
|
||||
text.theText = compositionStr;
|
||||
DispatchEvent(&text);
|
||||
|
||||
nsCompositionEvent end(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent end(true, NS_COMPOSITION_END, this);
|
||||
end.data = compositionStr;
|
||||
DispatchEvent(&end);
|
||||
|
||||
|
@ -934,7 +934,7 @@ nsIMM32Handler::HandleStartComposition(nsWindow* aWindow,
|
||||
mCompositionStart = selection.mReply.mOffset;
|
||||
mLastDispatchedCompositionString.Truncate();
|
||||
|
||||
nsCompositionEvent event(true, NS_COMPOSITION_START, aWindow);
|
||||
WidgetCompositionEvent event(true, NS_COMPOSITION_START, aWindow);
|
||||
aWindow->InitEvent(event, &point);
|
||||
aWindow->DispatchWindowEvent(&event);
|
||||
|
||||
@ -1195,7 +1195,7 @@ nsIMM32Handler::HandleEndComposition(nsWindow* aWindow)
|
||||
PR_LOG(gIMM32Log, PR_LOG_ALWAYS,
|
||||
("IMM32: HandleEndComposition\n"));
|
||||
|
||||
nsCompositionEvent event(true, NS_COMPOSITION_END, aWindow);
|
||||
WidgetCompositionEvent event(true, NS_COMPOSITION_END, aWindow);
|
||||
nsIntPoint point(0, 0);
|
||||
|
||||
if (mNativeCaretIsCreated) {
|
||||
@ -1569,8 +1569,8 @@ nsIMM32Handler::DispatchTextEvent(nsWindow* aWindow,
|
||||
nsIntPoint point(0, 0);
|
||||
|
||||
if (mCompositionString != mLastDispatchedCompositionString) {
|
||||
nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
aWindow);
|
||||
WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
aWindow);
|
||||
aWindow->InitEvent(compositionUpdate, &point);
|
||||
compositionUpdate.data = mCompositionString;
|
||||
mLastDispatchedCompositionString = mCompositionString;
|
||||
|
@ -866,8 +866,8 @@ nsTextStore::FlushPendingActions()
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
("TSF: 0x%p nsTextStore::FlushPendingActions() "
|
||||
"dispatching compositionstart event...", this));
|
||||
nsCompositionEvent compositionStart(true, NS_COMPOSITION_START,
|
||||
mWidget);
|
||||
WidgetCompositionEvent compositionStart(true, NS_COMPOSITION_START,
|
||||
mWidget);
|
||||
mWidget->InitEvent(compositionStart);
|
||||
mWidget->DispatchWindowEvent(&compositionStart);
|
||||
if (!mWidget || mWidget->Destroyed()) {
|
||||
@ -925,8 +925,8 @@ nsTextStore::FlushPendingActions()
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
("TSF: 0x%p nsTextStore::FlushPendingActions(), "
|
||||
"dispatching compositionupdate event...", this));
|
||||
nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mWidget);
|
||||
WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mWidget);
|
||||
mWidget->InitEvent(compositionUpdate);
|
||||
compositionUpdate.data = action.mData;
|
||||
mComposition.mLastData = compositionUpdate.data;
|
||||
@ -971,8 +971,8 @@ nsTextStore::FlushPendingActions()
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
("TSF: 0x%p nsTextStore::FlushPendingActions(), "
|
||||
"dispatching compositionupdate event...", this));
|
||||
nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mWidget);
|
||||
WidgetCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
|
||||
mWidget);
|
||||
mWidget->InitEvent(compositionUpdate);
|
||||
compositionUpdate.data = action.mData;
|
||||
mComposition.mLastData = compositionUpdate.data;
|
||||
@ -998,7 +998,8 @@ nsTextStore::FlushPendingActions()
|
||||
PR_LOG(sTextStoreLog, PR_LOG_DEBUG,
|
||||
("TSF: 0x%p nsTextStore::FlushPendingActions(), "
|
||||
"dispatching compositionend event...", this));
|
||||
nsCompositionEvent compositionEnd(true, NS_COMPOSITION_END, mWidget);
|
||||
WidgetCompositionEvent compositionEnd(true, NS_COMPOSITION_END,
|
||||
mWidget);
|
||||
compositionEnd.data = mComposition.mLastData;
|
||||
mWidget->InitEvent(compositionEnd);
|
||||
mWidget->DispatchWindowEvent(&compositionEnd);
|
||||
|
@ -275,7 +275,7 @@ PuppetWidget::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
|
||||
}
|
||||
switch (event->eventStructType) {
|
||||
case NS_COMPOSITION_EVENT:
|
||||
mIMELastReceivedSeqno = static_cast<nsCompositionEvent*>(event)->seqno;
|
||||
mIMELastReceivedSeqno = static_cast<WidgetCompositionEvent*>(event)->seqno;
|
||||
if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
|
||||
return NS_OK;
|
||||
break;
|
||||
@ -362,7 +362,7 @@ PuppetWidget::IMEEndComposition(bool aCancel)
|
||||
|
||||
DispatchEvent(&textEvent, status);
|
||||
|
||||
nsCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
|
||||
WidgetCompositionEvent compEvent(true, NS_COMPOSITION_END, this);
|
||||
InitEvent(compEvent, nullptr);
|
||||
compEvent.seqno = mIMELastReceivedSeqno;
|
||||
DispatchEvent(&compEvent, status);
|
||||
|
Loading…
Reference in New Issue
Block a user