Backed out changeset 456038b0bdb5 (bug 1121313) for M1,M2 bustage

This commit is contained in:
Nigel Babu 2015-02-17 10:15:44 +05:30
parent 43f860dc7e
commit 95d7aefeee
5 changed files with 17 additions and 21 deletions

View File

@ -267,18 +267,15 @@ parent:
/**
* Instructs chrome to end any pending composition
*
* cancel true if composition should be cancelled
* noCompositionEvent true if no composition event is fired by commit or
* cancel
* cancel PR_TRUE if composition should be cancelled
* composition Text to commit before ending the composition
*
* if cancel is true,
* if cancel is PR_TRUE,
* widget should return empty string for composition
* if cancel is false,
* if cancel is PR_FALSE,
* widget should return the current composition text
*/
prio(urgent) sync EndIMEComposition(bool cancel)
returns (bool noCompositionEvent, nsString composition);
prio(urgent) sync EndIMEComposition(bool cancel) returns (nsString composition);
/**
* Request that the parent process move focus to the browser's frame. If

View File

@ -259,7 +259,6 @@ TabParent::TabParent(nsIContentParent* aManager,
, mWritingMode()
, mIMEComposing(false)
, mIMECompositionEnding(false)
, mIMEEventCountAfterEnding(0)
, mIMECompositionStart(0)
, mIMESeqno(0)
, mIMECompositionRectOffset(0)
@ -2001,10 +2000,8 @@ TabParent::SendCompositionEvent(WidgetCompositionEvent& event)
mIMEComposing = !event.CausesDOMCompositionEndEvent();
mIMECompositionStart = std::min(mIMESelectionAnchor, mIMESelectionFocus);
if (mIMECompositionEnding) {
mIMEEventCountAfterEnding++;
if (mIMECompositionEnding)
return true;
}
event.mSeqno = ++mIMESeqno;
return PBrowserParent::SendCompositionEvent(event);
}
@ -2022,7 +2019,6 @@ TabParent::SendCompositionChangeEvent(WidgetCompositionEvent& event)
{
if (mIMECompositionEnding) {
mIMECompositionText = event.mData;
mIMEEventCountAfterEnding++;
return true;
}
@ -2113,7 +2109,6 @@ TabParent::GetRenderFrame()
bool
TabParent::RecvEndIMEComposition(const bool& aCancel,
bool* aNoCompositionEvent,
nsString* aComposition)
{
nsCOMPtr<nsIWidget> widget = GetWidget();
@ -2121,13 +2116,11 @@ TabParent::RecvEndIMEComposition(const bool& aCancel,
return true;
mIMECompositionEnding = true;
mIMEEventCountAfterEnding = 0;
widget->NotifyIME(IMENotification(aCancel ? REQUEST_TO_CANCEL_COMPOSITION :
REQUEST_TO_COMMIT_COMPOSITION));
mIMECompositionEnding = false;
*aNoCompositionEvent = !mIMEEventCountAfterEnding;
*aComposition = mIMECompositionText;
mIMECompositionText.Truncate(0);
return true;

View File

@ -195,7 +195,6 @@ public:
InfallibleTArray<LayoutDeviceIntRect>&& aCompositionRects,
const LayoutDeviceIntRect& aCaretRect) MOZ_OVERRIDE;
virtual bool RecvEndIMEComposition(const bool& aCancel,
bool* aNoCompositionEvent,
nsString* aComposition) MOZ_OVERRIDE;
virtual bool RecvGetInputContext(int32_t* aIMEEnabled,
int32_t* aIMEOpen,
@ -420,7 +419,6 @@ protected:
mozilla::WritingMode mWritingMode;
bool mIMEComposing;
bool mIMECompositionEnding;
uint32_t mIMEEventCountAfterEnding;
// Buffer to store composition text during ResetInputState
// Compositions in almost all cases are small enough for nsAutoString
nsAutoString mIMECompositionText;

View File

@ -109,6 +109,7 @@ PuppetWidget::Create(nsIWidget *aParent,
mDrawTarget = gfxPlatform::GetPlatform()->
CreateOffscreenContentDrawTarget(IntSize(1, 1), SurfaceFormat::B8G8R8A8);
mIMEComposing = false;
mNeedIMEStateInit = MightNeedIMEFocus(aInitData);
PuppetWidget* parent = static_cast<PuppetWidget*>(aParent);
@ -304,6 +305,9 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
aStatus = nsEventStatus_eIgnore;
if (event->message == NS_COMPOSITION_START) {
mIMEComposing = true;
}
uint32_t seqno = kLatestSeqno;
switch (event->mClass) {
case eCompositionEventClass:
@ -326,6 +330,11 @@ PuppetWidget::DispatchEvent(WidgetGUIEvent* event, nsEventStatus& aStatus)
aStatus = mAttachedWidgetListener->HandleEvent(event, mUseAttachedEvents);
}
if (event->mClass == eCompositionEventClass &&
event->AsCompositionEvent()->CausesDOMCompositionEndEvent()) {
mIMEComposing = false;
}
return NS_OK;
}
@ -393,21 +402,19 @@ PuppetWidget::IMEEndComposition(bool aCancel)
#endif
nsEventStatus status;
bool noCompositionEvent = false;
WidgetCompositionEvent compositionCommitEvent(true, NS_COMPOSITION_COMMIT,
this);
InitEvent(compositionCommitEvent, nullptr);
// SendEndIMEComposition is always called since ResetInputState
// should always be called even if we aren't composing something.
if (!mTabChild ||
!mTabChild->SendEndIMEComposition(aCancel, &noCompositionEvent,
!mTabChild->SendEndIMEComposition(aCancel,
&compositionCommitEvent.mData)) {
return NS_ERROR_FAILURE;
}
if (noCompositionEvent) {
if (!mIMEComposing)
return NS_OK;
}
compositionCommitEvent.mSeqno = mIMELastReceivedSeqno;
DispatchEvent(&compositionCommitEvent, status);

View File

@ -259,6 +259,7 @@ private:
mozilla::RefPtr<DrawTarget> mDrawTarget;
// IME
nsIMEUpdatePreference mIMEPreferenceOfParent;
bool mIMEComposing;
// Latest seqno received through events
uint32_t mIMELastReceivedSeqno;
// Chrome's seqno value when last blur occurred